summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-01-21 00:39:03 +0000
committerWez Furlong <wez@php.net>2005-01-21 00:39:03 +0000
commit26f97a911bb931ac911bb1b1735a5f46c4d14777 (patch)
treec986ad716e409ffa72968e583715737729b84276
parentdcd3d84ddb4c0d79437b93cf1cf71d2793749f77 (diff)
downloadphp-git-26f97a911bb931ac911bb1b1735a5f46c4d14777.tar.gz
Eliminate unused parameter.
Don't start a transaction when asking for a cursor with pgsql. Fix parameter binding for sqlite3
-rw-r--r--ext/pdo_dblib/dblib_driver.c2
-rw-r--r--ext/pdo_firebird/firebird_driver.c2
-rwxr-xr-xext/pdo_mysql/mysql_driver.c2
-rwxr-xr-xext/pdo_oci/oci_driver.c2
-rwxr-xr-xext/pdo_odbc/odbc_driver.c2
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c9
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c6
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c4
-rw-r--r--ext/pdo_sqlite/sqlite_statement.c4
9 files changed, 13 insertions, 20 deletions
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index 9f3c828eb6..41b1e00972 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -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));
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index 27335affb5..a9f39c6b32 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@ -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;
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index 5f7b573b7b..75beed0d5d 100755
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -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));
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 1e17ae7511..6531d31553 100755
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -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));
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index ced91d6fbb..c54c1a9a36 100755
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -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;
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 21c3be7375..2b4ec2c203 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -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;
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index ce20503f9c..fe29c6b797 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -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;
}
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 845acc0856..878e0daa55 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -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;
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c
index 613921b18a..71b8959818 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.c
@@ -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);