if ((tmp_val != NULL) && (Z_TYPE_P(tmp_val) == IS_RESOURCE)) {
tmp = Z_RES_VAL_P(tmp_val);
}
-
+
if ((tmp_val != NULL) && (tmp != NULL) &&
(ZSTR_LEN(tmp->hash_key) == ZSTR_LEN(hashed_details.s)) &&
(memcmp(ZSTR_VAL(tmp->hash_key), ZSTR_VAL(hashed_details.s),
/* {{{ php_oci_collection_create()
Create and return connection handle */
php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len)
-{
+{
dvoid *dschp1 = NULL;
dvoid *parmp1;
dvoid *parmp2;
php_oci_collection *collection;
sword errstatus;
-
+
collection = emalloc(sizeof(php_oci_collection));
collection->connection = connection;
default:
php_error_docref(NULL, E_WARNING, "unknown collection type %d", collection->coll_typecode);
break;
- }
+ }
/* Create object to hold return table */
PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew,
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return collection;
-
+
CLEANUP:
if (dschp1) {
}
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- php_oci_collection_close(collection);
+ php_oci_collection_close(collection);
return NULL;
}
/* }}} */
{
php_oci_connection *connection = collection->connection;
sword errstatus;
-
+
PHP_OCI_CALL_RETURN(errstatus, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
if (errstatus != OCI_SUCCESS) {
int php_oci_collection_max(php_oci_collection *collection, zend_long *max)
{
php_oci_connection *connection = collection->connection;
-
+
PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection));
/* error handling is not necessary here? */
/* append NULL element */
PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
-
+
if (errstatus != OCI_SUCCESS) {
errstatus = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
sword errstatus;
element_double = zend_strtod(number, NULL);
-
+
PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
if (errstatus != OCI_SUCCESS) {
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
sword errstatus;
-
+
PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (errstatus != OCI_SUCCESS) {
if (element_len == 0) {
return php_oci_collection_append_null(collection);
}
-
+
switch(collection->element_typecode) {
case OCI_TYPECODE_DATE:
return php_oci_collection_append_date(collection, element, element_len);
break;
-
+
case OCI_TYPECODE_VARCHAR2 :
return php_oci_collection_append_string(collection, element, element_len);
break;
oratext buff[1024];
ub4 buff_len = 1024;
sword errstatus;
-
+
ZVAL_NULL(result_element);
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
if (exists == 0) {
/* element doesn't exist */
return 1;
switch (collection->element_typecode) {
case OCI_TYPECODE_DATE:
PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
-
+
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
ZVAL_STRINGL(result_element, (char *)buff, buff_len);
Z_STRVAL_P(result_element)[buff_len] = '\0';
-
+
return 0;
break;
{
OCIString *oci_string = *(OCIString **)element;
text *str;
-
+
PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
-
+
if (str) {
ZVAL_STRING(result_element, (char *)str);
}
case OCI_TYPECODE_SMALLINT: /* SMALLINT */
{
double double_number;
-
+
PHP_OCI_CALL_RETURN(errstatus, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
if (errstatus != OCI_SUCCESS) {
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
ZVAL_DOUBLE(result_element, double_number);
return 0;
/* set NULL element */
PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
-
+
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
sword errstatus;
element_double = zend_strtod(number, NULL);
-
+
PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
if (errstatus != OCI_SUCCESS) {
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
sword errstatus;
-
+
PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (errstatus != OCI_SUCCESS) {
if (value_len == 0) {
return php_oci_collection_element_set_null(collection, index);
}
-
+
switch(collection->element_typecode) {
case OCI_TYPECODE_DATE:
return php_oci_collection_element_set_date(collection, index, value, value_len);
break;
-
+
case OCI_TYPECODE_VARCHAR2 :
return php_oci_collection_element_set_string(collection, index, value, value_len);
break;
{
php_oci_connection *connection = collection_dest->connection;
sword errstatus;
-
+
PHP_OCI_CALL_RETURN(errstatus, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
if (errstatus != OCI_SUCCESS) {
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
}
-
+
zend_list_delete(collection->connection->id);
efree(collection);
return;
zval *z_statement;
zval *bind_var = NULL;
php_oci_statement *statement;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) {
return;
}
if (type) {
bind_type = (ub2) type;
}
-
+
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type)) {
zval *z_statement;
zval *bind_var = NULL;
php_oci_statement *statement;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rszl|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
return;
}
if (ZEND_NUM_ARGS() == 5 && max_item_len <= 0) {
max_item_len = -1;
}
-
+
if (max_array_len <= 0) {
php_error_docref(NULL, E_WARNING, "Maximum array length must be greater than zero");
RETURN_FALSE;
}
-
+
if (php_oci_bind_array_by_name(statement, name, (sb4) name_len, bind_var, max_array_len, max_item_len, type)) {
RETURN_FALSE;
}
return;
}
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
return;
}
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
php_error_docref(NULL, E_WARNING, "Offset parameter must be greater than or equal to 0");
RETURN_FALSE;
}
-
+
if (php_oci_lob_write(descriptor, (ub4) offset, data, (ub4) data_len, &bytes_written)) {
RETURN_FALSE;
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) {
return;
- }
+ }
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len)) {
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) {
return;
- }
+ }
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (length <= 0) {
php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
RETURN_FALSE;
}
-
+
if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len)) {
RETURN_FALSE;
- }
+ }
if (buffer_len > 0) {
zend_string *ret = zend_string_init(buffer, buffer_len, 0);
efree(buffer);
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 lob_length;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (!php_oci_lob_get_length(descriptor, &lob_length)) {
if (lob_length == descriptor->lob_current_position) {
RETURN_TRUE;
{
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
- RETURN_LONG(descriptor->lob_current_position);
+
+ RETURN_LONG(descriptor->lob_current_position);
}
/* }}} */
{
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
descriptor->lob_current_position = 0;
RETURN_TRUE;
php_oci_descriptor *descriptor;
zend_long offset, whence = PHP_OCI_SEEK_SET;
ub4 lob_length;
-
+
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &offset, &whence) == FAILURE) {
return;
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|l", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) {
return;
- }
+ }
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length)) {
default:
descriptor->lob_current_position = (offset > 0) ? (ub4) offset : 0;
break;
- }
+ }
if (descriptor->lob_current_position > UB4MAXVAL) {
php_error_docref(NULL, E_WARNING, "Invalid offset or LOB position");
RETURN_FALSE;
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 lob_length;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (php_oci_lob_get_length(descriptor, &lob_length)) {
RETURN_FALSE;
}
zend_long write_len = 0;
ub4 bytes_written;
char *data;
-
+
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &data, &data_len, &write_len) == FAILURE) {
return;
}
-
+
if (ZEND_NUM_ARGS() == 2) {
data_len = MIN((zend_long) data_len, write_len);
}
data_len = MIN((zend_long) data_len, write_len);
}
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (data_len <= 0) {
RETURN_LONG(0);
}
-
+
if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, (ub4) data_len, &bytes_written)) {
RETURN_FALSE;
}
{
zval *tmp_dest, *tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from;
php_oci_descriptor *descriptor_dest, *descriptor_from;
-
+
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) {
return;
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
-
+
if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest);
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from);
-
+
if (php_oci_lob_append(descriptor_dest, descriptor_from)) {
RETURN_FALSE;
}
php_oci_descriptor *descriptor;
zend_long trim_length = 0;
ub4 ub_trim_length;
-
+
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &trim_length) == FAILURE) {
return;
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
ub_trim_length = (ub4) trim_length;
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (php_oci_lob_truncate(descriptor, ub_trim_length)) {
RETURN_FALSE;
}
php_oci_descriptor *descriptor;
ub4 bytes_erased;
zend_long offset = -1, length = -1;
-
+
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &offset, &length) == FAILURE) {
return;
php_error_docref(NULL, E_WARNING, "Offset must be greater than or equal to 0");
RETURN_FALSE;
}
-
+
if (ZEND_NUM_ARGS() > 2 && length < 0) {
php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0");
RETURN_FALSE;
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
zend_long flush_flag = 0;
-
+
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flush_flag) == FAILURE) {
return;
return;
}
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) {
/* buffering wasn't enabled, there is nothing to flush */
RETURN_FALSE;
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
zend_bool flag;
-
+
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &flag) == FAILURE) {
return;
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &z_descriptor, oci_lob_class_entry_ptr, &flag) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (php_oci_lob_set_buffering(descriptor, flag)) {
RETURN_FALSE;
}
{
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
RETURN_TRUE;
}
zval *tmp_dest, *tmp_from, *z_descriptor_dest, *z_descriptor_from;
php_oci_descriptor *descriptor_dest, *descriptor_from;
zend_long length = 0;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) {
return;
}
-
+
if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
-
+
if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest);
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from);
-
+
if (ZEND_NUM_ARGS() == 3 && length < 0) {
php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
RETURN_FALSE;
}
-
+
if (ZEND_NUM_ARGS() == 2) {
/* indicate that we want to copy from the current position to the end of the LOB */
length = -1;
zval *tmp_first, *tmp_second, *z_descriptor_first, *z_descriptor_second;
php_oci_descriptor *descriptor_first, *descriptor_second;
boolean is_equal;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_first, oci_lob_class_entry_ptr, &z_descriptor_second, oci_lob_class_entry_ptr) == FAILURE) {
return;
}
-
+
if ((tmp_first = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
-
+
if ((tmp_second = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_first, descriptor_first);
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_second, descriptor_second);
if (php_oci_lob_is_equal(descriptor_first, descriptor_second, &is_equal)) {
RETURN_FALSE;
}
-
+
if (is_equal == TRUE) {
RETURN_TRUE;
}
/* {{{ proto bool oci_lob_export([string filename [, int start [, int length]]])
Writes a large object into a file */
PHP_FUNCTION(oci_lob_export)
-{
+{
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *filename;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ll", &filename, &filename_len, &start, &length) == FAILURE) {
return;
}
-
+
if (ZEND_NUM_ARGS() > 1 && start < 0) {
php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0");
RETURN_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) {
return;
}
-
+
if (ZEND_NUM_ARGS() > 2 && start < 0) {
php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0");
RETURN_FALSE;
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
-
+
if (php_oci_lob_get_length(descriptor, &lob_length)) {
RETURN_FALSE;
- }
-
+ }
+
if (start == -1) {
start = 0;
}
if (buffer) {
efree(buffer);
}
-
+
length -= tmp_bytes_read;
descriptor->lob_current_position += tmp_bytes_read;
start += tmp_bytes_read;
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_write_tmp(descriptor, type, data, (int) data_len)) {
{
zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_close(descriptor)) {
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
/* php_oci_lob_create() checks type */
- descriptor = php_oci_lob_create(connection, type);
-
+ descriptor = php_oci_lob_create(connection, type);
+
if (!descriptor) {
RETURN_NULL();
}
if (connection->descriptors) {
php_oci_connection_descriptors_free(connection);
}
-
+
if (php_oci_connection_commit(connection)) {
RETURN_FALSE;
}
if (!column) {
RETURN_FALSE;
}
-
+
switch (column->data_type) {
#ifdef SQLT_TIMESTAMP
case SQLT_TIMESTAMP:
while (!php_oci_statement_fetch(statement, nrows)) {
zval row;
-
+
array_init_size(&row, statement->ncolumns);
for (i = 0; i < statement->ncolumns; i++) {
array_init_size(array, statement->ncolumns);
columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);
outarrs = safe_emalloc(statement->ncolumns, sizeof(zval*), 0);
-
+
if (flags & PHP_OCI_NUM) {
for (i = 0; i < statement->ncolumns; i++) {
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0);
-
+
array_init(&tmp);
outarrs[ i ] = zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp);
}
for (i = 0; i < statement->ncolumns; i++) {
zend_string *zvtmp;
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0);
-
+
array_init(&tmp);
zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0);
outarrs[ i ] = zend_symtable_update(Z_ARRVAL_P(array), zvtmp, &tmp);
break;
}
}
-
+
efree(columns);
efree(outarrs);
}
/* do nothing to keep BC */
return;
}
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
return;
}
}
/* ZVAL_NULL(z_connection); */
-
+
RETURN_TRUE;
}
/* }}} */
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
statement = php_oci_statement_create(connection, NULL, 0);
-
+
if (statement) {
RETURN_RES(statement->id);
}
PHP_FUNCTION(oci_result)
{
php_oci_out_column *column;
-
+
column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
if(column) {
php_oci_column_to_zval(column, return_value, 0);
if (php_oci_server_get_version(connection, version, sizeof(version))) {
RETURN_FALSE;
}
-
+
ret = zend_string_init(version, strlen(version), 0);
RETURN_STR(ret);
}
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
zend_list_close(collection->id);
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_append(collection, value, (int) value_len)) {
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_element_get(collection, element_index, &value)) {
RETURN_FALSE;
}
-
+
RETURN_ZVAL(&value, 1, 1);
}
/* }}} */
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_collection_dest, oci_coll_class_entry_ptr, &z_collection_from, oci_coll_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_collection_dest), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property. The first argument should be valid collection object");
RETURN_FALSE;
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_element_set(collection, element_index, value, (int) value_len)) {
zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
sb4 size = 0;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_size(collection, &size)) {
zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
zend_long max;
-
+
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_max(collection, &max)) {
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) {
return;
- }
+ }
}
-
+
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_trim(collection, trim_size)) {
RETURN_FALSE;
}
- RETURN_TRUE;
+ RETURN_TRUE;
}
/* }}} */
php_oci_collection *collection;
char *tdo, *schema = NULL;
size_t tdo_len, schema_len = 0;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) {
return;
}
-
+
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
-
+
if ( (collection = php_oci_collection_create(connection, tdo, (int) tdo_len, schema, (int) schema_len)) ) {
object_init_ex(return_value, oci_coll_class_entry_ptr);
add_property_resource(return_value, "collection", collection->id);
}
PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
-
+
descriptor->lob_current_position = 0;
descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */
descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */
zend_hash_init(connection->descriptors, 0, NULL, php_oci_descriptor_flush_hash_dtor, 0);
connection->descriptor_count = 0;
}
-
+
descriptor->index = (connection->descriptor_count)++;
if (connection->descriptor_count == LONG_MAX) {
php_error_docref(NULL, E_WARNING, "Internal descriptor counter has reached limit");
sword errstatus;
*length = 0;
-
+
if (descriptor->lob_size >= 0) {
*length = descriptor->lob_size;
return 0;
return 1;
}
}
-
+
PHP_OCI_CALL_RETURN(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
if (errstatus != OCI_SUCCESS) {
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
- return 0;
+ return 0;
}
/* }}} */
descriptor->chunk_size = chunk_size;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
-
+
if ((read_length % descriptor->chunk_size) != 0) {
return (int) descriptor->chunk_size * (((int) read_length / descriptor->chunk_size) + 1);
}
if (length <= 0) {
return 0;
}
-
+
if (initial_offset > length) {
php_error_docref(NULL, E_WARNING, "Offset must be less than size of the LOB");
return 1;
}
-
+
if (read_length == -1) {
requested_len = length;
}
-
+
if ((ub4) requested_len > (length - (ub4) initial_offset)) {
requested_len = length - initial_offset;
}
-
+
if (requested_len <= 0) {
return 0;
}
-
+
offset = initial_offset;
if (descriptor->type == OCI_DTYPE_FILE) {
(ub1) descriptor->charset_form /* The character set form of the buffer data. */
)
);
-
+
efree(bufp);
-
+
if (is_clob) {
offset = descriptor->lob_current_position + chars_read;
} else {
offset = descriptor->lob_current_position + bytes_read;
}
-
+
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
*data_len = 0;
return 1;
}
-
+
descriptor->lob_current_position = (int)offset;
if (descriptor->type == OCI_DTYPE_FILE) {
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
ub4 lob_length;
sword errstatus;
-
+
*bytes_written = 0;
if (php_oci_lob_get_length(descriptor, &lob_length)) {
return 1;
}
-
+
if (!data || data_len <= 0) {
return 0;
}
-
+
if (offset > descriptor->lob_current_position) {
offset = descriptor->lob_current_position;
}
-
+
PHP_OCI_CALL_RETURN(errstatus, OCILobWrite,
(
connection->svc,
}
*bytes_written = data_len;
descriptor->lob_current_position += data_len;
-
+
if ((int) descriptor->lob_current_position > (int) descriptor->lob_size) {
descriptor->lob_size = descriptor->lob_current_position;
}
-
+
/* marking buffer as used */
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_ENABLED) {
descriptor->buffering = PHP_OCI_LOB_BUFFER_USED;
}
-
+
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* disabling when it's already off */
return 0;
}
-
+
if (on_off && descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
/* enabling when it's already on */
return 0;
}
-
+
if (on_off) {
PHP_OCI_CALL_RETURN(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
} else {
php_oci_connection *connection = descriptor_dest->connection;
ub4 length_dest, length_from, copy_len;
sword errstatus;
-
+
if (php_oci_lob_get_length(descriptor_dest, &length_dest)) {
return 1;
}
-
+
if (php_oci_lob_get_length(descriptor_from, &length_from)) {
return 1;
}
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
if (php_oci_temp_lob_close(descriptor)) {
return 1;
}
-
+
return 0;
}
/* }}} */
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
-
+
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
if (is_temporary) {
PHP_OCI_CALL_RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
-
+
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
break;
}
-
+
/* do not really flush buffer, but report success
* to suppress OCI error when flushing not used buffer
* */
}
}
}
-
+
/* flushing Lobs & Files with buffering enabled */
if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED) {
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE);
char buf[8192];
ub4 offset = 1;
sword errstatus;
-
+
if (php_check_open_basedir(filename)) {
return 1;
}
-
+
if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) {
php_error_docref(NULL, E_WARNING, "Can't open file %s", filename);
return 1;
}
- while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
+ while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
PHP_OCI_CALL_RETURN(errstatus,
OCILobWrite,
(
offset += loblen;
}
close(fp);
-
+
return 0;
}
/* }}} */
if (php_oci_lob_get_length(descriptor_dest, &dest_len)) {
return 1;
}
-
+
if (php_oci_lob_get_length(descriptor_from, &from_len)) {
return 1;
}
OCILobLocator *lob = descriptor->descriptor;
ub4 lob_length;
sword errstatus;
-
+
if (php_oci_lob_get_length(descriptor, &lob_length)) {
return 1;
}
-
+
if (lob_length <= 0) {
return 0;
}
php_error_docref(NULL, E_WARNING, "Size must be less than or equal to the current LOB size");
return 1;
}
-
+
PHP_OCI_CALL_RETURN(errstatus, OCILobTrim, (connection->svc, connection->err, lob, (ub4) new_lob_length));
if (errstatus != OCI_SUCCESS) {
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
descriptor->lob_size = (ub4) new_lob_length;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
sword errstatus;
*bytes_erased = 0;
-
+
if (php_oci_lob_get_length(descriptor, &lob_length)) {
return 1;
}
-
+
if (offset == -1) {
offset = descriptor->lob_current_position;
}
if (length == -1) {
length = lob_length;
}
-
+
PHP_OCI_CALL_RETURN(errstatus, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, (ub4) offset+1));
if (errstatus != OCI_SUCCESS) {
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
+
*bytes_erased = length;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
OCILobLocator *lob = descriptor->descriptor;
ub4 bytes_written = 0;
sword errstatus;
-
+
switch (type) {
case OCI_TEMP_BLOB:
case OCI_TEMP_CLOB:
/* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL));
}
-
+
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL));
-
+
if (query_len > 0) {
PHP_OCI_CALL_RETURN(errstatus, OCIStmtPrepare2,
(
return NULL;
}
}
-
+
if (query && query_len) {
statement->last_query = ecalloc(1, query_len + 1);
memcpy(statement->last_query, query, query_len);
} else {
php_oci_statement_set_prefetch(statement, (ub4)100); /* semi-arbitrary, "sensible default" */
}
-
+
PHP_OCI_REGISTER_RESOURCE(statement, le_statement);
OCI_G(num_statements)++;
-
+
return statement;
}
/* }}} */
statement2 = ecalloc(1,sizeof(php_oci_statement));
PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_ERROR, 0, NULL));
- statement2->stmt = (OCIStmt *)result;
+ statement2->stmt = (OCIStmt *)result;
statement2->parent_stmtid = statement->id;
statement2->impres_child_stmt = NULL;
statement2->impres_count = 0;
GC_REFCOUNT(statement2->connection->id)++;
php_oci_statement_set_prefetch(statement2, statement->prefetch_count);
-
+
PHP_OCI_REGISTER_RESOURCE(statement2, le_statement);
-
+
OCI_G(num_statements)++;
-
+
return statement2;
}
#endif /* OCI_MAJOR_VERSION < 12 */
}
PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err));
-
+
if (errstatus != OCI_SUCCESS) {
statement->errcode = php_oci_error(statement->err, errstatus);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
piecewisecols = 1;
}
}
-
+
while (errstatus == OCI_NEED_DATA) {
if (piecewisecols) {
PHP_OCI_CALL_RETURN(errstatus,
if (column == NULL) {
continue;
}
-
+
if (!column->define) {
continue;
}
-
+
ZEND_ASSERT(Z_ISREF(column->define->val));
zval_ptr_dtor(Z_REFVAL(column->define->val));
ZVAL_NULL(Z_REFVAL(column->define->val));
php_oci_out_column *outcol = (php_oci_out_column *)ctx;
if (!outcol) {
-
+
php_error_docref(NULL, E_WARNING, "Invalid context pointer value");
return OCI_ERROR;
}
-
+
switch(outcol->data_type) {
case SQLT_RSET: {
php_oci_statement *nested_stmt;
}
outcol->descid = descr->id;
descr->charset_form = outcol->charset_form;
-
+
*bufpp = descr->descriptor;
*alenpp = &(outcol->retlen4);
*piecep = OCI_ONE_PIECE;
return 1;
break;
}
-
+
if (!statement->stmttype) {
/* get statement type */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
} else {
iters = 1;
}
-
+
if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */
if (statement->binds) {
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
-
+
if (statement->binds) {
zend_hash_apply(statement->binds, php_oci_bind_post_exec);
}
if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) {
/* we only need to do the define step is this very statement is executed the first time! */
statement->executed = 1;
-
+
ALLOC_HASHTABLE(statement->columns);
zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0);
-
+
counter = 1;
/* get number of columns */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err));
-
+
if (errstatus != OCI_SUCCESS) {
statement->errcode = php_oci_error(statement->err, errstatus);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
}
statement->ncolumns = colcount;
-
+
for (counter = 1; counter <= colcount; counter++) {
outcol = (php_oci_out_column *) ecalloc(1, sizeof(php_oci_out_column));
-
+
if ((outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol)) == NULL) {
FREE_HASHTABLE(statement->columns);
/* out of memory */
return 1;
}
-
+
/* get column */
PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter));
-
+
if (errstatus != OCI_SUCCESS) {
statement->errcode = php_oci_error(statement->err, errstatus);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
-
+
/* get character set id */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err));
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
-
+
/* get size of the column */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err));
-
+
if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
statement->errcode = php_oci_error(statement->err, errstatus);
/* get scale of the column */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
-
+
if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
statement->errcode = php_oci_error(statement->err, errstatus);
/* get precision of the column */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err));
-
+
if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
statement->errcode = php_oci_error(statement->err, errstatus);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
-
+
/* get name of the column */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err));
-
+
if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
statement->errcode = php_oci_error(statement->err, errstatus);
} else {
outcol->storage_size4++; /* add one for string terminator */
}
-
+
outcol->storage_size4 *= 3;
-
+
dynamic = OCI_DEFAULT;
buf = outcol->data = (text *) safe_emalloc(1, outcol->storage_size4, 0);
memset(buf, 0, outcol->storage_size4);
);
}
-
+
if (errstatus != OCI_SUCCESS) {
statement->errcode = php_oci_error(statement->err, errstatus);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
zend_list_delete(statement->connection->id);
efree(statement);
-
+
OCI_G(num_statements)--;
}
/* }}} */
* bind->indicator are not used for oci_bind_array_by_name.
*/
return 0;
- }
+ }
switch (bind->type) {
case SQLT_NTY:
case SQLT_BFILEE:
*(int *)result = 1;
}
break;
-
+
case SQLT_CHR:
case SQLT_AFC:
case SQLT_INT:
ub4 buff_len = 1024;
memset((void*)buff,0,sizeof(buff));
-
+
if ((i < (int) bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
zval_ptr_dtor(entry);
}
}
break;
-
+
case SQLT_AFC:
case SQLT_CHR:
case SQLT_VCS:
case SQLT_NTY:
{
zval *tmp;
-
+
if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
return 1;
PHP_OCI_ZVAL_TO_COLLECTION_EX(tmp, bind_collection);
value_sz = sizeof(void*);
mode = OCI_DEFAULT;
-
+
if (!bind_collection->collection) {
return 1;
}
case SQLT_RDD:
{
zval *tmp;
-
+
if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
return 1;
PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(tmp, bind_descriptor);
value_sz = sizeof(void*);
-
+
oci_desc = bind_descriptor->descriptor;
-
+
if (!oci_desc) {
return 1;
}
}
break;
-
+
case SQLT_INT:
case SQLT_NUM:
if (Z_TYPE_P(param) == IS_RESOURCE || Z_TYPE_P(param) == IS_OBJECT) {
value_sz = sizeof(oci_phpsized_int);
mode = OCI_DEFAULT;
break;
-
+
case SQLT_LBI:
case SQLT_BIN:
case SQLT_LNG:
*/
if (value_sz == 0)
value_sz = 1;
-
+
bindp->descriptor = oci_desc;
bindp->statement = oci_stmt;
bindp->parent_statement = statement;
statement->stmt, /* statement handle */
(OCIBind **)&bindp->bind, /* bind hdl (will alloc) */
statement->err, /* error handle */
- (text*) name, /* placeholder name */
+ (text*) name, /* placeholder name */
(sb4) name_len, /* placeholder length */
(dvoid *)bind_data, /* in/out data */
value_sz, /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output data */
(ub4 *) 0
)
);
-
+
if (errstatus) {
statement->errcode = php_oci_error(statement->err, errstatus);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
}
-
+
statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(val) + 1);
/* XXX is this right? */
ZVAL_STRINGL(val, NULL, Z_STRLEN(val) + 1);
-#endif
+#endif
/* XXX we assume that zend-zval len has 4 bytes */
*alenpp = (ub4*) &Z_STRLEN_P(val);
if (need_data && !statement->has_data) {
return NULL;
}
-
+
if (Z_TYPE_P(column_index) == IS_STRING) {
column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), (int) Z_STRLEN_P(column_index));
if (!column) {
{
ub2 statement_type;
sword errstatus;
-
+
*type = 0;
-
+
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
if (errstatus != OCI_SUCCESS) {
{
ub4 statement_numrows;
sword errstatus;
-
+
*numrows = 0;
-
+
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err));
if (errstatus != OCI_SUCCESS) {
php_error_docref(NULL, E_WARNING, "Invalid max length value (" ZEND_LONG_FMT ")", maxlength);
return 1;
}
-
+
switch(type) {
case SQLT_NUM:
case SQLT_INT:
case SQLT_FLT:
bind = php_oci_bind_array_helper_double(val, max_table_length);
break;
-
+
case SQLT_AFC:
case SQLT_CHR:
case SQLT_VCS:
/* failed to generate bind struct */
return 1;
}
-
+
bind->descriptor = NULL;
bind->statement = NULL;
bind->parent_statement = statement;
(ub4) OCI_DEFAULT
)
);
-
-
+
+
if (errstatus != OCI_SUCCESS) {
if (bind->array.elements) {
efree(bind->array.elements);
zend_hash_move_forward(hash);
}
}
-
+
bind = emalloc(sizeof(php_oci_bind));
ZVAL_UNDEF(&bind->val);
bind->array.elements = (text *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(text), 0);
memset(bind->array.element_lengths, 0, max_table_length*sizeof(ub2));
bind->array.indicators = safe_emalloc(max_table_length, sizeof(sb2), 0);
memset(bind->array.indicators, 0, max_table_length*sizeof(sb2));
-
+
zend_hash_internal_pointer_reset(hash);
-
+
for (i = 0; i < bind->array.current_length; i++) {
if ((entry = zend_hash_get_current_data(hash)) != NULL) {
convert_to_string_ex(entry);
for (i = 0; i < max_table_length; i++) {
if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
int element_length;
-
+
convert_to_string_ex(entry);
element_length = ((size_t) maxlength > Z_STRLEN_P(entry)) ? (int) Z_STRLEN_P(entry) : (int) maxlength;
-
+
memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_P(entry), element_length);
((text *)bind->array.elements)[i*maxlength + element_length] = '\0';
-
+
zend_hash_move_forward(hash);
} else {
((text *)bind->array.elements)[i*maxlength] = '\0';
bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
bind->array.indicators = NULL;
-
+
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
if (i < bind->array.current_length) {
bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
bind->array.indicators = NULL;
-
+
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
if (i < bind->array.current_length) {
bind->array.element_lengths[i] = sizeof(OCIDate);
}
if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
-
+
convert_to_string_ex(entry);
PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_P(entry), (ub4) Z_STRLEN_P(entry), NULL, 0, NULL, 0, &oci_date));
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return NULL;
}
-
+
((OCIDate *)bind->array.elements)[i] = oci_date;
zend_hash_move_forward(hash);
} else {
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return NULL;
}
-
+
((OCIDate *)bind->array.elements)[i] = oci_date;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_execute(): ORA-01403: %s
ORA-06512: at "%s.ARRAY_BIND_003_PKG", line %d
ORA-06512: at line %d in %sarray_bind_003.php on line %d
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_execute(): ORA-01403: %s
ORA-06512: at "%s.ARRAY_BIND_004_PKG", line %d
ORA-06512: at line %d in %sarray_bind_004.php on line %d
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(0) ""
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(4) "five"
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_execute(): ORA-06550: line %d, column %d:
PLS-00418: %s
ORA-06550: %s
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)
Done
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d
array(5) {
[0]=>
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name(): Invalid max length value (-10) in %s on line %d
array(0) {
}
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d
NULL
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
int(5)
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(9) "05-NOV-05"
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(9) "05-NOV-05"
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
float(5.9999)
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
float(5.9999)
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
int(5)
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
int(5)
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(4) "five"
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(4) "five"
"insert into bind_char_tab values (2, NULL, 'abc')",
"insert into bind_char_tab values (3, NULL, 'abc ')"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$stmtarray = array(
"drop table bind_char_tab"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"insert into bind_char_tab values (2, NULL, 'abc')",
"insert into bind_char_tab values (3, NULL, 'abc ')"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$stmtarray = array(
"drop table bind_char_tab"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"create table bind_char_tab (id number, c1 date)",
"insert into bind_char_tab values (1, '2008-04-20')",
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$stmtarray = array(
"drop table bind_char_tab"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"create table bind_char_tab (id number, c1 date)",
"insert into bind_char_tab values (1, '2008-04-20')",
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$stmtarray = array(
"drop table bind_char_tab"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
$stmtarray = array(
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$stmtarray = array(
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$stmtarray = array(
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Run Test
<?php
require(dirname(__FILE__).'/connect.inc');
-
+
$stmtarray = array(
"drop sequence myseq",
"drop table mytab",
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
<?php
require dirname(__FILE__).'/connect.inc';
-
+
$stmtarray = array(
"drop sequence myseq",
"drop table mytab",
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
<?php
require dirname(__FILE__).'/connect.inc';
-
+
$stmtarray = array(
"drop sequence myseq",
"drop table mytab",
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
<?php
require dirname(__FILE__).'/connect.inc';
-
+
$create_st = array();
$create_st[] = "drop sequence myseq";
$create_st[] = "drop table mytab";
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
int(1)
int(2)
int(3)
<?php
require dirname(__FILE__).'/connect.inc';
-
+
$create_st = array();
$create_st[] = "drop sequence myseq";
$create_st[] = "drop table mytab";
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
<?php
require dirname(__FILE__).'/connect.inc';
-
+
$create_st = array();
$create_st[] = "drop sequence myseq";
$create_st[] = "drop table mytab";
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
<?php
require(dirname(__FILE__).'/connect.inc');
-
+
// Initialize
$stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
// Run test
-
+
$collection = oci_new_collection($c, "BUG32325_T");
$sql = "begin
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
int(4)
float(2)
float(3)
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
array(1) {
["NC"]=>
object(OCI-Lob)#%d (1) {
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
function f($conn)
oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB);
$clob->writetemporary("<MYTAG/>", OCI_TEMP_CLOB);
$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
-oci_free_statement($stmt);
+oci_free_statement($stmt);
$clob->close();
// Query back the change
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(1) "A"
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
NULL
int(0)
Done
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
array(5) {
[0]=>
string(3) "one"
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
(113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
function fillxmltab($c)
{
for ($id = 1; $id <= 100; $id++) {
-
- // create an XML element string with random data
+
+ // create an XML element string with random data
$s = "<data>";
for ($j = 0; $j < 128; $j++) {
- $s .= rand();
+ $s .= rand();
}
- $s .= "</data>\n";
+ $s .= "</data>\n";
for ($j = 0; $j < 4; $j++) {
$s .= $s;
- }
+ }
$data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
-
+
// insert XML data into database
-
+
$stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
oci_bind_by_name($stmt, ":id", $id);
$clob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
$clob->writetemporary($data);
oci_execute($stmt);
-
+
$clob->close();
$clob->free();
}
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
Test 1
array(5) {
[0]=>
<?php
require(dirname(__FILE__).'/connect.inc');
-
+
// Initialize
$stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
// Run test
-
+
$sql = "select col1,col2,col3,col4,col5,col6,col7,col8,col9 from bug71600_tab";
echo "Test 1\n";
?>
===DONE===
<?php exit(0); ?>
---EXPECT--
+--EXPECT--
Test 1
Executing SELECT statament...
Fetching data by columns...
oci_close($c);
oci_connect($user, $password, $dbase);
-
+
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
Done
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
@OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
-
+
$statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
require(dirname(__FILE__).'/drop_table.inc');
-
+
echo "Done\n";
?>
--EXPECT--
require dirname(__FILE__).'/drop_table.inc';
-
+
echo "Done\n";
?>
--EXPECT--
oci_set_module_name($c1,$val);
oci_set_client_identifier($c1,$val);
oci_set_client_info($c1,$val);
- $r = oci_set_action($c1,$val);
+ $r = oci_set_action($c1,$val);
if ($r) {
echo "Values set successfully to $val\n";
foreach($attr_array as $attr) {
else {
var_dump(oci_connect($user, $password));
}
-
+
echo "Done\n";
?>
else {
var_dump(ocilogon($user, $password));
}
-
+
echo "Done\n";
?>
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
-
+
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
resource(%d) of type (oci8 connection)
resource(%d) of type (oci8 connection)
else {
var_dump(oci_connect($user, $password));
}
-
+
?>
===DONE===
<?php exit(0); ?>
else {
var_dump(oci_connect($user, $password));
}
-
+
?>
===DONE===
<?php exit(0); ?>
else {
var_dump(ocilogon($user, $password));
}
-
+
?>
===DONE===
<?php exit(0); ?>
else {
var_dump(ocilogon($user, $password));
}
-
+
?>
===DONE===
<?php exit(0); ?>
else {
oci_connect($user, $password);
}
-
+
oci_internal_debug(false);
?>
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECT--
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECT--
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECT--
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECT--
"drop table phptestrawtable",
"create table phptestrawtable( id number(10), fileimage raw(1000))"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
"drop table phpdefblobtable",
"create table phpdefblobtable (id number(10), fileimage blob)"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
// Load data
$stmtarray = array(
"drop table phpdefblobtable"
);
-
+
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
array(1) {
["BLOB"]=>
object(OCI-Lob)#%d (1) {
if ($c1) {
get_edit_attr($c1);
oci_close($c1);
- }
+ }
}
echo "\n\n**Test 1.5 - Negative case with an invalid string value. *********\n";
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_execute(): ORA-00942: %s in %s on line %d
bool(false)
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: oci_execute(): Invalid execute mode given: -1 in %s on line %d
Done
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECT--
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECTF--
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECT--
var_dump($all);
require dirname(__FILE__).'/drop_table.inc';
-
+
echo "Done\n";
?>
--EXPECT--
}
require dirname(__FILE__).'/drop_table.inc';
-
+
echo "Done\n";
?>
--EXPECT--
var_dump($all);
require dirname(__FILE__).'/drop_table.inc';
-
+
echo "Done\n";
?>
--EXPECT--
var_dump($all);
require dirname(__FILE__).'/drop_table.inc';
-
+
echo "Done\n";
?>
--EXPECTF--
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
$drop = "DROP table lob_test";
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
$c = oci_pconnect($user, $password, $dbase);
?>
--FILE--
<?php
-
+
require(dirname(__FILE__).'/connect.inc');
// Initialization
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
$drop = "DROP table lob_test";
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
$row = oci_fetch_array($s);
var_dump($row['BLOB']->load());
var_dump($row['BLOB']->truncate(($i-1)*10));
-
+
oci_commit($c);
}
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
var_dump($blob->saveFile("does_not_exist"));
require(dirname(__FILE__).'/drop_table.inc');
-
+
echo "Done\n";
-
+
?>
--EXPECTF--
object(OCI-Lob)#%d (1) {
?>
--FILE--
<?php
-
+
require(dirname(__FILE__).'/connect.inc');
// Initialization
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
$blob = oci_new_descriptor($c,OCI_D_LOB);
?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
$blob = oci_new_descriptor($c,OCI_D_LOB);
memory_limit=10M
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Fatal error: Allowed memory size of 10485760 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
-
+
require dirname(__FILE__)."/connect.inc";
var_dump(oci_pconnect($user, $password, $dbase));
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
resource(%d) of type (oci8 persistent connection)
resource(%d) of type (oci8 persistent connection)
resource(%d) of type (oci8 persistent connection)
);
oci8_test_sql_execute($c, $stmtarray);
-
+
echo "Done\n";
?>
--EXPECT--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
-
+
require dirname(__FILE__)."/connect.inc";
oci_connect("", "", "", false, OCI_SYSOPER);
oci8.privileged_connect=1
--FILE--
<?php
-
+
require dirname(__FILE__)."/connect.inc";
oci_connect("", "", "", false, OCI_SYSOPER);
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
array(2) {
[0]=>
NULL
else {
var_dump($c = oci_connect($user, $password));
}
-
+
$v = oci_server_version($c);
var_dump(str_replace("\n", "", $v));
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
array(2) {
[0]=>
string(1) "4"
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
-
+
require dirname(__FILE__)."/connect.inc";
$stmt = oci_parse($c, "select 1 from dual");
echo "Done\n";
?>
---EXPECT--
+--EXPECT--
Done