"Marian Aldenhoevel"
<[email protected]> wrote in
message news:[email protected]
> I am having a strange problem with a sqlite3 database. See the
> following transcript:
>
>> sqlite3 kdb "select * from kfz where kfznr=48482364;"
>> 48482364|48|0|0C|00|00|0||20|5B93|1746294314|||0|GP-T 1006|0
>
> kfznr is the primary key, so this is to be expected. Now two queries
> as fired from the application code:
>
>> sqlite3 kdb "select * from kfz where CRC32=-797785824;"
>> 48482364|48|0|0C|00|00|0||20|5B93|-797785824|||0|GP-T 1006|0
>> 20209001|20|1|3C|00|32|24999||13|CE42|-797785824|||0|FL-HH 11|1
>> 20209001|20|1|3C|00|32|24999||13|CE42|-797785824|||0|FL-HH 11|1
>
>> kdb "select * from kfz where CRC32=-1509747892;"
>> 48482364|48|0|0C|00|00|0||20|5B93|-1509747892|||0|GP-T 1006|0
>> 20209667|20|1|3C|00|32|202880||99|4FBD|-1509747892|||0|FL-AK 98|1
>> 20209667|20|1|3C|00|32|202880||99|4FBD|-1509747892|||0|FL-AK 98|1
>
> What could cause 48482364 to show up in both results with a different
> value for CRC32?

You have duplicate rows where kfznr value looks the same to a naked eye, 
but is in fact subtly different. One problem I've seen, for example, is 
accidentally including a terminating NUL byte in the field's value:

sqlite3_bind_text(stmt, 1, param, strlen(param) + 1, NULL);

Try this, see if you get any insights:

select length(kfznr), * from kfz where kfznr like '%48482364%';

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to