>I happen to have a code path such that the select statement can return 
>1, 3
>or 5 columns.  I know I could go based on count, but if I could do it by
>name that would be safer.  I had not considered the point that multiple
>columns could have the same name, though, so I fully understand why such a
>function does not exist.

Also beware that the names returned by sqlite3_column_name are in fact 
the aliases used (if any) by the select statement, thus users can foil 
you without bribing anyone nor subverting the engine.

Say you have a table T with (col_A, sigma), you can get the following:

select max(col_A) as sigma, total(sigma) / count(*) as col_A from T;

names returned by sqlite3_column_name will be 'sigma' and 'col_A'.
Gotcha!

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to