Lines Matching refs:statement
52 php_oci_statement *statement; in php_oci_statement_create() local
57 statement = ecalloc(1,sizeof(php_oci_statement)); in php_oci_statement_create()
61 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NU… in php_oci_statement_create()
64 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NU… in php_oci_statement_create()
70 &(statement->stmt), in php_oci_statement_create()
82 DTRACE_OCI8_SQLTEXT(connection, connection->client_id, statement, query); in php_oci_statement_create()
89 PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); in php_oci_statement_create()
90 PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_create()
92 efree(statement); in php_oci_statement_create()
98 statement->last_query = ecalloc(1, query_len + 1); in php_oci_statement_create()
99 memcpy(statement->last_query, query, query_len); in php_oci_statement_create()
100 statement->last_query_len = query_len; in php_oci_statement_create()
103 statement->last_query = NULL; in php_oci_statement_create()
104 statement->last_query_len = 0; in php_oci_statement_create()
107 statement->connection = connection; in php_oci_statement_create()
108 statement->has_data = 0; in php_oci_statement_create()
109 statement->has_descr = 0; in php_oci_statement_create()
110 statement->parent_stmtid = 0; in php_oci_statement_create()
111 statement->impres_child_stmt = NULL; in php_oci_statement_create()
112 statement->impres_count = 0; in php_oci_statement_create()
113 …statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set child… in php_oci_statement_create()
114 GC_ADDREF(statement->connection->id); in php_oci_statement_create()
117 php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch)); in php_oci_statement_create()
119 php_oci_statement_set_prefetch(statement, (ub4)100); /* semi-arbitrary, "sensible default" */ in php_oci_statement_create()
122 PHP_OCI_REGISTER_RESOURCE(statement, le_statement); in php_oci_statement_create()
126 return statement; in php_oci_statement_create()
132 php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement) in php_oci_get_implicit_resultset() argument
143 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &r… in php_oci_get_implicit_resultset()
155 …PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_… in php_oci_get_implicit_resultset()
157 statement2->parent_stmtid = statement->id; in php_oci_get_implicit_resultset()
161 statement2->connection = statement->connection; in php_oci_get_implicit_resultset()
174 GC_ADDREF(statement->id); in php_oci_get_implicit_resultset()
177 php_oci_statement_set_prefetch(statement2, statement->prefetch_count); in php_oci_get_implicit_resultset()
191 int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch ) in php_oci_statement_set_prefetch() argument
199 …CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFET… in php_oci_statement_set_prefetch()
202 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_set_prefetch()
203 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_set_prefetch()
204 statement->prefetch_count = 0; in php_oci_statement_set_prefetch()
207 statement->prefetch_count = prefetch; in php_oci_statement_set_prefetch()
208 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_set_prefetch()
249 int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows) in php_oci_statement_fetch() argument
259 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_fetch()
261 if (statement->has_descr && statement->columns) { in php_oci_statement_fetch()
262 zend_hash_apply(statement->columns, php_oci_cleanup_pre_fetch); in php_oci_statement_fetch()
266 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch2, (statement->stmt, statement->err, nrows, OCI_FETCH_N… in php_oci_statement_fetch()
268 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NE… 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()
346 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch2, (statement->stmt, statement->err, nrows, OCI_FETCH_N… in php_oci_statement_fetch()
348 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NE… in php_oci_statement_fetch()
352 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
353 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
362 statement->has_data = 1; in php_oci_statement_fetch()
365 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
366 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
384 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_fetch()
385 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_fetch()
387 statement->has_data = 0; in php_oci_statement_fetch()
395 php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_ind… in php_oci_statement_get_column() argument
400 if (statement->columns == NULL) { /* we release the columns at the end of a fetch */ in php_oci_statement_get_column()
405 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_get_column()
406 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_get_column()
414 if ((column = zend_hash_index_find_ptr(statement->columns, column_index)) == NULL) { in php_oci_statement_get_column()
439 nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL, 0); in php_oci_define_callback()
443 nested_stmt->parent_stmtid = outcol->statement->id; in php_oci_define_callback()
444 GC_ADDREF(outcol->statement->id); in php_oci_define_callback()
471 descr = php_oci_lob_create(outcol->statement->connection, dtype); in php_oci_define_callback()
494 int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) in php_oci_statement_execute() argument
514 …DTRACE_OCI8_EXECUTE_MODE(statement->connection, statement->connection->client_id, statement, mode); in php_oci_statement_execute()
524 if (!statement->stmttype) { in php_oci_statement_execute()
526 …us, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, … in php_oci_statement_execute()
529 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
530 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
533 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
537 if (statement->stmttype == OCI_STMT_SELECT) { in php_oci_statement_execute()
543 if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */ in php_oci_statement_execute()
545 if (statement->binds) { in php_oci_statement_execute()
547 zend_hash_apply_with_argument(statement->binds, php_oci_bind_pre_exec, (void *)&result); in php_oci_statement_execute()
554 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtExecute, (statement->connection->svc, statement->stmt, state… in php_oci_statement_execute()
557 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
558 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
562 if (statement->binds) { in php_oci_statement_execute()
563 zend_hash_apply(statement->binds, php_oci_bind_post_exec); in php_oci_statement_execute()
568 statement->connection->rb_on_disconnect = 0; in php_oci_statement_execute()
569 } else if (statement->stmttype != OCI_STMT_SELECT) { in php_oci_statement_execute()
571 statement->connection->rb_on_disconnect = 1; in php_oci_statement_execute()
580 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
583 if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { in php_oci_statement_execute()
585 statement->executed = 1; in php_oci_statement_execute()
587 ALLOC_HASHTABLE(statement->columns); in php_oci_statement_execute()
588 zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0); in php_oci_statement_execute()
593 …tatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_AT… in php_oci_statement_execute()
596 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
597 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
601 statement->ncolumns = colcount; in php_oci_statement_execute()
606 outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol); in php_oci_statement_execute()
609 …PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->… in php_oci_statement_execute()
612 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
613 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
618 …aram, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); in php_oci_statement_execute()
622 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
623 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
628 …OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); in php_oci_statement_execute()
632 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
633 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
638 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); in php_oci_statement_execute()
642 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
643 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
648 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); in php_oci_statement_execute()
652 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
653 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
661 …id *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); in php_oci_statement_execute()
665 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
666 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
671 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); in php_oci_statement_execute()
675 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
676 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
681 …CI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); in php_oci_statement_execute()
685 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
686 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
695 if (statement->defines) { in php_oci_statement_execute()
696 …if ((outcol->define = zend_hash_str_find_ptr(statement->defines, outcol->name, outcol->name_len)) … in php_oci_statement_execute()
706 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
710 outcol->statement->has_descr = 1; in php_oci_statement_execute()
720 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
724 outcol->statement->has_descr = 1; in php_oci_statement_execute()
786 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
788 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
804 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
806 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
821 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
822 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
837 statement->err, in php_oci_statement_execute()
844 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
845 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
851 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
860 int php_oci_statement_cancel(php_oci_statement *statement) in php_oci_statement_cancel() argument
862 return php_oci_statement_fetch(statement, 0); in php_oci_statement_cancel()
868 void php_oci_statement_free(php_oci_statement *statement) in php_oci_statement_free() argument
870 if (statement->stmt) { in php_oci_statement_free()
871 if (statement->last_query_len) { /* FIXME: magical */ in php_oci_statement_free()
872 …PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_S… in php_oci_statement_free()
873 …} else if (statement->impres_flag != PHP_OCI_IMPRES_IS_CHILD) { /* Oracle doc says don't free Imp… in php_oci_statement_free()
874 PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); in php_oci_statement_free()
876 statement->stmt = NULL; in php_oci_statement_free()
879 if (statement->err) { in php_oci_statement_free()
880 PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_free()
881 statement->err = NULL; in php_oci_statement_free()
884 if (statement->last_query) { in php_oci_statement_free()
885 efree(statement->last_query); in php_oci_statement_free()
888 if (statement->binds) { in php_oci_statement_free()
889 zend_hash_destroy(statement->binds); in php_oci_statement_free()
890 efree(statement->binds); in php_oci_statement_free()
893 if (statement->defines) { in php_oci_statement_free()
894 zend_hash_destroy(statement->defines); in php_oci_statement_free()
895 efree(statement->defines); in php_oci_statement_free()
898 if (statement->columns) { in php_oci_statement_free()
899 zend_hash_destroy(statement->columns); in php_oci_statement_free()
900 efree(statement->columns); in php_oci_statement_free()
903 if (statement->parent_stmtid) { in php_oci_statement_free()
904 zend_list_delete(statement->parent_stmtid); in php_oci_statement_free()
907 zend_list_delete(statement->connection->id); in php_oci_statement_free()
908 efree(statement); in php_oci_statement_free()
1108 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
1252 if (!statement->binds) { in php_oci_bind_by_name()
1253 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_by_name()
1254 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_by_name()
1257 if ((old_bind = zend_hash_str_find_ptr(statement->binds, name, name_len)) != NULL) { in php_oci_bind_by_name()
1267 bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp); in php_oci_bind_by_name()
1282 bindp->statement = oci_stmt; in php_oci_bind_by_name()
1283 bindp->parent_statement = statement; in php_oci_bind_by_name()
1295 statement->stmt, /* statement handle */ in php_oci_bind_by_name()
1297 statement->err, /* error handle */ in php_oci_bind_by_name()
1313 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1314 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1322 statement->err, in php_oci_bind_by_name()
1331 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1332 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1342 statement->err, in php_oci_bind_by_name()
1352 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1353 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1358 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_bind_by_name()
1392 } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) { in php_oci_bind_in_callback()
1407 } else if (phpbind->statement != 0) { in php_oci_bind_in_callback()
1409 *bufpp = phpbind->statement; in php_oci_bind_in_callback()
1452 if (phpbind->statement != NULL) { in php_oci_bind_out_callback()
1453 *bufpp = phpbind->statement; in php_oci_bind_out_callback()
1519 php_oci_statement *statement; in php_oci_statement_get_column_helper() local
1527 …statement = (php_oci_statement *) zend_fetch_resource_ex(z_statement, "oci8 statement", le_stateme… in php_oci_statement_get_column_helper()
1529 if (!statement) { in php_oci_statement_get_column_helper()
1533 if (need_data && !statement->has_data) { in php_oci_statement_get_column_helper()
1538 …column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), (int) Z_STRLEN_P(co… in php_oci_statement_get_column_helper()
1547 column = php_oci_statement_get_column(statement, tmp, NULL, 0); in php_oci_statement_get_column_helper()
1559 int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type) in php_oci_statement_get_type() argument
1566 …atus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI… in php_oci_statement_get_type()
1569 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_get_type()
1570 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_type()
1573 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_get_type()
1582 int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows) in php_oci_statement_get_numrows() argument
1589 …tus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, O… in php_oci_statement_get_numrows()
1592 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_get_numrows()
1593 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_numrows()
1596 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_get_numrows()
1605 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
1646 bind = php_oci_bind_array_helper_date(val, max_table_length, statement->connection); in php_oci_bind_array_by_name()
1660 bind->statement = NULL; in php_oci_bind_array_by_name()
1661 bind->parent_statement = statement; in php_oci_bind_array_by_name()
1671 statement->stmt, in php_oci_bind_array_by_name()
1673 statement->err, in php_oci_bind_array_by_name()
1706 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_array_by_name()
1707 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_array_by_name()
1711 if (!statement->binds) { in php_oci_bind_array_by_name()
1712 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_array_by_name()
1713 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_array_by_name()
1717 zend_hash_update_ptr(statement->binds, zvtmp, bind); in php_oci_bind_array_by_name()
1724 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_bind_array_by_name()