Hello,
 
Sorry to keep on harping on about this, but the documentation for the
full_column_names pragma states clearly:
 
"...Normally, such result columns are named
<table-name/alias><column-name> if the SELECT statement joins two or
more tables together, or simply <column-name> if the SELECT statement
queries a single table."
 
This is not the case for the version of SQLite 3.2.1 I am using.   Is
the documentation incorrect, or am I doing anything wrong?
 
The sequence I take is (somewhat simplified):
 

           sqlite3* db;
           int rc = sqlite3_open(":memory:", &db);
         
        
           char* zErrMsg=NULL;
         
           // Location 1
         
           rc = sqlite3_exec(db, "CREATE TABLE TEST1 (id INTEGER, data
VARCHAR2);", 0, 0, &zErrMsg);
           rc = sqlite3_exec(db, "CREATE TABLE TEST2 (id INTEGER, data2
VARCHAR2);", 0, 0, &zErrMsg);
         
           // Then this query is executed (sqlite3_prepare,
sqlite3_step, sqlite3_finalize, ....)
           // SELECT T1.*, T2.* FROM TEST1 T1, TEST2 T2 WHERE T1.id =
T2.id
         
           // Column names are then retrieved used sqilte3_column_count,
sqlite3_column_name
         

Now no column name pragmas have been executed, and yet the column names
are returned as <column-name> despite the fact there is clearly a join
between two tables.
 
Executing either the short_column_names or full_column_names pragmas at
"Location 1" appears to make no difference whatsoever to the returned
names.
 
I have changed my rowset class to accept multiple columns with the same
name, but our legacy code (which used SQLite 2.8.15) has literally
hundreds of queries which depended on the old naming convention.
 
Any more help would be greatly appreciated - especially explaining what
I may have done wrong about the pragma calls.
 
Many thanks in advance,
Steve
   

Reply via email to