Lines Matching refs:statement

50 	php_oci_statement *statement;  in php_oci_statement_create()  local
55 statement = ecalloc(1,sizeof(php_oci_statement)); in php_oci_statement_create()
59 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NU… in php_oci_statement_create()
62 …PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NU… in php_oci_statement_create()
68 &(statement->stmt), in php_oci_statement_create()
80 DTRACE_OCI8_SQLTEXT(connection, connection->client_id, statement, query); in php_oci_statement_create()
87 PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); in php_oci_statement_create()
88 PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_create()
90 efree(statement); in php_oci_statement_create()
96 statement->last_query = ecalloc(1, query_len + 1); in php_oci_statement_create()
97 memcpy(statement->last_query, query, query_len); in php_oci_statement_create()
98 statement->last_query_len = query_len; in php_oci_statement_create()
101 statement->last_query = NULL; in php_oci_statement_create()
102 statement->last_query_len = 0; in php_oci_statement_create()
105 statement->connection = connection; in php_oci_statement_create()
106 statement->has_data = 0; in php_oci_statement_create()
107 statement->has_descr = 0; in php_oci_statement_create()
108 statement->parent_stmtid = 0; in php_oci_statement_create()
109 statement->impres_child_stmt = NULL; in php_oci_statement_create()
110 statement->impres_count = 0; in php_oci_statement_create()
111statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set child… in php_oci_statement_create()
112 GC_ADDREF(statement->connection->id); in php_oci_statement_create()
115 php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch)); in php_oci_statement_create()
117 php_oci_statement_set_prefetch(statement, (ub4)100); /* semi-arbitrary, "sensible default" */ in php_oci_statement_create()
120 PHP_OCI_REGISTER_RESOURCE(statement, le_statement); in php_oci_statement_create()
124 return statement; in php_oci_statement_create()
130 php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement) in php_oci_get_implicit_resultset() argument
141 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &r… in php_oci_get_implicit_resultset()
153 …PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_… in php_oci_get_implicit_resultset()
155 statement2->parent_stmtid = statement->id; in php_oci_get_implicit_resultset()
159 statement2->connection = statement->connection; in php_oci_get_implicit_resultset()
172 GC_ADDREF(statement->id); in php_oci_get_implicit_resultset()
175 php_oci_statement_set_prefetch(statement2, statement->prefetch_count); in php_oci_get_implicit_resultset()
189 int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch ) in php_oci_statement_set_prefetch() argument
197 …CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFET… in php_oci_statement_set_prefetch()
200 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_set_prefetch()
201 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_set_prefetch()
202 statement->prefetch_count = 0; in php_oci_statement_set_prefetch()
205 statement->prefetch_count = prefetch; in php_oci_statement_set_prefetch()
206 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_set_prefetch()
247 int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows) in php_oci_statement_fetch() argument
257 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_fetch()
259 if (statement->has_descr && statement->columns) { in php_oci_statement_fetch()
260 zend_hash_apply(statement->columns, php_oci_cleanup_pre_fetch); in php_oci_statement_fetch()
264 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch2, (statement->stmt, statement->err, nrows, OCI_FETCH_N… in php_oci_statement_fetch()
266 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NE… in php_oci_statement_fetch()
270 if (statement->last_query == NULL) { in php_oci_statement_fetch()
272 if (statement->columns) { in php_oci_statement_fetch()
273 zend_hash_destroy(statement->columns); in php_oci_statement_fetch()
274 efree(statement->columns); in php_oci_statement_fetch()
275 statement->columns = NULL; in php_oci_statement_fetch()
276 statement->ncolumns = 0; in php_oci_statement_fetch()
278 statement->executed = 0; in php_oci_statement_fetch()
281 statement->has_data = 0; in php_oci_statement_fetch()
291 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
292 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
304 statement->stmt, in php_oci_statement_fetch()
305 statement->err, in php_oci_statement_fetch()
316 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
317 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
331 statement->err, in php_oci_statement_fetch()
344 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch2, (statement->stmt, statement->err, nrows, OCI_FETCH_N… in php_oci_statement_fetch()
346 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NE… in php_oci_statement_fetch()
350 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
351 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
360 statement->has_data = 1; in php_oci_statement_fetch()
363 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_fetch()
364 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_fetch()
382 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_fetch()
383 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_fetch()
385 statement->has_data = 0; in php_oci_statement_fetch()
393 php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_ind… in php_oci_statement_get_column() argument
398 if (statement->columns == NULL) { /* we release the columns at the end of a fetch */ in php_oci_statement_get_column()
403 for (i = 0; i < statement->ncolumns; i++) { in php_oci_statement_get_column()
404 column = php_oci_statement_get_column(statement, i + 1, NULL, 0); in php_oci_statement_get_column()
412 if ((column = zend_hash_index_find_ptr(statement->columns, column_index)) == NULL) { in php_oci_statement_get_column()
437 nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL, 0); in php_oci_define_callback()
441 nested_stmt->parent_stmtid = outcol->statement->id; in php_oci_define_callback()
442 GC_ADDREF(outcol->statement->id); in php_oci_define_callback()
469 descr = php_oci_lob_create(outcol->statement->connection, dtype); in php_oci_define_callback()
492 int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) in php_oci_statement_execute() argument
512 …DTRACE_OCI8_EXECUTE_MODE(statement->connection, statement->connection->client_id, statement, mode); in php_oci_statement_execute()
522 if (!statement->stmttype) { in php_oci_statement_execute()
524 …us, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, … in php_oci_statement_execute()
527 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
528 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
531 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
535 if (statement->stmttype == OCI_STMT_SELECT) { in php_oci_statement_execute()
541 if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */ in php_oci_statement_execute()
543 if (statement->binds) { in php_oci_statement_execute()
545 zend_hash_apply_with_argument(statement->binds, php_oci_bind_pre_exec, (void *)&result); in php_oci_statement_execute()
552 …PHP_OCI_CALL_RETURN(errstatus, OCIStmtExecute, (statement->connection->svc, statement->stmt, state… in php_oci_statement_execute()
555 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
556 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
560 if (statement->binds) { in php_oci_statement_execute()
561 zend_hash_apply(statement->binds, php_oci_bind_post_exec); in php_oci_statement_execute()
566 statement->connection->rb_on_disconnect = 0; in php_oci_statement_execute()
567 } else if (statement->stmttype != OCI_STMT_SELECT) { in php_oci_statement_execute()
569 statement->connection->rb_on_disconnect = 1; in php_oci_statement_execute()
578 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
581 if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { in php_oci_statement_execute()
583 statement->executed = 1; in php_oci_statement_execute()
585 ALLOC_HASHTABLE(statement->columns); in php_oci_statement_execute()
586 zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0); in php_oci_statement_execute()
591 …tatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_AT… in php_oci_statement_execute()
594 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
595 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
599 statement->ncolumns = colcount; in php_oci_statement_execute()
604 outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol); in php_oci_statement_execute()
607 …PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->… in php_oci_statement_execute()
610 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
611 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
616 …aram, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); in php_oci_statement_execute()
620 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
621 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
626 …OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); in php_oci_statement_execute()
630 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
631 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
636 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); in php_oci_statement_execute()
640 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
641 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
646 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); in php_oci_statement_execute()
650 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
651 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
659 …id *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); in php_oci_statement_execute()
663 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
664 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
669 …am, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); in php_oci_statement_execute()
673 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
674 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
679 …CI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); in php_oci_statement_execute()
683 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
684 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
693 if (statement->defines) { in php_oci_statement_execute()
694 …if ((outcol->define = zend_hash_str_find_ptr(statement->defines, outcol->name, outcol->name_len)) … in php_oci_statement_execute()
704 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
708 outcol->statement->has_descr = 1; in php_oci_statement_execute()
718 outcol->statement = statement; /* parent handle */ in php_oci_statement_execute()
722 outcol->statement->has_descr = 1; in php_oci_statement_execute()
784 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
786 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
802 statement->stmt, /* IN/OUT handle to the requested SQL query */ in php_oci_statement_execute()
804 statement->err, /* IN/OUT An error handle */ in php_oci_statement_execute()
819 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
820 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
835 statement->err, in php_oci_statement_execute()
842 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_execute()
843 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_execute()
849 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_execute()
858 int php_oci_statement_cancel(php_oci_statement *statement) in php_oci_statement_cancel() argument
860 return php_oci_statement_fetch(statement, 0); in php_oci_statement_cancel()
866 void php_oci_statement_free(php_oci_statement *statement) in php_oci_statement_free() argument
868 if (statement->stmt) { in php_oci_statement_free()
869 if (statement->last_query_len) { /* FIXME: magical */ in php_oci_statement_free()
870 …PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_S… in php_oci_statement_free()
871 …} else if (statement->impres_flag != PHP_OCI_IMPRES_IS_CHILD) { /* Oracle doc says don't free Imp… in php_oci_statement_free()
872 PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); in php_oci_statement_free()
874 statement->stmt = NULL; in php_oci_statement_free()
877 if (statement->err) { in php_oci_statement_free()
878 PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); in php_oci_statement_free()
879 statement->err = NULL; in php_oci_statement_free()
882 if (statement->last_query) { in php_oci_statement_free()
883 efree(statement->last_query); in php_oci_statement_free()
886 if (statement->binds) { in php_oci_statement_free()
887 zend_hash_destroy(statement->binds); in php_oci_statement_free()
888 efree(statement->binds); in php_oci_statement_free()
891 if (statement->defines) { in php_oci_statement_free()
892 zend_hash_destroy(statement->defines); in php_oci_statement_free()
893 efree(statement->defines); in php_oci_statement_free()
896 if (statement->columns) { in php_oci_statement_free()
897 zend_hash_destroy(statement->columns); in php_oci_statement_free()
898 efree(statement->columns); in php_oci_statement_free()
901 if (statement->parent_stmtid) { in php_oci_statement_free()
902 zend_list_delete(statement->parent_stmtid); in php_oci_statement_free()
905 zend_list_delete(statement->connection->id); in php_oci_statement_free()
906 efree(statement); in php_oci_statement_free()
1101 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
1247 if (!statement->binds) { in php_oci_bind_by_name()
1248 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_by_name()
1249 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_by_name()
1252 if ((old_bind = zend_hash_str_find_ptr(statement->binds, name, name_len)) != NULL) { in php_oci_bind_by_name()
1262 bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp); in php_oci_bind_by_name()
1273 bindp->statement = oci_stmt; in php_oci_bind_by_name()
1274 bindp->parent_statement = statement; in php_oci_bind_by_name()
1286 statement->stmt, /* statement handle */ in php_oci_bind_by_name()
1288 statement->err, /* error handle */ in php_oci_bind_by_name()
1304 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1305 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1313 statement->err, 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()
1333 statement->err, in php_oci_bind_by_name()
1343 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_by_name()
1344 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_by_name()
1349 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_bind_by_name()
1383 } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) { in php_oci_bind_in_callback()
1400 } else if (phpbind->statement != 0) { in php_oci_bind_in_callback()
1402 *bufpp = phpbind->statement; in php_oci_bind_in_callback()
1445 if (phpbind->statement != NULL) { in php_oci_bind_out_callback()
1446 *bufpp = phpbind->statement; in php_oci_bind_out_callback()
1514 php_oci_statement *statement; in php_oci_statement_get_column_helper() local
1522statement = (php_oci_statement *) zend_fetch_resource_ex(z_statement, "oci8 statement", le_stateme… in php_oci_statement_get_column_helper()
1524 if (!statement) { in php_oci_statement_get_column_helper()
1528 if (need_data && !statement->has_data) { in php_oci_statement_get_column_helper()
1533 …column = php_oci_statement_get_column(statement, -1, ZSTR_VAL(column_index_string), (int) ZSTR_LEN… in php_oci_statement_get_column_helper()
1539 column = php_oci_statement_get_column(statement, column_index_int, NULL, 0); in php_oci_statement_get_column_helper()
1552 int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type) in php_oci_statement_get_type() argument
1559 …atus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI… in php_oci_statement_get_type()
1562 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_get_type()
1563 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_type()
1566 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_get_type()
1575 int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows) in php_oci_statement_get_numrows() argument
1582 …tus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, O… in php_oci_statement_get_numrows()
1585 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_statement_get_numrows()
1586 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_statement_get_numrows()
1589 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_statement_get_numrows()
1598 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
1639 bind = php_oci_bind_array_helper_date(val, max_table_length, statement->connection); in php_oci_bind_array_by_name()
1653 bind->statement = NULL; in php_oci_bind_array_by_name()
1654 bind->parent_statement = statement; in php_oci_bind_array_by_name()
1664 statement->stmt, in php_oci_bind_array_by_name()
1666 statement->err, in php_oci_bind_array_by_name()
1699 statement->errcode = php_oci_error(statement->err, errstatus); in php_oci_bind_array_by_name()
1700 PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); in php_oci_bind_array_by_name()
1704 if (!statement->binds) { in php_oci_bind_array_by_name()
1705 ALLOC_HASHTABLE(statement->binds); in php_oci_bind_array_by_name()
1706 zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); in php_oci_bind_array_by_name()
1710 zend_hash_update_ptr(statement->binds, zvtmp, bind); in php_oci_bind_array_by_name()
1713 statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ in php_oci_bind_array_by_name()