Of course it does. The good news is that SQLite tends to stick with whatever it 
comes up with first unless there is a significant change to the query.

-----Ursprüngliche Nachricht-----
Von: Tim Streater [mailto:t...@clothears.org.uk]
Gesendet: Freitag, 04. Juli 2014 13:28
An: General Discussion of SQLite Database
Betreff: Re: [sqlite] Bug? sqlite3_column_name returns name of PK for rowid

On 04 Jul 2014 at 11:43, Simon Slavin <slav...@bigfraud.org> wrote:

> On 3 Jul 2014, at 10:22pm, Martin Kleusberg <mkleusb...@gmail.com> wrote:
>
>> I've encountered some odd behaviour when using the
>> sqlite3_column_name function.
>
> Sorry, but column names are guaranteed only if you use an 'AS' clause
> in your SELECT command.  For every other situation, there's no telling
> what you'll get.  For instance
>
> SELECT fred FROM MyTable
>
> may return with a column name of 'fred' or 'main.fred'.
>
> If you're using column names in your programming, always do
>
> SELECT fred AS fred FROM MyTable

Hum. Does this apply using PHP to interface to SQLite as follows:

  $res = $dbh->query ('SELECT fred FROM MyTable');
  $reg = $res->fetchArray (SQLITE3_ASSOC);
  $myvar = $reg['fred'];

I hope not. That's a lot of queries to change.



--
Cheers  --  Tim


-----------------------------------------------------------------------
Gunter Hick
Software Engineer

Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna,
Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then
delete this message from your system. Please do not copy it or use it for any 
purposes, or disclose its contents to any person as to do so could be a breach 
of confidence. Thank you for your cooperation.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to