On Thu, Jun 21, 2012 at 9:15 AM, Dennis Volodomanov <i...@psunrise.com>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
>

Looks like your data is a string:  ' 0'  -  that is a space followed by
ascii '0'.  That is different from a numeric 0, so the second query should
return zero rows.  What does this show:

    SELECT typeof(ColA), quote(ColA) FROM CriticaltemsToProcess;


>
> 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
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users>
>



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

Reply via email to