]> granicus.if.org Git - php/commitdiff
Eliminate unused parameter.
authorWez Furlong <wez@php.net>
Fri, 21 Jan 2005 00:39:03 +0000 (00:39 +0000)
committerWez Furlong <wez@php.net>
Fri, 21 Jan 2005 00:39:03 +0000 (00:39 +0000)
Don't start a transaction when asking for a cursor with pgsql.
Fix parameter binding for sqlite3

ext/pdo_dblib/dblib_driver.c
ext/pdo_firebird/firebird_driver.c
ext/pdo_mysql/mysql_driver.c
ext/pdo_oci/oci_driver.c
ext/pdo_odbc/odbc_driver.c
ext/pdo_pgsql/pgsql_driver.c
ext/pdo_pgsql/pgsql_statement.c
ext/pdo_sqlite/sqlite_driver.c
ext/pdo_sqlite/sqlite_statement.c

index 9f3c828eb6dcb210ecf4a06a1e03ef204896f240..41b1e00972fc7233039de48d53088ab0ea389a26 100644 (file)
@@ -83,7 +83,7 @@ static int dblib_handle_closer(pdo_dbh_t *dbh TSRMLS_DC)
        return 0;
 }
 
-static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
+static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
 {
        pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
        pdo_dblib_stmt *S = ecalloc(1, sizeof(*S));
index 27335affb57018ab8f0897893308642a65b4cc9b..a9f39c6b32920cefb9009d5cb8abe5c1b058c0e3 100644 (file)
@@ -120,7 +120,7 @@ static int firebird_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
 
 /* called by PDO to prepare an SQL query */
 static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */
-       pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
+       pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
 {
        pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
        pdo_firebird_stmt *S = NULL;
index 5f7b573b7be716042ae9d4647b909da2640958e4..75beed0d5d4566546a298d3913379afaaa0f9177 100755 (executable)
@@ -135,7 +135,7 @@ static int mysql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
-static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
+static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
 {
        pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
        pdo_mysql_stmt *S = ecalloc(1, sizeof(pdo_mysql_stmt));
index 1e17ae7511dc61bf7b245fd30f972b36b415cad0..6531d315538235755cf6d92f084e21f5c5e0472f 100755 (executable)
@@ -191,7 +191,7 @@ static int oci_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
-static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC) /* {{{ */
+static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) /* {{{ */
 {
        pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
        pdo_oci_stmt *S = ecalloc(1, sizeof(*S));
index ced91d6fbbdeced2376e72149752fb859fbd98e1..c54c1a9a36f3c03374bbe80e62f9335470dd1729 100755 (executable)
@@ -107,7 +107,7 @@ static int odbc_handle_closer(pdo_dbh_t *dbh TSRMLS_DC)
        return 0;
 }
 
-static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
+static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
 {
        RETCODE rc;
        pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
index 21c3be737596468f264a9fd98091cbcf99a25344..2b4ec2c20380bfbb0af9688a263d19943568ef21 100644 (file)
@@ -120,7 +120,7 @@ static int pgsql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
-static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
+static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
 {
        pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
        pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt));
@@ -136,16 +136,9 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
                PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL;
 
        if (scrollable) {
-               PGresult *res;
                int ret = 1;
 
                spprintf(&S->cursor_name, 0, "pdo_pgsql_cursor_%08x", stmt);
-
-               res = PQexec(H->server, "BEGIN");
-               if (PQresultStatus(res) != PGRES_COMMAND_OK) {
-                       ret = 0;
-               }
-               PQclear(res);
        }
 
        return ret;
index ce20503f9c5dc5f09de657e2213167d44736c375..fe29c6b797665261a165a667bb2c15f1ea8695d0 100644 (file)
@@ -45,12 +45,12 @@ static int pgsql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
        if (S->cursor_name) {
                pdo_pgsql_db_handle *H = S->H;
                char *q = NULL;
+               PGresult *res;
+
                spprintf(&q, 0, "CLOSE %s", S->cursor_name);
-               PGresult *res = PQexec(H->server, q);
+               res = PQexec(H->server, q);
                efree(q);
                if (res) PQclear(res);
-               res = PQexec(H->server, "COMMIT");
-               if (res) PQclear(res);
                efree(S->cursor_name);
                S->cursor_name = NULL;
        }
index 845acc0856bb3fa0731916eaa09cd8ecd3d87c99..878e0daa554ff6aaf1a0b279bc6d9ab555a7e02f 100644 (file)
@@ -112,7 +112,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
-static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
+static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
 {
        pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data;
        pdo_sqlite_stmt *S = ecalloc(1, sizeof(pdo_sqlite_stmt));
@@ -122,7 +122,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
        S->H = H;
        stmt->driver_data = S;
        stmt->methods = &sqlite_stmt_methods;
-       stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
+       stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL|PDO_PLACEHOLDER_NAMED;
 
        if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) {
                H->einfo.errcode = SQLITE_ERROR;
index 613921b18ab46dc26d62427b8466119ce94f5ea2..71b8959818c4230ef05f7811e645e52a31acef8a 100644 (file)
@@ -101,10 +101,10 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
                                        case PDO_PARAM_STR:
                                        default:
                                                if (param->paramno == -1) {
-                                                       param->paramno = sqlite3_bind_parameter_index(S->stmt, param->name);
+                                                       param->paramno = sqlite3_bind_parameter_index(S->stmt, param->name) - 1;
                                                }
                                                convert_to_string(param->parameter);
-                                               i = sqlite3_bind_text(S->stmt, param->paramno,
+                                               i = sqlite3_bind_text(S->stmt, param->paramno + 1,
                                                        Z_STRVAL_P(param->parameter),
                                                        Z_STRLEN_P(param->parameter),
                                                        SQLITE_STATIC);