Patch php5-bug64937.patch for PDO Firebird Bug #64937
Patch version 2013-05-30 14:50 UTC
Return to Bug #64937 |
Download this patch
Patch Revisions:
Developer: slavb18@gmail.com
--- ext/pdo_firebird/firebird_driver.c.orig 2013-05-29 06:49:42.000000000 +0400
+++ ext/pdo_firebird/firebird_driver.c 2013-05-30 07:17:11.000000000 +0400
@@ -397,7 +397,7 @@
XSQLDA *out_sqlda, isc_stmt_handle *s, HashTable *named_params TSRMLS_DC)
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
- char *c, *new_sql, in_quote, in_param, pname[64], *ppname;
+ char *c, *new_sql, in_quote, in_param, pname[64], *ppname,in_execute_block;
long l, pindex = -1;
/* Firebird allows SQL statements up to 64k, so bail if it doesn't fit */
@@ -426,10 +426,21 @@
we need to replace :foo by ?, and store the name we just replaced */
new_sql = c = emalloc(sql_len+1);
- for (l = in_quote = in_param = 0; l <= sql_len; ++l) {
+ for (l = in_quote = in_param = in_execute_block=0; l <= sql_len; ++l) {
if ( !(in_quote ^= (sql[l] == '\''))) {
- if (!in_param) {
+ if(in_execute_block) {
+ /* do not search for params in execute block body (Bug #64937) */
+ }
+ else if (!in_param) {
switch (sql[l]) {
+ case 'b':
+ case 'B':
+ /* begin keyword is start of execute block */
+ if ((l>0) && ((sql_len-l) > 5) && (strncasecmp("begin",&sql[l],5)==0)
+ && isspace(sql[l-1]) && isspace(sql[l+5])){
+ in_execute_block=1;
+ }
+ break;
case ':':
in_param = 1;
ppname = pname;
|