Hi everybody, I've encountered some odd behaviour when using the sqlite3_column_name function. Here's my attempt to build a minimal example.
Part 1: The database. Note that the table is not a 'without rowid' table and has a primary key: $ sqlite3 test.db create table test(id integer primary key, bla integer); insert into test(bla) values(5); .quit Part 2: A C program using the sqlite3_column_name function to determine the column names of the result set of a statement: #include <stdio.h> #include "sqlite3.h" int main() { sqlite3* db; if(sqlite3_open_v2("test.db", &db, SQLITE_OPEN_READONLY, NULL)) return 1; sqlite3_stmt* stmt; int status = sqlite3_prepare_v2(db, "SELECT rowid,* FROM test", -1, &stmt, NULL); if(status == SQLITE_OK) { status = sqlite3_step(stmt); int columns = sqlite3_data_count(stmt); int i; for(i=0;i<columns;i++) printf("column #%d: %s\n", i+1, sqlite3_column_name(stmt, i)); } else { return 2; } sqlite3_finalize(stmt); sqlite3_close(db); return 0; } The output of this program is: column #1: id column #2: id column #3: bla However, I'd have expected the following: column #1: rowid column #2: id column #3: bla I've tested this using the latest version of SQLite, i.e. 3.8.5, and did a (admittedly very quick) search but couldn't find anything. If there's any required information I didn't provide or any sane explanation please let me know :) Cheers Martin _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users