Balazs Scheidler writes:
 > when the result is an empty set, it does not return the column headers -
 > unlike other drivers -, and this causes problems with syslog-ng.

I'd probably have to run a few more tests, but this seems to be the
result of some odd behaviour of the sqlite3_get_table() function. This
function adds a header with the column names to the result set, but
still returns the true number of rows and columns as if there was no
extra row. If there are zero rows in the result set (i.e. only the
header), the function appears to always return zero columns as well. In
this case, the driver skips the field type detection as it assumes
there are no columns to check. I'll have to ask the SQLite list if
this holds true.

 > For this it needs to detect whether a table exists, using this simple
 > query:
 > 
 > SELECT * FROM table WHERE 0=1
 > 

libdbi has the dbi_conn_get_table_list(dbi_conn Conn, const char *db,
const char *pattern) function. You should get zero or one [check with
dbi_result_get_numrows(dbi_result Result)] rows with an appropriate
pattern if the table is absent or present, respectively.

If the table exists, would it hurt to create the required columns just
in case?  I reckon all database engines would just do nothing if you
attempt to create an existing column again.

regards,
Markus

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libdbi-drivers-devel mailing list
Libdbi-drivers-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel

Reply via email to