Aha! It turns out there was not a trailing space, but a trailing null
character. The save code had a hard-coded size, something like:

sqlite3_bind_text(g_objSaveStmt, 11, 
        saveIdStr.c_str(), 16, SQLITE_STATIC);

So when saveIdStr was less than 16 characters long, it was reading past
the end of the string data when saving the value.

Thanks for the help.


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:sqlite-users-
> [EMAIL PROTECTED] On Behalf Of Noah Hart
> Sent: Friday, July 11, 2008 5:34 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] problem with simple select
> 
> My guess is that there is a trailing space in the record.
> Try the following:
> sqlite> select save_id ||'<' from ae_objects where save_id like 165;
> 165<
> 
> And see where the "sean" save_id field ends.
> 
> Regards, Noah
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Sean Riley
> Sent: Friday, July 11, 2008 5:04 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] problem with simple select
> 
> Thanks for the quick response. My application is using 3.4.1, but I
> grabbed the 3.5.9 executable and got the same thing.
> 
> SQLite version 3.5.9
> Enter ".help" for instructions
> sqlite> select * from ae_objects;
> 20086|sean|1|0|5.43301269412041|4.43301269412041|0.0|0.0|1|0|165|2
> sqlite> select * from ae_objects where save_id=165;
> sqlite> select * from ae_objects where save_id like 165;
> 20086|sean|1|0|5.43301269412041|4.43301269412041|0.0|0.0|1|0|165|2
> 
> So I tried what your code from below and it worked for me in a new
> database. Strange thing though, if I do the insert from your code into
> my existing database, then that new record shows up when I do:
> 
> sqlite> select * from ae_objects where save_id=165;
> 
> But the existing record (the "sean" one) does not!
> 
> 
> 
> 
> 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
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to