Jarl Friis wrote:

> Christian Werner <[EMAIL PROTECTED]> writes:
> 
> > Jarl Friis wrote:
> >
> >> I have fixed a bug in the SQLite ODBC driver. The problem is that the
> >> ODBC driver does not use the info from "PRAGMA table_info(...)" when
> >> there are no columns declared as "integer".
> >
> > What exactly is wrong with the current implementation ? The purpose of
> > the code following the "if (!doautoinc)" expression is the detection
> > of columns with autoincrement behaviour. If I understand the SQLite
> > documentation correct, the only way to create an autoincrement column
> > is "columnname INTEGER PRIMARY KEY AUTOINCREMENT"
> 
> Correct, the thing is that you return from the function if no such
> columns are found. meaning that the code that ensures that correct
> SQL_ types (using "pragma table_info(...)" ) is never reached. meaning
> that a table like CREATE TABLE t1 (c1 TEXT, c2 DOUBLE) will, from the
> ODBC client interface, have two columns with types SQL_VARCHAR. but a
> table like CREATE TABLE t2 (c1 TEXT, c2 DOUBLE, c3 INTEGER) will have
> correct column types: SQL_VARCHAR, SQL_DOUBLE, SQL_INTEGER.
> 
> > (from http://www.sqlite.org/autoinc.html).  Please let me know a)
> > the SQL you used to create an autoinc column which b) is not
> > detected by the current implementation, and c) which SELECTs failed
> > with the current implementation.
> 
> The point is that it fails (wrt. type mapping) when there are NO
> autoinc columns.

Okay, understood, thanks for the explanation. I will investigate
this further.

> >> Further I wonder what's behind the decision to use
> >> PRAGMA short_column_names = off
> >> PRAGMA full_column_names = on
> >>
> >> When using short_column_names instead (which is default),
> >> behaviour seems closer to standard Database SQL engines.
> >>
> >> Could you ellaborate on this decision?
> >
> > To be able to implement SQLColumnAttribute(...SQL_DESC_TABLE_NAME...)
> > efficiently.
> 
> I see, I believe you mean SQLColAttributes(...).
> 
> Wouldn't it be a good idea to limit the sqlite state change to this
> purpose only?

No idea how to achieve this. The table names of the columns are
required. The best solution would be to have some SQLite API
functions to get 1. column name as defined in the CREATE TABLE,
2. column's table name, and 3. column's alias. The current
solution using full_column_names stems from the SQLite 2
driver and was then the most effective way for implementing
SQLColAttribute() and SQLColAttributes().


Regards,
Christian

Reply via email to