Lines Matching refs:descriptor
50 php_oci_descriptor *descriptor; in php_oci_lob_create() local
65 descriptor = ecalloc(1, sizeof(php_oci_descriptor)); in php_oci_lob_create()
66 descriptor->type = (ub4) type; in php_oci_lob_create()
67 descriptor->connection = connection; in php_oci_lob_create()
68 GC_ADDREF(descriptor->connection->id); in php_oci_lob_create()
70 …errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->ty… in php_oci_lob_create()
75 efree(descriptor); in php_oci_lob_create()
81 PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor); in php_oci_lob_create()
83 descriptor->lob_current_position = 0; in php_oci_lob_create()
84 descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */ in php_oci_lob_create()
85 descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */ in php_oci_lob_create()
86 descriptor->charset_form = SQLCS_IMPLICIT; /* default value */ in php_oci_lob_create()
87 descriptor->charset_id = connection->charset; in php_oci_lob_create()
88 descriptor->is_open = 0; in php_oci_lob_create()
89 descriptor->chunk_size = 0; in php_oci_lob_create()
91 if (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE) { in php_oci_lob_create()
99 descriptor->index = (connection->descriptor_count)++; in php_oci_lob_create()
106 zend_hash_index_update_ptr(connection->descriptors, descriptor->index, descriptor); in php_oci_lob_create()
108 return descriptor; in php_oci_lob_create()
115 int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length) in php_oci_lob_get_length() argument
117 php_oci_connection *connection = descriptor->connection; in php_oci_lob_get_length()
122 if (descriptor->lob_size >= 0) { in php_oci_lob_get_length()
123 *length = descriptor->lob_size; in php_oci_lob_get_length()
126 if (descriptor->type == OCI_DTYPE_FILE) { in php_oci_lob_get_length()
127 …RN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_… in php_oci_lob_get_length()
135 …N(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)le… in php_oci_lob_get_length()
143 descriptor->lob_size = *length; in php_oci_lob_get_length()
145 if (descriptor->type == OCI_DTYPE_FILE) { in php_oci_lob_get_length()
146 …ALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); in php_oci_lob_get_length()
206 static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, zend_long read_lengt… in php_oci_lob_calculate_buffer() argument
208 php_oci_connection *connection = descriptor->connection; in php_oci_lob_calculate_buffer()
212 if (descriptor->type == OCI_DTYPE_FILE) { in php_oci_lob_calculate_buffer()
216 if (!descriptor->chunk_size) { in php_oci_lob_calculate_buffer()
217 …rrstatus, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_si… in php_oci_lob_calculate_buffer()
224 descriptor->chunk_size = chunk_size; in php_oci_lob_calculate_buffer()
228 if ((read_length % descriptor->chunk_size) != 0) { in php_oci_lob_calculate_buffer()
229 return (int) descriptor->chunk_size * (((int) read_length / descriptor->chunk_size) + 1); in php_oci_lob_calculate_buffer()
237 int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zend_long initial_offs… in php_oci_lob_read() argument
239 php_oci_connection *connection = descriptor->connection; in php_oci_lob_read()
258 if (php_oci_lob_get_length(descriptor, &length)) { in php_oci_lob_read()
285 if (descriptor->type == OCI_DTYPE_FILE) { in php_oci_lob_read()
286 …RN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_… in php_oci_lob_read()
296 …N(errstatus, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_… in php_oci_lob_read()
333 buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size); /* use chunk size */ in php_oci_lob_read()
340 descriptor->descriptor, in php_oci_lob_read()
349 (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */ in php_oci_lob_read()
350 (ub1) descriptor->charset_form /* The character set form of the buffer data. */ in php_oci_lob_read()
357 offset = descriptor->lob_current_position + chars_read; in php_oci_lob_read()
359 offset = descriptor->lob_current_position + bytes_read; in php_oci_lob_read()
373 descriptor->lob_current_position = (int)offset; in php_oci_lob_read()
375 if (descriptor->type == OCI_DTYPE_FILE) { in php_oci_lob_read()
376 …ALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); in php_oci_lob_read()
397 int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *b… in php_oci_lob_write() argument
399 OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor; in php_oci_lob_write()
400 php_oci_connection *connection = (php_oci_connection *) descriptor->connection; in php_oci_lob_write()
405 if (php_oci_lob_get_length(descriptor, &lob_length)) { in php_oci_lob_write()
413 if (offset > descriptor->lob_current_position) { in php_oci_lob_write()
414 offset = descriptor->lob_current_position; in php_oci_lob_write()
429 (ub2) descriptor->charset_id, in php_oci_lob_write()
430 (ub1) descriptor->charset_form in php_oci_lob_write()
441 descriptor->lob_current_position += data_len; in php_oci_lob_write()
443 if ((int) descriptor->lob_current_position > (int) descriptor->lob_size) { in php_oci_lob_write()
444 descriptor->lob_size = descriptor->lob_current_position; in php_oci_lob_write()
448 if (descriptor->buffering == PHP_OCI_LOB_BUFFER_ENABLED) { in php_oci_lob_write()
449 descriptor->buffering = PHP_OCI_LOB_BUFFER_USED; in php_oci_lob_write()
459 int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off) in php_oci_lob_set_buffering() argument
461 php_oci_connection *connection = descriptor->connection; in php_oci_lob_set_buffering()
464 if (!on_off && descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) { in php_oci_lob_set_buffering()
469 if (on_off && descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) { in php_oci_lob_set_buffering()
475 …TURN(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); in php_oci_lob_set_buffering()
477 …URN(errstatus, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); in php_oci_lob_set_buffering()
485 descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED; in php_oci_lob_set_buffering()
493 int php_oci_lob_get_buffering (php_oci_descriptor *descriptor) in php_oci_lob_get_buffering() argument
495 if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) { in php_oci_lob_get_buffering()
534 descriptor_dest->descriptor, in php_oci_lob_copy()
535 descriptor_from->descriptor, in php_oci_lob_copy()
555 int php_oci_lob_close (php_oci_descriptor *descriptor) in php_oci_lob_close() argument
557 php_oci_connection *connection = descriptor->connection; in php_oci_lob_close()
560 if (descriptor->is_open) { in php_oci_lob_close()
561 …CI_CALL_RETURN(errstatus, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); in php_oci_lob_close()
571 if (php_oci_temp_lob_close(descriptor)) { in php_oci_lob_close()
581 int php_oci_temp_lob_close (php_oci_descriptor *descriptor) in php_oci_temp_lob_close() argument
583 php_oci_connection *connection = descriptor->connection; in php_oci_temp_lob_close()
587 …(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_tempo… in php_oci_temp_lob_close()
596 …RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); in php_oci_temp_lob_close()
611 int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag) in php_oci_lob_flush() argument
613 OCILobLocator *lob = descriptor->descriptor; in php_oci_lob_flush()
614 php_oci_connection *connection = descriptor->connection; in php_oci_lob_flush()
635 if (descriptor->buffering != PHP_OCI_LOB_BUFFER_USED) { in php_oci_lob_flush()
648 descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED; in php_oci_lob_flush()
656 void php_oci_lob_free (php_oci_descriptor *descriptor) in php_oci_lob_free() argument
658 if (!descriptor || !descriptor->connection) { in php_oci_lob_free()
662 if (descriptor->connection->descriptors) { in php_oci_lob_free()
663 if (zend_hash_num_elements(descriptor->connection->descriptors) == 0) { in php_oci_lob_free()
664 descriptor->connection->descriptor_count = 0; in php_oci_lob_free()
667 zend_hash_index_del(descriptor->connection->descriptors, descriptor->index); in php_oci_lob_free()
668 if (descriptor->index + 1 == descriptor->connection->descriptor_count) { in php_oci_lob_free()
680 descriptor->connection->descriptor_count--; in php_oci_lob_free()
686 …if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffe… in php_oci_lob_free()
687 php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE); in php_oci_lob_free()
690 if (descriptor->type == OCI_DTYPE_LOB) { in php_oci_lob_free()
691 php_oci_temp_lob_close(descriptor); in php_oci_lob_free()
694 PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type)); in php_oci_lob_free()
696 zend_list_delete(descriptor->connection->id); in php_oci_lob_free()
697 efree(descriptor); in php_oci_lob_free()
703 int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename) in php_oci_lob_import() argument
707 OCILobLocator *lob = (OCILobLocator *)descriptor->descriptor; in php_oci_lob_import()
708 php_oci_connection *connection = descriptor->connection; in php_oci_lob_import()
736 (ub2) descriptor->charset_id, in php_oci_lob_import()
737 (ub1) descriptor->charset_form in php_oci_lob_import()
762 OCILobLocator *lob_dest = descriptor_dest->descriptor; in php_oci_lob_append()
763 OCILobLocator *lob_from = descriptor_from->descriptor; in php_oci_lob_append()
793 int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_length) in php_oci_lob_truncate() argument
795 php_oci_connection *connection = descriptor->connection; in php_oci_lob_truncate()
796 OCILobLocator *lob = descriptor->descriptor; in php_oci_lob_truncate()
800 if (php_oci_lob_get_length(descriptor, &lob_length)) { in php_oci_lob_truncate()
826 descriptor->lob_size = (ub4) new_lob_length; in php_oci_lob_truncate()
835 int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 length, ub4 *bytes_era… in php_oci_lob_erase() argument
837 php_oci_connection *connection = descriptor->connection; in php_oci_lob_erase()
838 OCILobLocator *lob = descriptor->descriptor; in php_oci_lob_erase()
844 if (php_oci_lob_get_length(descriptor, &lob_length)) { in php_oci_lob_erase()
849 offset = descriptor->lob_current_position; in php_oci_lob_erase()
875 OCILobLocator *first_lob = descriptor_first->descriptor; in php_oci_lob_is_equal()
876 OCILobLocator *second_lob = descriptor_second->descriptor; in php_oci_lob_is_equal()
893 int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, zend_long type, char *data, int data_len) in php_oci_lob_write_tmp() argument
895 php_oci_connection *connection = descriptor->connection; in php_oci_lob_write_tmp()
896 OCILobLocator *lob = descriptor->descriptor; in php_oci_lob_write_tmp()
942 descriptor->is_open = 1; in php_oci_lob_write_tmp()
945 return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written); in php_oci_lob_write_tmp()