Tablenames in sqlite Result

112 Views Asked by At

Hy I wrote an Application with Gambas uning SQLite

When I try to port to another Linux Ditro, I have different keys for the fields in the resultset for the SQLite Result

For example:

sqlect * from table

In on resultset I get

res["Tablename.Column1"] = Value
res["Tablename.Column2"] = Value
res["Tablename.Column3"] = Value

and In onther it is

res["Column1"] = Value
res["Column2"] = Value
res["Column3"] = Value

this is a big problem for me. Any Ideas ?

2

There are 2 best solutions below

1
Thomas Krcal On BEST ANSWER

After a very long journey I found it: I have to call

PRAGMA short_column_names = OFF

Very detailed Information can be found here:

https://www.sqlite.org/pragma.html#pragma_full_column_names

1
CL. On

The documentation says:

The name of a result column is the value of the "AS" clause for that column, if there is an AS clause. If there is no AS clause then the name of the column is unspecified and may change from one release of SQLite to the next.

So the only reliable way of getting consistent result column names is to use AS.