Lines Matching refs:statement
49 php_oci_statement *statement; in php_oci_statement_create() local
54 statement = ecalloc(1,sizeof(php_oci_statement)); in php_oci_statement_create()
58 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NU… in php_oci_statement_create()
61 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NU… in php_oci_statement_create()
67 &(statement->stmt), in php_oci_statement_create()
79 DTRACE_OCI8_SQLTEXT(connection, connection->client_id, statement, query); in php_oci_statement_create()
86 PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); in php_oci_statement_create()
87 PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_create()
89 efree(statement); in php_oci_statement_create()
95 statement->last_query = ecalloc(1, query_len + 1); in php_oci_statement_create()
96 memcpy(statement->last_query, query, query_len); in php_oci_statement_create()
97 statement->last_query_len = query_len; in php_oci_statement_create()
100 statement->last_query = NULL; in php_oci_statement_create()
101 statement->last_query_len = 0; in php_oci_statement_create()
104 statement->connection = connection; in php_oci_statement_create()
105 statement->has_data = 0; in php_oci_statement_create()
106 statement->has_descr = 0; in php_oci_statement_create()
107 statement->parent_stmtid = 0; in php_oci_statement_create()
108 statement->impres_child_stmt = NULL; in php_oci_statement_create()
109 statement->impres_count = 0; in php_oci_statement_create()
110 …statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set child… in php_oci_statement_create()
111 GC_ADDREF(statement->connection->id); in php_oci_statement_create()
114 php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch)); in php_oci_statement_create()
116 php_oci_statement_set_prefetch(statement, (ub4)100); /* semi-arbitrary, "sensible default" */ in php_oci_statement_create()
120 statement->prefetch_lob_size = (ub4)OCI_G(prefetch_lob_size); in php_oci_statement_create()
122 statement->prefetch_lob_size = 0; in php_oci_statement_create()
125 PHP_OCI_REGISTER_RESOURCE(statement, le_statement); in php_oci_statement_create()
129 return statement; in php_oci_statement_create()
135 php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement) in php_oci_get_implicit_resultset() argument
146 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &r… in php_oci_get_implicit_resultset()
158 …PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_… in php_oci_get_implicit_resultset()
160 statement2->parent_stmtid = statement->id; in php_oci_get_implicit_resultset()
164 statement2->connection = statement->connection; in php_oci_get_implicit_resultset()
177 GC_ADDREF(statement->id); in php_oci_get_implicit_resultset()
180 php_oci_statement_set_prefetch(statement2, statement->prefetch_count); in php_oci_get_implicit_resultset()
181 statement2->prefetch_lob_size = statement->prefetch_lob_size; in php_oci_get_implicit_resultset()
195 int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch) in php_oci_statement_set_prefetch() argument
203 …CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFET… in php_oci_statement_set_prefetch()
206 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_set_prefetch()
207 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_set_prefetch()
208 statement->prefetch_count = 0; in php_oci_statement_set_prefetch()
211 statement->prefetch_count = prefetch; in php_oci_statement_set_prefetch()
212 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_set_prefetch()
253 int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows) in php_oci_statement_fetch() argument
263 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_fetch()
265 if (statement->has_descr && statement->columns) { in php_oci_statement_fetch()
266 zend_hash_apply(statement->columns, php_oci_cleanup_pre_fetch); in php_oci_statement_fetch()
269 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch2, (statement->stmt, statement->err, nrows, OCI_FETCH_N… in php_oci_statement_fetch()
272 if (statement->last_query == NULL) { in php_oci_statement_fetch()
274 if (statement->columns) { in php_oci_statement_fetch()
275 zend_hash_destroy(statement->columns); in php_oci_statement_fetch()
276 efree(statement->columns); in php_oci_statement_fetch()
277 statement->columns = NULL; in php_oci_statement_fetch()
278 statement->ncolumns = 0; in php_oci_statement_fetch()
280 statement->executed = 0; in php_oci_statement_fetch()
283 statement->has_data = 0; in php_oci_statement_fetch()
293 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
294 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
306 statement->stmt, in php_oci_statement_fetch()
307 statement->err, in php_oci_statement_fetch()
318 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
319 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
333 statement->err, in php_oci_statement_fetch()
345 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch2, (statement->stmt, statement->err, nrows, OCI_FETCH_N… in php_oci_statement_fetch()
348 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
349 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
358 statement->has_data = 1; in php_oci_statement_fetch()
361 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
362 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
380 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_fetch()
381 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_fetch()
383 statement->has_data = 0; in php_oci_statement_fetch()
391 php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_ind… in php_oci_statement_get_column() argument
396 if (statement->columns == NULL) { /* we release the columns at the end of a fetch */ in php_oci_statement_get_column()
401 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_get_column()
402 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_get_column()
410 if ((column = zend_hash_index_find_ptr(statement->columns, column_index)) == NULL) { in php_oci_statement_get_column()
435 nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL, 0); in php_oci_define_callback()
439 nested_stmt->parent_stmtid = outcol->statement->id; in php_oci_define_callback()
440 GC_ADDREF(outcol->statement->id); in php_oci_define_callback()
467 descr = php_oci_lob_create(outcol->statement->connection, dtype); in php_oci_define_callback()
490 int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) in php_oci_statement_execute() argument
510 …DTRACE_OCI8_EXECUTE_MODE(statement->connection, statement->connection->client_id, statement, mode); in php_oci_statement_execute()
520 if (!statement->stmttype) { in php_oci_statement_execute()
522 …us, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, … in php_oci_statement_execute()
525 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
526 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
529 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
533 if (statement->stmttype == OCI_STMT_SELECT) { in php_oci_statement_execute()
539 if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */ in php_oci_statement_execute()
541 if (statement->binds) { in php_oci_statement_execute()
543 zend_hash_apply_with_argument(statement->binds, php_oci_bind_pre_exec, (void *)&result); in php_oci_statement_execute()
550 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtExecute, (statement->connection->svc, statement->stmt, state… in php_oci_statement_execute()
553 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
554 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
558 if (statement->binds) { in php_oci_statement_execute()
559 zend_hash_apply(statement->binds, php_oci_bind_post_exec); in php_oci_statement_execute()
564 statement->connection->rb_on_disconnect = 0; in php_oci_statement_execute()
565 } else if (statement->stmttype != OCI_STMT_SELECT) { in php_oci_statement_execute()
567 statement->connection->rb_on_disconnect = 1; in php_oci_statement_execute()
576 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
579 if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { in php_oci_statement_execute()
581 statement->executed = 1; in php_oci_statement_execute()
583 ALLOC_HASHTABLE(statement->columns); in php_oci_statement_execute()
584 zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0); in php_oci_statement_execute()
589 …tatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_AT… in php_oci_statement_execute()
592 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
593 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
597 statement->ncolumns = colcount; in php_oci_statement_execute()
602 outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol); in php_oci_statement_execute()
605 …PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->… in php_oci_statement_execute()
608 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
609 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
614 …aram, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); in php_oci_statement_execute()
618 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
619 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
624 …OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); in php_oci_statement_execute()
628 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
629 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
634 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); in php_oci_statement_execute()
638 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
639 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
644 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); in php_oci_statement_execute()
648 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
649 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
657 …id *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); in php_oci_statement_execute()
661 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
662 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
667 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); in php_oci_statement_execute()
671 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
672 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
677 …CI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); in php_oci_statement_execute()
681 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
682 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
691 if (statement->defines) { in php_oci_statement_execute()
692 …if ((outcol->define = zend_hash_str_find_ptr(statement->defines, outcol->name, outcol->name_len)) … in php_oci_statement_execute()
702 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
706 outcol->statement->has_descr = 1; in php_oci_statement_execute()
716 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
720 outcol->statement->has_descr = 1; in php_oci_statement_execute()
782 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
784 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
799 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
801 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
816 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
817 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
823 …if ((outcol->data_type == SQLT_CLOB || outcol->data_type == SQLT_BLOB) && statement->prefetch_lob_… in php_oci_statement_execute()
826 …tcol->oci_define, OCI_HTYPE_DEFINE, &get_lob_len, 0, OCI_ATTR_LOBPREFETCH_LENGTH, statement->err)); in php_oci_statement_execute()
828 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
829 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
833 …(outcol->oci_define, OCI_HTYPE_DEFINE, &(statement->prefetch_lob_size), 0, OCI_ATTR_LOBPREFETCH_SI… in php_oci_statement_execute()
835 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
836 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
853 statement->err, in php_oci_statement_execute()
860 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
861 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
867 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
876 int php_oci_statement_cancel(php_oci_statement *statement) in php_oci_statement_cancel() argument
878 return php_oci_statement_fetch(statement, 0); in php_oci_statement_cancel()
884 void php_oci_statement_free(php_oci_statement *statement) in php_oci_statement_free() argument
886 if (statement->stmt) { in php_oci_statement_free()
887 if (statement->last_query_len) { /* FIXME: magical */ in php_oci_statement_free()
888 …PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_S… in php_oci_statement_free()
889 …} else if (statement->impres_flag != PHP_OCI_IMPRES_IS_CHILD) { /* Oracle doc says don't free Imp… in php_oci_statement_free()
890 PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); in php_oci_statement_free()
892 statement->stmt = NULL; in php_oci_statement_free()
895 if (statement->err) { in php_oci_statement_free()
896 PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_free()
897 statement->err = NULL; in php_oci_statement_free()
900 if (statement->last_query) { in php_oci_statement_free()
901 efree(statement->last_query); in php_oci_statement_free()
904 if (statement->binds) { in php_oci_statement_free()
905 zend_hash_destroy(statement->binds); in php_oci_statement_free()
906 efree(statement->binds); in php_oci_statement_free()
909 if (statement->defines) { in php_oci_statement_free()
910 zend_hash_destroy(statement->defines); in php_oci_statement_free()
911 efree(statement->defines); in php_oci_statement_free()
914 if (statement->columns) { in php_oci_statement_free()
915 zend_hash_destroy(statement->columns); in php_oci_statement_free()
916 efree(statement->columns); in php_oci_statement_free()
919 if (statement->parent_stmtid) { in php_oci_statement_free()
920 zend_list_delete(statement->parent_stmtid); in php_oci_statement_free()
923 zend_list_delete(statement->connection->id); in php_oci_statement_free()
924 efree(statement); in php_oci_statement_free()
1119 int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_len, zval *var, zend… in php_oci_bind_by_name() argument
1265 if (!statement->binds) { in php_oci_bind_by_name()
1266 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_by_name()
1267 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_by_name()
1270 if ((old_bind = zend_hash_str_find_ptr(statement->binds, name, name_len)) != NULL) { in php_oci_bind_by_name()
1280 bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp); in php_oci_bind_by_name()
1291 bindp->statement = oci_stmt; in php_oci_bind_by_name()
1292 bindp->parent_statement = statement; in php_oci_bind_by_name()
1304 statement->stmt, /* statement handle */ in php_oci_bind_by_name()
1306 statement->err, /* error handle */ in php_oci_bind_by_name()
1322 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1323 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1331 statement->err, in php_oci_bind_by_name()
1340 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1341 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1351 statement->err, in php_oci_bind_by_name()
1361 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1362 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1367 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_bind_by_name()
1401 } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) { in php_oci_bind_in_callback()
1418 } else if (phpbind->statement != 0) { in php_oci_bind_in_callback()
1420 *bufpp = phpbind->statement; in php_oci_bind_in_callback()
1463 if (phpbind->statement != NULL) { in php_oci_bind_out_callback()
1464 *bufpp = phpbind->statement; in php_oci_bind_out_callback()
1526 php_oci_statement *statement; in php_oci_statement_get_column_helper() local
1534 …statement = (php_oci_statement *) zend_fetch_resource_ex(z_statement, "oci8 statement", le_stateme… in php_oci_statement_get_column_helper()
1536 if (!statement) { in php_oci_statement_get_column_helper()
1540 if (need_data && !statement->has_data) { in php_oci_statement_get_column_helper()
1545 …column = php_oci_statement_get_column(statement, -1, ZSTR_VAL(column_index_string), (int) ZSTR_LEN… in php_oci_statement_get_column_helper()
1551 column = php_oci_statement_get_column(statement, column_index_int, NULL, 0); in php_oci_statement_get_column_helper()
1564 int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type) in php_oci_statement_get_type() argument
1571 …atus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI… in php_oci_statement_get_type()
1574 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_get_type()
1575 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_type()
1578 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_get_type()
1587 int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows) in php_oci_statement_get_numrows() argument
1594 …tus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, O… in php_oci_statement_get_numrows()
1597 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_get_numrows()
1598 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_numrows()
1601 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_get_numrows()
1610 int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t name_len, zval *var… in php_oci_bind_array_by_name() argument
1651 bind = php_oci_bind_array_helper_date(val, max_table_length, statement->connection); in php_oci_bind_array_by_name()
1665 bind->statement = NULL; in php_oci_bind_array_by_name()
1666 bind->parent_statement = statement; in php_oci_bind_array_by_name()
1676 statement->stmt, in php_oci_bind_array_by_name()
1678 statement->err, in php_oci_bind_array_by_name()
1711 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_array_by_name()
1712 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_array_by_name()
1716 if (!statement->binds) { in php_oci_bind_array_by_name()
1717 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_array_by_name()
1718 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_array_by_name()
1722 zend_hash_update_ptr(statement->binds, zvtmp, bind); in php_oci_bind_array_by_name()
1725 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_bind_array_by_name()