lwe Thu Nov 15 00:10:38 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/pdo_firebird firebird_driver.c firebird_statement.c php_pdo_firebird_int.h Log: - Fixed bug #43296 (Feature req: pdo_firebird: ATTR_FETCH_TABLE_NAMES support) http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_driver.c?r1=1.17.2.2.2.4.2.1&r2=1.17.2.2.2.4.2.2&diff_format=u Index: php-src/ext/pdo_firebird/firebird_driver.c diff -u php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.1 php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.2 --- php-src/ext/pdo_firebird/firebird_driver.c:1.17.2.2.2.4.2.1 Tue Oct 30 16:30:40 2007 +++ php-src/ext/pdo_firebird/firebird_driver.c Thu Nov 15 00:10:38 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.1 2007/10/30 16:30:40 lwe Exp $ */ +/* $Id: firebird_driver.c,v 1.17.2.2.2.4.2.2 2007/11/15 00:10:38 lwe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -493,6 +493,11 @@ } return 1; + case PDO_ATTR_FETCH_TABLE_NAMES: + convert_to_boolean(val); + H->fetch_table_names = Z_BVAL_P(val); + return 1; + case PDO_FB_ATTR_DATE_FORMAT: convert_to_string(val); if (H->date_format) { http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_statement.c?r1=1.18.2.1.2.5.2.4&r2=1.18.2.1.2.5.2.5&diff_format=u Index: php-src/ext/pdo_firebird/firebird_statement.c diff -u php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.4 php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.5 --- php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.4 Wed Nov 14 23:19:29 2007 +++ php-src/ext/pdo_firebird/firebird_statement.c Thu Nov 15 00:10:38 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: firebird_statement.c,v 1.18.2.1.2.5.2.4 2007/11/14 23:19:29 lwe Exp $ */ +/* $Id: firebird_statement.c,v 1.18.2.1.2.5.2.5 2007/11/15 00:10:38 lwe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -162,15 +162,27 @@ pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; struct pdo_column_data *col = &stmt->columns[colno]; XSQLVAR *var = &S->out_sqlda.sqlvar[colno]; + int colname_len; + char *cp; /* allocate storage for the column */ var->sqlind = (void*)emalloc(var->sqllen + 2*sizeof(short)); var->sqldata = &((char*)var->sqlind)[sizeof(short)]; + colname_len = (S->H->fetch_table_names && var->relname_length) + ? (var->aliasname_length + var->relname_length + 1) + : (var->aliasname_length); col->precision = -var->sqlscale; col->maxlen = var->sqllen; - col->namelen = var->aliasname_length; - col->name = estrndup(var->aliasname,var->aliasname_length); + col->namelen = colname_len; + col->name = cp = emalloc(colname_len + 1); + if (colname_len > var->aliasname_length) { + memmove(cp, var->relname, var->relname_length); + cp += var->relname_length; + *cp++ = '.'; + } + memmove(cp, var->aliasname, var->aliasname_length); + *(cp+var->aliasname_length) = '\0'; col->param_type = PDO_PARAM_STR; return 1; http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/php_pdo_firebird_int.h?r1=1.10.2.1.2.1.2.2&r2=1.10.2.1.2.1.2.3&diff_format=u Index: php-src/ext/pdo_firebird/php_pdo_firebird_int.h diff -u php-src/ext/pdo_firebird/php_pdo_firebird_int.h:1.10.2.1.2.1.2.2 php-src/ext/pdo_firebird/php_pdo_firebird_int.h:1.10.2.1.2.1.2.3 --- php-src/ext/pdo_firebird/php_pdo_firebird_int.h:1.10.2.1.2.1.2.2 Wed Nov 14 22:09:21 2007 +++ php-src/ext/pdo_firebird/php_pdo_firebird_int.h Thu Nov 15 00:10:38 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pdo_firebird_int.h,v 1.10.2.1.2.1.2.2 2007/11/14 22:09:21 lwe Exp $ */ +/* $Id: php_pdo_firebird_int.h,v 1.10.2.1.2.1.2.3 2007/11/15 00:10:38 lwe Exp $ */ #ifndef PHP_PDO_FIREBIRD_INT_H #define PHP_PDO_FIREBIRD_INT_H @@ -82,6 +82,11 @@ char *time_format; char *timestamp_format; + /* prepend table names on column names in fetch */ + unsigned fetch_table_names:1; + + unsigned _reserved:31; + } pdo_firebird_db_handle;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php