Gilles Ganault wrote:
> 
> So the options are:
> 1. use the old SQLite2 sqlite_() functions (or some class that turns this 
> into OO)
> 2. PDO to use the SQLite3 linked-in library
> 3. PDO to access the SQLite3 DLL
> 
> ... with 2 being the recommended choice.
> 
With 2 (and probably 3) you will not be able to retrieve metadata (for
example column names) for empty table.
The only way of getting column names in PDO is executing "SELECT * FROM
table" query and then retrieving metadata using columnCount() and
getColumnMeta() methods of PDOStatement object returned by PDO->query()
method. But in case of sqlite: (meaning sqlite3) databases getColumnMeta()
returns nothing if result set is empty. In case sqlite2: driver
getColumnMeta() always throws exception.

So if you will be needing to inspect your tables at runtime then I'm
recommending first solution.

If anyone knows how to get field names of a table from sqlite3 database in
PHP please share your knowledge with the world. :-)
-- 
View this message in context: 
http://www.nabble.com/-Linux-%2B-PHP--Recommended-way-to-access-SQLite--tp14244097p14845206.html
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to