scottmac Fri Mar 7 16:58:55 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/pdo_sqlite sqlite_statement.c
Log:
Fixed bug #41135 (When binding as binary data use sqlite3_bind_blob() to stop
errors with null bytes.)
Fixed bug #42443 (Bind integers and booleans as integers rather than strings.)
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.18.2.4.2.3.2.1&r2=1.18.2.4.2.3.2.2&diff_format=u
Index: php-src/ext/pdo_sqlite/sqlite_statement.c
diff -u php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.1
php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.2
--- php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.1 Mon Dec 31
07:17:12 2007
+++ php-src/ext/pdo_sqlite/sqlite_statement.c Fri Mar 7 16:58:55 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.1 2007/12/31 07:17:12 sebastian
Exp $ */
+/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.2 2008/03/07 16:58:55 scottmac Exp
$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -104,6 +104,21 @@
pdo_sqlite_error_stmt(stmt);
return 0;
+ case PDO_PARAM_INT:
+ case PDO_PARAM_BOOL:
+ if (Z_TYPE_P(param->parameter)
== IS_NULL) {
+ if
(sqlite3_bind_null(S->stmt, param->paramno + 1) == SQLITE_OK) {
+ return 1;
+ }
+ } else {
+
convert_to_long(param->parameter);
+ if (SQLITE_OK ==
sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(param->parameter))) {
+ return 1;
+ }
+ }
+ pdo_sqlite_error_stmt(stmt);
+ return 0;
+
case PDO_PARAM_LOB:
if (Z_TYPE_P(param->parameter)
== IS_RESOURCE) {
php_stream *stm;
@@ -117,9 +132,25 @@
pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource"
TSRMLS_CC);
return 0;
}
+ } else if
(Z_TYPE_P(param->parameter) == IS_NULL) {
+ if
(sqlite3_bind_null(S->stmt, param->paramno + 1) == SQLITE_OK) {
+ return 1;
+ }
+
pdo_sqlite_error_stmt(stmt);
+ return 0;
+ } else {
+
convert_to_string(param->parameter);
}
- /* fall through */
-
+
+ if (SQLITE_OK ==
sqlite3_bind_blob(S->stmt, param->paramno + 1,
+
Z_STRVAL_P(param->parameter),
+
Z_STRLEN_P(param->parameter),
+ SQLITE_STATIC))
{
+ return 1;
+ }
+ pdo_sqlite_error_stmt(stmt);
+ return 0;
+
case PDO_PARAM_STR:
default:
if (Z_TYPE_P(param->parameter)
== IS_NULL) {-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
