Lines Matching refs:statement

48 	php_oci_statement *statement;  in php_oci_statement_create()  local
50 statement = ecalloc(1,sizeof(php_oci_statement)); in php_oci_statement_create()
54 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NU… in php_oci_statement_create()
57 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NU… in php_oci_statement_create()
63 &(statement->stmt), in php_oci_statement_create()
76 …PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_S… in php_oci_statement_create()
77 PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_create()
79 efree(statement); in php_oci_statement_create()
86 statement->last_query = estrndup(query, query_len); in php_oci_statement_create()
87 statement->last_query_len = query_len; in php_oci_statement_create()
90 statement->last_query = NULL; in php_oci_statement_create()
91 statement->last_query_len = 0; in php_oci_statement_create()
94 statement->connection = connection; in php_oci_statement_create()
95 statement->has_data = 0; in php_oci_statement_create()
96 statement->has_descr = 0; in php_oci_statement_create()
97 statement->parent_stmtid = 0; in php_oci_statement_create()
98 zend_list_addref(statement->connection->rsrc_id); in php_oci_statement_create()
101 php_oci_statement_set_prefetch(statement, OCI_G(default_prefetch) TSRMLS_CC); in php_oci_statement_create()
104 PHP_OCI_REGISTER_RESOURCE(statement, le_statement); in php_oci_statement_create()
108 return statement; in php_oci_statement_create()
114 int php_oci_statement_set_prefetch(php_oci_statement *statement, long size TSRMLS_DC) in php_oci_statement_set_prefetch() argument
123 …PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0… in php_oci_statement_set_prefetch()
125 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_set_prefetch()
126 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_set_prefetch()
127 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_set_prefetch()
171 int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) in php_oci_statement_fetch() argument
181 if (statement->has_descr && statement->columns) { in php_oci_statement_fetch()
182 zend_hash_apply(statement->columns, (apply_func_t) php_oci_cleanup_pre_fetch TSRMLS_CC); in php_oci_statement_fetch()
185 …PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI… in php_oci_statement_fetch()
187 if ( statement->errcode == OCI_NO_DATA || nrows == 0 ) { in php_oci_statement_fetch()
188 if (statement->last_query == NULL) { in php_oci_statement_fetch()
190 if (statement->columns) { in php_oci_statement_fetch()
191 zend_hash_destroy(statement->columns); in php_oci_statement_fetch()
192 efree(statement->columns); in php_oci_statement_fetch()
193 statement->columns = NULL; in php_oci_statement_fetch()
194 statement->ncolumns = 0; in php_oci_statement_fetch()
196 statement->executed = 0; in php_oci_statement_fetch()
199 statement->errcode = 0; /* OCI_NO_DATA is NO error for us!!! */ in php_oci_statement_fetch()
200 statement->has_data = 0; in php_oci_statement_fetch()
210 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
211 column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); in php_oci_statement_fetch()
218 while (statement->errcode == OCI_NEED_DATA) { in php_oci_statement_fetch()
220 PHP_OCI_CALL_RETURN(statement->errcode, in php_oci_statement_fetch()
223 statement->stmt, in php_oci_statement_fetch()
224 statement->err, in php_oci_statement_fetch()
235 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
236 column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); in php_oci_statement_fetch()
250 statement->err, in php_oci_statement_fetch()
262 …PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OC… in php_oci_statement_fetch()
265 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
266 column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); in php_oci_statement_fetch()
274 if (statement->errcode == OCI_SUCCESS_WITH_INFO || statement->errcode == OCI_SUCCESS) { in php_oci_statement_fetch()
275 statement->has_data = 1; in php_oci_statement_fetch()
278 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
279 column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); in php_oci_statement_fetch()
295 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_fetch()
296 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_fetch()
298 statement->has_data = 0; in php_oci_statement_fetch()
306 php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, c… in php_oci_statement_get_column() argument
311 if (statement->columns == NULL) { /* we release the columns at the end of a fetch */ in php_oci_statement_get_column()
316 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_get_column()
317 column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); in php_oci_statement_get_column()
325 if (zend_hash_index_find(statement->columns, column_index, (void **)&column) == FAILURE) { in php_oci_statement_get_column()
351 nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL, 0 TSRMLS_CC); in php_oci_define_callback()
355 nested_stmt->parent_stmtid = outcol->statement->id; in php_oci_define_callback()
356 zend_list_addref(outcol->statement->id); in php_oci_define_callback()
383 descr = php_oci_lob_create(outcol->statement->connection, dtype TSRMLS_CC); in php_oci_define_callback()
406 int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) in php_oci_statement_execute() argument
431 if (!statement->stmttype) { in php_oci_statement_execute()
433 …TURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement-… in php_oci_statement_execute()
435 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
436 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
437 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
442 if (statement->stmttype == OCI_STMT_SELECT) { in php_oci_statement_execute()
448 if (statement->last_query) { in php_oci_statement_execute()
452 if (statement->binds) { in php_oci_statement_execute()
454 …zend_hash_apply_with_argument(statement->binds, (apply_func_arg_t) php_oci_bind_pre_exec, (void *)… in php_oci_statement_execute()
461 …PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->st… in php_oci_statement_execute()
463 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
464 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
465 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
469 if (statement->binds) { in php_oci_statement_execute()
470 zend_hash_apply(statement->binds, (apply_func_t) php_oci_bind_post_exec TSRMLS_CC); in php_oci_statement_execute()
474 statement->connection->needs_commit = 0; in php_oci_statement_execute()
476 statement->connection->needs_commit = 1; in php_oci_statement_execute()
480 if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { in php_oci_statement_execute()
482 statement->executed = 1; in php_oci_statement_execute()
484 ALLOC_HASHTABLE(statement->columns); in php_oci_statement_execute()
485 zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0); in php_oci_statement_execute()
490 …_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colco… in php_oci_statement_execute()
492 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
493 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
494 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
498 statement->ncolumns = colcount; in php_oci_statement_execute()
503 …if (zend_hash_index_update(statement->columns, counter, &column, sizeof(php_oci_out_column), (void… in php_oci_statement_execute()
504 efree(statement->columns); in php_oci_statement_execute()
510 …PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, st… in php_oci_statement_execute()
512 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
513 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
514 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
519 …L_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_… in php_oci_statement_execute()
521 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
523 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
524 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
529 …ETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_… in php_oci_statement_execute()
531 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
533 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
534 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
539 …_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charse… in php_oci_statement_execute()
541 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
543 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
544 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
549 …_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_s… in php_oci_statement_execute()
551 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
553 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
554 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
562 …CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->sc… in php_oci_statement_execute()
564 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
566 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
567 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
572 …_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precis… in php_oci_statement_execute()
574 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
576 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
577 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
582 …ETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *… in php_oci_statement_execute()
584 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
586 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
587 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
595 if (statement->defines) { in php_oci_statement_execute()
596 …if (zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define) == … in php_oci_statement_execute()
606 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
610 outcol->statement->has_descr = 1; in php_oci_statement_execute()
620 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
624 outcol->statement->has_descr = 1; in php_oci_statement_execute()
682 PHP_OCI_CALL_RETURN(statement->errcode, in php_oci_statement_execute()
685 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
687 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
700 PHP_OCI_CALL_RETURN(statement->errcode, in php_oci_statement_execute()
703 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
705 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
719 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_execute()
720 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_execute()
721 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
732 PHP_OCI_CALL_RETURN(statement->errcode, in php_oci_statement_execute()
736 statement->err, in php_oci_statement_execute()
753 int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC) in php_oci_statement_cancel()
756 return php_oci_statement_fetch(statement, 0 TSRMLS_CC); in php_oci_statement_cancel()
762 void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC) in php_oci_statement_free()
764 if (statement->stmt) { in php_oci_statement_free()
765 if (statement->last_query_len) { /* FIXME: magical */ in php_oci_statement_free()
766 …PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_S… in php_oci_statement_free()
768 PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); in php_oci_statement_free()
770 statement->stmt = 0; in php_oci_statement_free()
773 if (statement->err) { in php_oci_statement_free()
774 PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_free()
775 statement->err = 0; in php_oci_statement_free()
778 if (statement->last_query) { in php_oci_statement_free()
779 efree(statement->last_query); in php_oci_statement_free()
782 if (statement->columns) { in php_oci_statement_free()
783 zend_hash_destroy(statement->columns); in php_oci_statement_free()
784 efree(statement->columns); in php_oci_statement_free()
787 if (statement->binds) { in php_oci_statement_free()
788 zend_hash_destroy(statement->binds); in php_oci_statement_free()
789 efree(statement->binds); in php_oci_statement_free()
792 if (statement->defines) { in php_oci_statement_free()
793 zend_hash_destroy(statement->defines); in php_oci_statement_free()
794 efree(statement->defines); in php_oci_statement_free()
797 if (statement->parent_stmtid) { in php_oci_statement_free()
798 zend_list_delete(statement->parent_stmtid); in php_oci_statement_free()
801 zend_list_delete(statement->connection->rsrc_id); in php_oci_statement_free()
802 efree(statement); in php_oci_statement_free()
985 int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long ma… in php_oci_bind_by_name() argument
1098 if (!statement->binds) { in php_oci_bind_by_name()
1099 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_by_name()
1100 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_by_name()
1104 if (zend_hash_find(statement->binds, name, name_len + 1, (void **)&old_bind) == SUCCESS) { in php_oci_bind_by_name()
1110 …zend_hash_update(statement->binds, name, name_len + 1, &bind, sizeof(php_oci_bind), (void **)&bind… in php_oci_bind_by_name()
1114 bindp->statement = oci_stmt; in php_oci_bind_by_name()
1115 bindp->parent_statement = statement; in php_oci_bind_by_name()
1120 PHP_OCI_CALL_RETURN(statement->errcode, in php_oci_bind_by_name()
1123 statement->stmt, /* statement handle */ in php_oci_bind_by_name()
1125 statement->err, /* error handle */ in php_oci_bind_by_name()
1140 if (statement->errcode != OCI_SUCCESS) { in php_oci_bind_by_name()
1141 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_bind_by_name()
1142 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1147 PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic, in php_oci_bind_by_name()
1150 statement->err, in php_oci_bind_by_name()
1158 if (statement->errcode != OCI_SUCCESS) { in php_oci_bind_by_name()
1159 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_bind_by_name()
1160 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1167 PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject, in php_oci_bind_by_name()
1170 statement->err, in php_oci_bind_by_name()
1179 if (statement->errcode) { in php_oci_bind_by_name()
1180 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_bind_by_name()
1181 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1216 } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) { in php_oci_bind_in_callback()
1223 } else if (phpbind->statement != 0) { in php_oci_bind_in_callback()
1225 *bufpp = phpbind->statement; in php_oci_bind_in_callback()
1265 if (phpbind->statement != NULL) { in php_oci_bind_out_callback()
1266 *bufpp = phpbind->statement; in php_oci_bind_out_callback()
1323 php_oci_statement *statement; in php_oci_statement_get_column_helper() local
1330statement = (php_oci_statement *) zend_fetch_resource(&z_statement TSRMLS_CC, -1, "oci8 statement"… in php_oci_statement_get_column_helper()
1332 if (!statement) { in php_oci_statement_get_column_helper()
1336 if (need_data && !statement->has_data) { in php_oci_statement_get_column_helper()
1341 …column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_i… in php_oci_statement_get_column_helper()
1352 column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0 TSRMLS_CC); in php_oci_statement_get_column_helper()
1365 int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC) in php_oci_statement_get_type() argument
1371 …RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statemen… in php_oci_statement_get_type()
1373 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_get_type()
1374 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_get_type()
1375 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_type()
1386 int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC) in php_oci_statement_get_numrows() argument
1392 …ETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement… in php_oci_statement_get_numrows()
1394 if (statement->errcode != OCI_SUCCESS) { in php_oci_statement_get_numrows()
1395 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_statement_get_numrows()
1396 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_numrows()
1407 int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, l… in php_oci_bind_array_by_name() argument
1442 bind = php_oci_bind_array_helper_date(var, max_table_length, statement->connection TSRMLS_CC); in php_oci_bind_array_by_name()
1455 if (!statement->binds) { in php_oci_bind_array_by_name()
1456 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_array_by_name()
1457 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_array_by_name()
1460 …zend_hash_update(statement->binds, name, name_len + 1, bind, sizeof(php_oci_bind), (void **)&bindp… in php_oci_bind_array_by_name()
1463 bindp->statement = NULL; in php_oci_bind_array_by_name()
1464 bindp->parent_statement = statement; in php_oci_bind_array_by_name()
1473 PHP_OCI_CALL_RETURN(statement->errcode, in php_oci_bind_array_by_name()
1476 statement->stmt, in php_oci_bind_array_by_name()
1478 statement->err, in php_oci_bind_array_by_name()
1494 if (statement->errcode != OCI_SUCCESS) { in php_oci_bind_array_by_name()
1496 statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); in php_oci_bind_array_by_name()
1497 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_array_by_name()