]> granicus.if.org Git - php/commitdiff
auto-quote values before binding them in at execute time
authorGeorge Schlossnagle <gschlossnagle@php.net>
Tue, 18 May 2004 05:31:01 +0000 (05:31 +0000)
committerGeorge Schlossnagle <gschlossnagle@php.net>
Tue, 18 May 2004 05:31:01 +0000 (05:31 +0000)
ext/pdo/pdo_stmt.c

index 59854227885e59c1a7d96a2cd8dfc4c1d0a8263b..ceb67e67990f17da666e74e3f384ddb2025d15c7 100755 (executable)
@@ -242,6 +242,9 @@ static PHP_METHOD(PDOStatement, execute)
 
                zend_hash_internal_pointer_reset(Z_ARRVAL_P(input_params));
                while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(input_params), (void*)&tmp)) {
+                       char *quotedstr;
+                       int  quotedstrlen;
+                       int refcount;
                        memset(&param, 0, sizeof(param));
 
                        if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(input_params),
@@ -263,9 +266,13 @@ static PHP_METHOD(PDOStatement, execute)
                        }
 
                        param.param_type = PDO_PARAM_STR;
+                       stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &quotedstr, &quotedstrlen TSRMLS_DC);
+                       refcount = (*tmp)->refcount;
+                       zval_dtor(*tmp);
+                       ZVAL_STRINGL(*tmp, quotedstr, quotedstrlen, 0);
+                       (*tmp)->refcount = refcount;
                        param.parameter = *tmp;
 
-
                        if (!really_register_bound_param(&param, stmt, 1 TSRMLS_CC)) {
                                RETURN_FALSE;
                        }