Enable PDO_ATTR_PREFETCH and default it to 100Kb of prefetch buffer.
-L$PDO_OCI_DIR/lib $PDO_OCI_SHARED_LIBADD
])
-
+ dnl Scrollable cursors?
+ PHP_CHECK_LIBRARY(clntsh, OCIStmtFetch2,
+ [
+ AC_DEFINE(HAVE_OCISTMTFETCH2,1,[ ])
+ ], [], [
+ -L$PDO_OCI_DIR/lib $PDO_OCI_SHARED_LIBADD
+ ])
PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I\$prefix/include/php/ext)
/* probe for some functions not present in older versions */
pdo_oci_inc_dir = FSO.GetFolder(pdo_oci_header);
CHECK_FUNC_IN_HEADER('oci.h', 'OCIEnvCreate', pdo_oci_inc_dir);
+ CHECK_FUNC_IN_HEADER('oci.h', 'OCIStmtFetch2', pdo_oci_inc_dir);
CHECK_FUNC_IN_HEADER('ociap.h', 'OCIEnvNlsCreate', pdo_oci_inc_dir);
} else {
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
{
pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
pdo_oci_stmt *S = ecalloc(1, sizeof(*S));
+ ub4 prefetch;
+
+#if HAVE_OCISTMTFETCH2
+ S->exec_type = pdo_attr_lval(driver_options, PDO_ATTR_SCROLL,
+ 0 TSRMLS_CC) ? OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT;
+#else
+ S->exec_type = OCI_DEFAULT;
+#endif
S->H = H;
+
/* create an OCI statement handle */
OCIHandleAlloc(H->env, (dvoid*)&S->stmt, OCI_HTYPE_STMT, 0, NULL);
efree(S);
return 0;
}
+
+ }
+
+ prefetch = 1024 * pdo_attr_lval(driver_options, PDO_ATTR_PREFETCH, 100 TSRMLS_CC);
+ if (prefetch) {
+ H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0,
+ OCI_ATTR_PREFETCH_MEMORY, H->err);
+ if (!H->last_err) {
+ prefetch /= 1024;
+ H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0,
+ OCI_ATTR_PREFETCH_ROWS, H->err);
+ }
}
stmt->driver_data = S;
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
STMT_CALL(OCIStmtExecute, (S->H->svc, S->stmt, S->err,
S->stmt_type == OCI_STMT_SELECT ? 0 : 1, 0, NULL, NULL,
- (stmt->dbh->auto_commit && !stmt->dbh->in_txn) ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT));
+ (stmt->dbh->auto_commit && !stmt->dbh->in_txn) ? OCI_COMMIT_ON_SUCCESS : S->exec_type));
if (!stmt->executed) {
ub4 colcount;
return 1;
}
-static int oci_stmt_fetch(pdo_stmt_t *stmt TSRMLS_DC)
+static int oci_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori,
+ long offset TSRMLS_DC)
{
+#if HAVE_OCISTMTFETCH2
+ ub4 ociori;
+#endif
pdo_oci_stmt *S = (pdo_oci_stmt*)stmt->driver_data;
+#if HAVE_OCISTMTFETCH2
+ switch (ori) {
+ case PDO_FETCH_ORI_NEXT: ociori = OCI_FETCH_NEXT; break;
+ case PDO_FETCH_ORI_PRIOR: ociori = OCI_FETCH_PRIOR; break;
+ case PDO_FETCH_ORI_FIRST: ociori = OCI_FETCH_FIRST; break;
+ case PDO_FETCH_ORI_LAST: ociori = OCI_FETCH_LAST; break;
+ case PDO_FETCH_ORI_ABS: ociori = OCI_FETCH_ABSOLUTE; break;
+ case PDO_FETCH_ORI_REL: ociori = OCI_FETCH_RELATIVE; break;
+ }
+ S->last_err = OCIStmtFetch2(S->stmt, S->err, 1, ociori, offset, OCI_DEFAULT);
+#else
S->last_err = OCIStmtFetch(S->stmt, S->err, 1, OCI_FETCH_NEXT, OCI_DEFAULT);
+#endif
if (S->last_err == OCI_NO_DATA) {
/* no (more) data */
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
OCIStmt *stmt;
OCIError *err;
sword last_err;
- ub2 stmt_type;
-
+ ub2 stmt_type;
+ ub4 exec_type;
pdo_oci_column *cols;
pdo_oci_error_info einfo;
} pdo_oci_stmt;