]> granicus.if.org Git - php/commitdiff
Skeleton for emulated prepare()
authorWez Furlong <wez@php.net>
Tue, 18 May 2004 08:59:27 +0000 (08:59 +0000)
committerWez Furlong <wez@php.net>
Tue, 18 May 2004 08:59:27 +0000 (08:59 +0000)
ext/pdo/pdo_stmt.c
ext/pdo/php_pdo_driver.h

index a47d5edde308c98850fca4275a36df3f2a706306..21d40926fea465efe290325cc46009a93b33aff3 100755 (executable)
@@ -283,14 +283,21 @@ static PHP_METHOD(PDOStatement, execute)
                        zend_hash_move_forward(Z_ARRVAL_P(input_params));
                }
        }
-       
-       if (!dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_PRE TSRMLS_CC)) {
+
+       if (stmt->dbh->emulate_prepare) {
+               /* XXX: here we need to:
+                *  - walk stmt->bound_params, quoting each zval value
+                *    (without modifying the zval)
+                *  - substitute these values according to name/position
+                *  - stash that into stmt->query_string
+                *
+                *  When the executer() is called, it will use that query string */
+
+       } else if (!dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_PRE TSRMLS_CC)) {
                RETURN_FALSE;
        }
        
        if (stmt->methods->executer(stmt TSRMLS_CC)) {
-               printf("Execute ok: flag=%d\n", stmt->executed);
-
                if (!stmt->executed) {
                        /* this is the first execute */
 
index 047d3cee3d1da2950cea07aa59cdac928662d58b..96f6e914a68ce8c4907dcde14c6774825062687a 100755 (executable)
@@ -278,6 +278,9 @@ struct _pdo_stmt_t {
 
        /* not always meaningful */
        long row_count;
+
+       /* used only when PDO is emulating prepare for the driver */
+       char *query_string;
 };
 
 /* call this in MINIT to register your PDO driver */