Sean, what version of sqlite are you using?

With the command line version it appears to work under 3.5.9

SQLite version 3.5.9
Enter ".help" for instructions
sqlite> DROP TABLE if exists ae_objects ;
sqlite> CREATE TABLE ae_objects (
   ...>   oid                 INTEGER PRIMARY KEY,
   ...>   name                VARCHAR(64),
   ...>   template_id         INTEGER,
   ...>   template_module_id  INTEGER,
   ...>   pos_x               FLOAT,
   ...>   pos_y               FLOAT,
   ...>   pos_z               FLOAT,
   ...>   facing              FLOAT,
   ...>   sprite_id           INTEGER,
   ...>   sprite_module_id    INTEGER,
   ...>   save_id             VARCHAR(16),
   ...>   save_type           INTEGER );
sqlite>
sqlite> insert into ae_objects values
(40007,1000,1,0,3.43301269412041,12.4330126941204,0.0,0.0,11,0,165,2);
sqlite> select * from ae_objects;
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2
sqlite> select * from ae_objects where save_id = 165;
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2
sqlite> select * from ae_objects where save_id = '165';
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2
sqlite> select * from ae_objects where save_id like '165';
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2
sqlite> SELECT * FROM ae_objects WHERE save_id<166 and save_id>164;
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2
sqlite>



Regards, Noah


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sean Riley
Sent: Friday, July 11, 2008 2:08 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] problem with simple select

Hello, 

I have a strange issue with a seemingly simple query.

The table schema:

CREATE TABLE ae_objects (
  oid                 INTEGER PRIMARY KEY,
  name                VARCHAR(64),
  template_id         INTEGER,
  template_module_id  INTEGER,
  pos_x               FLOAT,
  pos_y               FLOAT,
  pos_z               FLOAT,
  facing              FLOAT,
  sprite_id           INTEGER,
  sprite_module_id    INTEGER,
  save_id             VARCHAR(16),
  save_type           INTEGER );

Sequence of SQL statements executed:
sqlite> select * from ae_objects;
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2
sqlite> select * from ae_objects where save_id = 165;
sqlite> select * from ae_objects where save_id = '165';
sqlite> select * from ae_objects where save_id like '165';
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2
sqlite> SELECT * FROM ae_objects WHERE save_id<166 and save_id>164;
40007|1000|1|0|3.43301269412041|12.4330126941204|0.0|0.0|11|0|165|2

Why does the "save_id = 165" fail to get any rows? I get zero rows when
I attempt to find the row by exact match of the "save_id" column, but
with a "like" or a "greater than 164 and less than 166" I get the one
row I am looking for.

This only seems happens when that particular column is varchar(16). I
have gotten this behavior on windows and linux. Can provide a db file if
that helps.


-------------------
Sean Riley
Lead Programmer, Areae Inc.
"All problems in computer science can be solved by another level of
indirection", Butler Lampson, 1972

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



CONFIDENTIALITY NOTICE: 
This message may contain confidential and/or privileged information. If you are 
not the addressee or authorized to receive this for the addressee, you must not 
use, copy, disclose, or take any action based on this message or any 
information herein. If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message. 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