> Now the problem - the first SQL returns SQLITE_ROW and 1 as
> sqlite3_column_int(), while the second doesn't find any items:
>
> SELECT COUNT(ColA) FROM TableA;
>
> SELECT ColA FROM CriteriaItemsToProcess WHERE ColC=0 LIMIT 1;
>
> The data in the table is like this (that's the only one row):
>
> 1| 12| 0

It looks like you don't have 0 (as integer) in the ColC, but you have
string " 0" instead (note a space at the beginning). And this string "
0" will never be equal to integer 0. Thus your second query doesn't
return rows while first can count them.


Pavel


On Thu, Jun 21, 2012 at 9:15 AM, Dennis Volodomanov <[email protected]> wrote:
> Hello all,
>
> I've been using SQLite for quite a few years, but have just recently started
> exploring WAL mode (may or may not be related to WAL) and I'm experiencing
> an interesting issue that perhaps is known to others, so I've decided to ask
> for your wisdom. This is the amalgamation 3.7.13.
>
> Let's consider the following setup - pragmas used (there's also a bunch of
> indexes, but I believe those shouldn't affect the problem):
>
> "PRAGMA journal_mode = WAL;";
> "PRAGMA synchronous = NORMAL;";
> "PRAGMA page_size = 4096;";
> "PRAGMA read_uncommitted = 1;";
>
> Also, some defines when building:
>
> #define SQLITE_OMIT_DEPRECATED
> #define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 5000
> #define SQLITE_THREADSAFE 2
> #define SQLITE_ENABLE_STAT3
>
> Table:
>
> "CREATE TABLE TableA (ColA INTEGER, ColB INTEGER, ColC INTEGER)";
>
> Now the problem - the first SQL returns SQLITE_ROW and 1 as
> sqlite3_column_int(), while the second doesn't find any items:
>
> SELECT COUNT(ColA) FROM TableA;
>
> SELECT ColA FROM CriteriaItemsToProcess WHERE ColC=0 LIMIT 1;
>
> The data in the table is like this (that's the only one row):
>
> 1| 12| 0
>
> Just as a side note, the same SQL/functions above work 99.9% of the time,
> but bomb out once in a while. Most likely this doesn't help, but thought I'd
> mention it.
>
> I appreciate you reading so far and hopefully you can help me out.
>
> Best regards,
>
>   Dennis
>
> _______________________________________________
> 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