From: Wez Furlong Date: Tue, 18 May 2004 08:59:27 +0000 (+0000) Subject: Skeleton for emulated prepare() X-Git-Tag: RELEASE_0_1~159 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9f736ab6e1f16a9d7f883b386cfc557b2a73763;p=php Skeleton for emulated prepare() --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index a47d5edde3..21d40926fe 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -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 */ diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index 047d3cee3d..96f6e914a6 100755 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -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 */