# SQLite Bug 42589 still not fixed in php 5.3 windows

- Thread: https://externals.io/message/45251
- Original archive: https://news-web.php.net/php.internals/45251
- Started by Oskar Eisemuth on 2009-08-09T19:06:20+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #45251 — Oskar Eisemuth — 2009-08-09T19:06:20+00:00

URL: https://externals.io/message/45251#45251

Hello

The SQLite patch for Bug 42589 getColumnMeta requires 
SQLITE_ENABLE_COLUMN_METADATA,
but on windows builds this doesn't seem to be activated, so this 
functionality is missing. Or is there a specific reason why it isn't 
enabled?

Could the status of the sqlite library features be shown in phpinfo? So 
SQLITE_ENABLE_COLUMN_METADATA would be shown as activated/enabled/disabled?

Best regards
Oskar Eisemuth

---

## #45254 — Oskar Eisemuth — 2009-08-10T09:02:19+00:00

URL: https://externals.io/message/45251#45254 · In reply to: #45251

Hello

Attached is a patch that adds the necessary changes at config.w32 and 
additional support for PDO::ATTR_FETCH_TABLE_NAMES in PDO SQLite.

---
Oskar

---

## #45255 — Pierre Joye — 2009-08-10T09:16:51+00:00

URL: https://externals.io/message/45251#45255 · In reply to: #45254

hi,

Please post a link to the patch in the bug directly so we won't loose
your patch in the ML archive.

By the way, it is better to use the bug tracker to provide feedback,
easier to follow or track them.

Thanks for your effort :)

Cheers,


> Hello
>
> Attached is a patch that adds the necessary changes at config.w32 and
> additional support for PDO::ATTR_FETCH_TABLE_NAMES in PDO SQLite.
>
> ---
> Oskar
>
>
> Index: ext/pdo_sqlite/config.w32
> ===================================================================
> --- ext/pdo_sqlite/config.w32   (revision 286990)
> +++ ext/pdo_sqlite/config.w32   (working copy)
> @@ -4,7 +4,7 @@
>  ARG_WITH("pdo-sqlite", "for pdo_sqlite support", "no");
>
>  if (PHP_PDO_SQLITE != "no") {
> -       EXTENSION("pdo_sqlite", "pdo_sqlite.c sqlite_driver.c
> sqlite_statement.c", null, "/DSQLITE_THREADSAFE=1 /I" +
> configure_module_dirname + "/../sqlite3/libsqlite /I" +
> configure_module_dirname);
> +       EXTENSION("pdo_sqlite", "pdo_sqlite.c sqlite_driver.c
> sqlite_statement.c", null, "/DSQLITE_THREADSAFE=1
> /DSQLITE_ENABLE_COLUMN_METADATA=1 /I" + configure_module_dirname +
> "/../sqlite3/libsqlite /I" + configure_module_dirname);
>
>        ADD_EXTENSION_DEP('pdo_sqlite', 'pdo');
>        // If pdo_sqlite is static, and sqlite3 is also static, then we don't
> add a second copy of the sqlite3 libs
> Index: ext/pdo_sqlite/php_pdo_sqlite_int.h
> ===================================================================
> --- ext/pdo_sqlite/php_pdo_sqlite_int.h (revision 286990)
> +++ ext/pdo_sqlite/php_pdo_sqlite_int.h (working copy)
> @@ -50,6 +50,7 @@
>        sqlite3 *db;
>        pdo_sqlite_error_info einfo;
>        struct pdo_sqlite_func *funcs;
> +       unsigned fetch_table_names:1;
>  } pdo_sqlite_db_handle;
>
>  typedef struct {
> Index: ext/pdo_sqlite/sqlite_driver.c
> ===================================================================
> --- ext/pdo_sqlite/sqlite_driver.c      (revision 286990)
> +++ ext/pdo_sqlite/sqlite_driver.c      (working copy)
> @@ -283,6 +283,11 @@
>                        convert_to_long(val);
>                        sqlite3_busy_timeout(H->db, Z_LVAL_P(val) * 1000);
>                        return 1;
> +#ifdef SQLITE_ENABLE_COLUMN_METADATA
> +               case PDO_ATTR_FETCH_TABLE_NAMES:
> +                       H->fetch_table_names = Z_BVAL_P(val);
> +                       return 1;
> +#endif
>        }
>        return 0;
>  }
> Index: ext/pdo_sqlite/sqlite_statement.c
> ===================================================================
> --- ext/pdo_sqlite/sqlite_statement.c   (revision 286990)
> +++ ext/pdo_sqlite/sqlite_statement.c   (working copy)
> @@ -221,8 +221,20 @@
>                return 0;
>        }
>
> +
> +
> +#ifdef SQLITE_ENABLE_COLUMN_METADATA
> +       if (S->H->fetch_table_names) {
> +               int namelen;
> +               namelen = spprintf(&stmt->columns[colno].name, 0, "%s.%s",
> sqlite3_column_table_name(S->stmt, colno), sqlite3_column_name(S->stmt,
> colno));
> +               stmt->columns[colno].namelen = namelen;
> +       } else {
> +#endif
>        stmt->columns[colno].name = estrdup(sqlite3_column_name(S->stmt,
> colno));
>        stmt->columns[colno].namelen = strlen(stmt->columns[colno].name);
> +#ifdef SQLITE_ENABLE_COLUMN_METADATA
> +       }
> +#endif
>        stmt->columns[colno].maxlen = 0xffffffff;
>        stmt->columns[colno].precision = 0;
>
> Index: ext/sqlite3/config.w32
> ===================================================================
> --- ext/sqlite3/config.w32      (revision 286990)
> +++ ext/sqlite3/config.w32      (working copy)
> @@ -4,7 +4,7 @@
>  ARG_WITH("sqlite3", "SQLite 3 support", "no");
>
>  if (PHP_SQLITE3 != "no") {
> -       ADD_FLAG("CFLAGS_SQLITE3", "/D SQLITE_THREADSAFE=" + (PHP_ZTS ==
> "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_CORE=1 ");
> +       ADD_FLAG("CFLAGS_SQLITE3", "/D SQLITE_THREADSAFE=" + (PHP_ZTS ==
> "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_CORE=1 /D
> DSQLITE_ENABLE_COLUMN_METADATA=1 ");
>        EXTENSION("sqlite3", "sqlite3.c", null, "/I" +
> configure_module_dirname + "/libsqlite /I" + configure_module_dirname);
>
>        ADD_SOURCES(configure_module_dirname + "/libsqlite", "sqlite3.c",
> "sqlite3");
>
> --
> 
> 
>



-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #45257 — Oskar Eisemuth — 2009-08-10T09:48:42+00:00

URL: https://externals.io/message/45251#45257 · In reply to: #45255

Pierre Joye schrieb:
> hi,
>
> Please post a link to the patch in the bug directly so we won't loose
> your patch in the ML archive.
>
> By the way, it is better to use the bug tracker to provide feedback,
> easier to follow or track them.
Well 42589 is closed for comments (someone should add a note there), so 
I added 49206 as feature request now.

Best regards
Oskar Eisemuth
