scottmac                Tue Jan 13 02:50:54 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/pdo_sqlite/tests       bug_42589.phpt 

  Modified files:              
    /php-src/ext/sqlite3        config0.m4 
    /php-src/ext/pdo_sqlite     config.m4 sqlite_statement.c 
  Log:
  MFH Add table key to getColumnMeta() with SQLite
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/config0.m4?r1=1.1.2.10&r2=1.1.2.11&diff_format=u
Index: php-src/ext/sqlite3/config0.m4
diff -u php-src/ext/sqlite3/config0.m4:1.1.2.10 
php-src/ext/sqlite3/config0.m4:1.1.2.11
--- php-src/ext/sqlite3/config0.m4:1.1.2.10     Sat Jan 10 01:46:55 2009
+++ php-src/ext/sqlite3/config0.m4      Tue Jan 13 02:50:54 2009
@@ -1,4 +1,4 @@
-dnl $Id: config0.m4,v 1.1.2.10 2009/01/10 01:46:55 scottmac Exp $
+dnl $Id: config0.m4,v 1.1.2.11 2009/01/13 02:50:54 scottmac Exp $
 dnl config.m4 for extension sqlite3
 dnl vim:et:ts=2:sw=2
 
@@ -67,7 +67,7 @@
       debug_flags="-DSQLITE_DEBUG=1"
     fi
 
-    other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1"
+    other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1 
-DSQLITE_ENABLE_COLUMN_METADATA=1"
 
        dnl As long as intl is not shared we can have ICU support
     if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/config.m4?r1=1.26.2.9.2.7.2.7&r2=1.26.2.9.2.7.2.8&diff_format=u
Index: php-src/ext/pdo_sqlite/config.m4
diff -u php-src/ext/pdo_sqlite/config.m4:1.26.2.9.2.7.2.7 
php-src/ext/pdo_sqlite/config.m4:1.26.2.9.2.7.2.8
--- php-src/ext/pdo_sqlite/config.m4:1.26.2.9.2.7.2.7   Mon Jan 12 19:03:07 2009
+++ php-src/ext/pdo_sqlite/config.m4    Tue Jan 13 02:50:54 2009
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.26.2.9.2.7.2.7 2009/01/12 19:03:07 scottmac Exp $
+dnl $Id: config.m4,v 1.26.2.9.2.7.2.8 2009/01/13 02:50:54 scottmac Exp $
 dnl config.m4 for extension pdo_sqlite
 dnl vim:et:sw=2:ts=2:
 
@@ -79,7 +79,12 @@
         threadsafe_flags="-DSQLITE_THREADSAFE=0"
       fi
 
-      other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1"
+      other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1 
-DSQLITE_ENABLE_COLUMN_METADATA=1"
+
+         dnl As long as intl is not shared we can have ICU support
+      if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then
+        other_flags="$other_flags -DSQLITE_ENABLE_ICU=1"
+      fi
 
       if test "$PHP_SQLITE3" != "yes"; then
         PHP_ADD_SOURCES(PHP_EXT_DIR(sqlite3), libsqlite/sqlite3.c)
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.18.2.4.2.3.2.3&r2=1.18.2.4.2.3.2.4&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.3 
php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.4
--- php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.3  Wed Dec 31 
11:15:41 2008
+++ php-src/ext/pdo_sqlite/sqlite_statement.c   Tue Jan 13 02:50:54 2009
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.3 2008/12/31 11:15:41 sebastian 
Exp $ */
+/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.4 2009/01/13 02:50:54 scottmac Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -323,6 +323,13 @@
                add_assoc_string(return_value, "sqlite:decl_type", str, 1);
        }
 
+#ifdef SQLITE_ENABLE_COLUMN_METADATA
+       str = sqlite3_column_table_name(S->stmt, colno);
+       if (str) {
+               add_assoc_string(return_value, "table", str, 1);
+       }
+#endif
+
        add_assoc_zval(return_value, "flags", flags);
 
        return SUCCESS;

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/tests/bug_42589.phpt?view=markup&rev=1.1
Index: php-src/ext/pdo_sqlite/tests/bug_42589.phpt
+++ php-src/ext/pdo_sqlite/tests/bug_42589.phpt
--TEST--
PDO SQLite Feature Request #42589 (getColumnMeta() should also return table 
name)
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) die('skip not 
loaded');
?>
--FILE--
<?php
$db = new PDO("sqlite::memory:");

$db->exec('CREATE TABLE test (field1 VARCHAR(10))');
$db->exec('INSERT INTO test VALUES("test")');

$result = $db->query('SELECT * FROM test t1 LEFT JOIN test t2 ON t1.field1 = 
t2.field1');
$meta1 = $result->getColumnMeta(0);
$meta2 = $result->getColumnMeta(1);

var_dump(!empty($meta1[b'table']) && $meta1[b'table'] == b'test');
var_dump(!empty($meta2[b'table']) && $meta2[b'table'] == b'test');
?>
--EXPECTF--
bool(true)
bool(true)



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

Reply via email to