tony2001 Wed Dec 24 10:01:55 2003 EDT
Modified files:
/php-src/ext/oci8 oci8.c
Log:
separate oci_lob_flush() to use it in oci_lob_append() etc. in the future
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.226 php-src/ext/oci8/oci8.c:1.227
--- php-src/ext/oci8/oci8.c:1.226 Tue Dec 23 11:02:53 2003
+++ php-src/ext/oci8/oci8.c Wed Dec 24 10:01:54 2003
@@ -22,7 +22,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.226 2003/12/23 16:02:53 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.227 2003/12/24 15:01:54 tony2001 Exp $ */
/* TODO list:
*
@@ -234,6 +234,8 @@
static sb4 oci_failover_callback(dvoid *svchp,dvoid* envhp,dvoid *fo_ctx,ub4 fo_type,
ub4 fo_event);
#endif
+static int oci_lob_flush(oci_descriptor*, int);
+
/* }}} */
/* {{{ extension function prototypes */
@@ -770,7 +772,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.226 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.227 $");
sprintf(buf, "%ld", num_persistent);
php_info_print_table_row(2, "Active Persistent Links", buf);
@@ -3185,6 +3187,46 @@
/* }}} */
+/* {{{ oci_lob_flush() */
+static int oci_lob_flush(oci_descriptor* descr, int flush_flag) {
+ OCILobLocator *mylob;
+ oci_connection *connection;
+
+ mylob = (OCILobLocator *) descr->ocidescr;
+
+ if (! mylob) {
+ return 0;
+ }
+
+ /* do not really flush buffer, but reporting success
+ * to suppress OCI error when flushing not used buffer
+ * */
+ if (descr->buffering != 2) {
+ return 1;
+ }
+
+ connection = descr->conn;
+
+ CALL_OCI_RETURN(connection->error, OCILobFlushBuffer(
+ connection->pServiceContext,
+ connection->pError,
+ mylob,
+ flush_flag));
+
+ oci_debug("OCILobFlushBuffer: flush_flag=%d",flush_flag);
+
+ if (connection->error) {
+ oci_error(connection->pError, "OCILobFlushBuffer", connection->error);
+ oci_handle_error(connection, connection->error);
+ return 0;
+ }
+
+ /* marking buffer as enabled and not used */
+ descr->buffering = 1;
+ return 1;
+}
+/* }}} */
+
/* {{{ php_oci_fetch_row() */
static void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int
expected_args)
{
@@ -4315,27 +4357,12 @@
/* buffering wasn't enabled, there is nothing to flush */
RETURN_FALSE;
}
- else if (descr->buffering == 1) {
- /* buffering is enabled, but not used yet
- dunno why, but OCI returns error in this case, so I think
we should suppress it */
- RETURN_TRUE;
- }
-
- CALL_OCI_RETURN(connection->error, OCILobFlushBuffer(
- connection->pServiceContext,
- connection->pError,
- mylob,
- flush_flag));
-
- oci_debug("OCILobFlushBuffer: flush_flag=%d",flush_flag);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobFlushBuffer",
connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
+
+ if (oci_lob_flush(descr,flush_flag) == 1) {
+ RETURN_TRUE;
+ }
+
+ RETURN_FALSE;
}
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "oci_lob_flush() should not be
called like this. Use $somelob->flush() to flush LOB buffer");
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php