tony2001                Tue Oct 18 10:52:34 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/sqlite sqlite.c 
  Log:
  backport Ilia's fix for #34884
  
  
http://cvs.php.net/diff.php/php-src/ext/sqlite/sqlite.c?r1=1.146.2.7&r2=1.146.2.8&ty=u
Index: php-src/ext/sqlite/sqlite.c
diff -u php-src/ext/sqlite/sqlite.c:1.146.2.7 
php-src/ext/sqlite/sqlite.c:1.146.2.8
--- php-src/ext/sqlite/sqlite.c:1.146.2.7       Tue Jun  7 11:38:37 2005
+++ php-src/ext/sqlite/sqlite.c Tue Oct 18 10:52:34 2005
@@ -17,7 +17,7 @@
    |          Marcus Boerger <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
 
-   $Id: sqlite.c,v 1.146.2.7 2005/06/07 15:38:37 dmitry Exp $ 
+   $Id: sqlite.c,v 1.146.2.8 2005/10/18 14:52:34 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1076,7 +1076,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "SQLite support", "enabled");
-       php_info_print_table_row(2, "PECL Module version", 
PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.146.2.7 2005/06/07 15:38:37 
dmitry Exp $");
+       php_info_print_table_row(2, "PECL Module version", 
PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.146.2.8 2005/10/18 14:52:34 
tony2001 Exp $");
        php_info_print_table_row(2, "SQLite Library", sqlite_libversion());
        php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding());
        php_info_print_table_end();
@@ -1383,7 +1383,7 @@
 {
        const char **rowdata, **colnames;
        int ret, i, base;
-       char *errtext = NULL, *colname;
+       char *errtext = NULL;
 
 next_row:
        ret = sqlite_step(rres->vm, &rres->ncolumns, &rowdata, &colnames);
@@ -1391,14 +1391,13 @@
                /* first row - lets copy the column names */
                rres->col_names = safe_emalloc(rres->ncolumns, sizeof(char *), 
0);
                for (i = 0; i < rres->ncolumns; i++) {
-                       colname = (char*)colnames[i];
+                       rres->col_names[i] = estrdup((char*)colnames[i]);
 
                        if (SQLITE_G(assoc_case) == 1) {
-                               php_sqlite_strtoupper(colname);
+                               php_sqlite_strtoupper(rres->col_names[i]);
                        } else if (SQLITE_G(assoc_case) == 2) {
-                               php_sqlite_strtolower(colname);
+                               php_sqlite_strtolower(rres->col_names[i]);
                        }
-                       rres->col_names[i] = estrdup(colname);
                }
                if (!rres->buffered) {
                        /* non buffered mode - also fetch memory for on single 
row */
@@ -1627,15 +1626,14 @@
        array_init(return_value);
 
        for (i = 0; i < ncols; i++) {
-               char *colname = (char *)colnames[i];
-
+               char *colname = estrdup((char *)colnames[i]);
                if (SQLITE_G(assoc_case) == 1) {
                        php_sqlite_strtoupper(colname);
                } else if (SQLITE_G(assoc_case) == 2) {
                        php_sqlite_strtolower(colname);
                }
-
                add_assoc_string(return_value, colname, colnames[ncols + i] ? 
(char *)colnames[ncols + i] : "", 1);
+               efree(colname);
        }
 
 done:

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to