[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread ηŽ‹εΊ†εˆš
hi, every one.
 Here is a very strange and interesting problem.
 I used the following SQL to create the table teacher.
 CREATE TABLE techer(poiId INTEGER NOT NULL PRIMARY KEY,
versionId INTEGER NOT NULL,
regionId INTEGER ,
postalCode TEXT ,
phone TEXT ,
attrBitMask INTEGER ,
attributeBlob BLOB)

 and  then I used the following SQL,
 select rowid,*  from teacher.So the strange and interesting problem 
happen.
 the name of the rowid column change to poiId, and the name of the poiId 
become poiId_1. But the two columns have the same values.

 Why the rowid change is column name?
 Is the problem reasonable ?  How do you think about this problem? why?
 I  am looking forward to hearing from you.

 Best regards.
 WQG










[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread Stephan Beal
On Mon, Dec 14, 2015 at 11:47 AM, Stephan Beal 
wrote:

> On Mon, Dec 14, 2015 at 11:21 AM, ??? <2004wqg2008 at 163.com> wrote:
>
>> hi, every one.
>>  Here is a very strange and interesting problem.
>>  I used the following SQL to create the table teacher.
>>  CREATE TABLE techer(poiId INTEGER NOT NULL PRIMARY KEY,...
>
>

> 1) if you do not alias column names using "AS" then the name you get from
>> the db driver is UNDEFINED. It might call all of them "foo" and still be
>> legal. The ONLY way to guaranty the names is to use "AS" to give them an
>> explicit name.
>>
>
>

> 2) i'm guessing that you are using an abstraction layer which is changing
> the returned name of your rowid.
>

i overlooked that you explicitly declared a rowid replacement. That is the
reason for what you are seeing. The link from Quan explains it in more
detail.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf


[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread Stephan Beal
On Mon, Dec 14, 2015 at 11:21 AM, ??? <2004wqg2008 at 163.com> wrote:

> hi, every one.
>  Here is a very strange and interesting problem.
>  I used the following SQL to create the table teacher.
>  CREATE TABLE techer(poiId INTEGER NOT NULL PRIMARY KEY,
> versionId INTEGER NOT NULL,
> regionId INTEGER ,
> postalCode TEXT ,
> phone TEXT ,
> attrBitMask INTEGER ,
> attributeBlob BLOB)
>
>  and  then I used the following SQL,
>  select rowid,*  from teacher.So the strange and interesting
> problem happen.
>  the name of the rowid column change to poiId, and the name of the
> poiId become poiId_1. But the two columns have the same values.
>
>  Why the rowid change is column name?
>  Is the problem reasonable ?  How do you think about this problem? why?
>  I  am looking forward to hearing from you.
>

Two answers come to mind:

1) if you do not alias column names using "AS" then the name you get from
the db driver is UNDEFINED. It might call all of them "foo" and still be
legal. The ONLY way to guaranty the names is to use "AS" to give them an
explicit name.

2) i'm guessing that you are using an abstraction layer which is changing
the returned name of your rowid.


-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf


[sqlite] Very Strange and Interesting Problem

2015-12-14 Thread Simon Slavin

On 14 Dec 2015, at 10:21am, ??? <2004wqg2008 at 163.com> wrote:

> Here is a very strange and interesting problem.

Your problem with renaming is not caused by SQLite.

How are you talking to SQLite ?  Have you written a C program which calls the 
SQLite API ?  Are you using the command line program supplied by the SQLite 
team ?



Are you programming in some other language ?  Are you using a program someone 
else wrote ?

Simon.