[sqlite] reusing statements after they were interrupted
I know the docs on sqlite3_reset() say that it will return an error code if the last call to step() on the statement returned an error. My question is...is it still safe to reuse this statement even though reset() returns an error? It appears that on iOS 6.1, if the last call to step() on the statement was interrupted, I can still successfully reuse the statement even though reset() returns an error. Thanks! Jason Boehle jboe...@gmail.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLite crashing on iPhone (or so says Apple)
>>> I have written an application for the iPhone called Grocery iQ that >>> uses SQLite. I don't link to or use the built-in SQLite library on >>> the iPhone. Instead, I compile the SQLite amalgamation into the >>> executable. The SQLite version currently being used in our app is >>> 3.6.7. >> >> I sent instructions to Brian Killen on how you can download the latest >> version of SQLite+CEROD. Perhaps recompiling will help. Are there any particular bug fixes or changes that you know of that might address my problem? I'm all for upgrading the SQLite version, it's just that we will have to do several days of testing to verify it works well, resubmit to Apple, then wait 5+ days to hear from them if it works or not. Although given their tech support response times, we may have all of that done before I ever hear back from them. >>> * before opening the database, the only other SQLite API calls are: >>> sqlite3_config(SQLITE_CONFIG_HEAP, &mSqliteMemory[0], 3145728, >>> 512); // mSqliteMemory is declared as: unsigned char >>> mSqliteMemory[3145728]; >> >> You will probably do better to allocate most of that 3MB to page cache >> using sqlite3_config(SQLITE_CONFIG_PAGECHACHE, ...). The assign 100K >> or so to each database connection's lookaside memory allocator using >> sqlite3_db_config(SQLITE_DBCONFIG_LOOKASIDE, ...) immediately after it >> is opened. With the above, usually a 100K or so is enough heap, >> though more might be required if you are holding many prepared >> statements or if you are using unusually big prepared statements. >> >> Oops. I'm late for meeting. More to follow later tonight. > > > As I was saying > > Use sqlite3_status() to actually measure your memory usage. Make > adjustments once you know how the memory is being used. Don't guess; > measure. Also remember that later versions of SQLite use less memory > for storing prepared statements, so you might want to upgrade if > memory is an issue. Limit your cache sizes using the cache_size > pragma. Make use of sqlite3_soft_heap_limit() if you need to. Or > right a custom pcache implementation that limits the amount of memory > used for the page cache. Thank you for the tips on tuning the memory usage. I will definitely use this advice when working on Grocery iQ 2.0. The way I have it working now though, I shouldn't be experiencing any problems like Apple has reported, right? If SQLite fails any allocations, it should return an error and fail gracefully, correct? -Jason ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] SQLite crashing on iPhone (or so says Apple)
ly other SQLite API calls are: sqlite3_config(SQLITE_CONFIG_HEAP, &mSqliteMemory[0], 3145728, 512); // mSqliteMemory is declared as: unsigned char mSqliteMemory[3145728]; sqlite3_activate_cerod(...); * the reason we limit the heap is because the iPhone has limited resources and we were getting some out of memory errors from other parts of the application on some devices due to the amount of memory that SQLite was using * we set 3 preprocessor defines that affect SQLite compilation: SQLITE_ENABLE_MEMSYS5=1 SQLITE_ENABLE_CEROD=1 SQLITE_ENABLE_FTS3=1 According to the crash logs, the code where the crash is occurring is in the sqlite3ExprCodeTarget function, here is some of the surrounding code: #ifndef SQLITE_OMIT_VIRTUALTABLE if( nExpr>=2 && (pExpr->flags & EP_InfixFunc) ){ pDef = sqlite3VtabOverloadFunction(db, pDef, nExpr, pList->a[1].pExpr); }else if( nExpr>0 ){ pDef = sqlite3VtabOverloadFunction(db, pDef, nExpr, pList->a[0].pExpr); } #endif /* line 57600*/ for(i=0; ia[i].pExpr) ){ constMask |= (1<flags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){ pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr); } } This code is from the SQLite 3.6.7 amalgamation, from the switch statement in sqlite3ExprCodeTarget, for cases TK_CONST_FUNC and TK_FUNCTION. As you can see, the line of code where the crash occurs is not dereferencing or using any pointers, it's only accessing ints on the stack. The stack must've been clobbered? I'm at a loss of what to do. I've asked Apple iPhone Developer technical support for help, but the turnaround time for that is currently 2-3 weeks, which is unacceptable. The Apple app store application review team also has not been of any help to me. Since I cannot reproduce this, and have never seen it in all of our testing, I am inclined to believe the underlying cause of the crash is somehow related to how the app review people test the application. Either their test devices or environment differ from a standard iPod touch or iPhone in a way that I cannot replicate locally. That's just my theory, though. I'd greatly appreciate it if one of you SQLite gurus could take a look and see if I'm doing anything obviously wrong. I can provide more details if necessary. I may also be willing to purchase technical support from the SQLite developers, if needed. Jason Boehle jboe...@gmail.com ja...@freestatelabs.com jboe...@couponsinc.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] is there a way to escape the '-' character in an FTS3 search string?
Is there a way to escape the negatory syntax (the minus sign / dash) in FTS3 MATCH syntax? I found that if I enclose the search term in quotes (ie. "T-Bone"), FTS3 does not treat the minus sign as a exclusion from the search. I was just wondering if there is another way that does not require me to parse the search string into terms and quote the ones that have dashes in them. Jason Boehle [EMAIL PROTECTED] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] FTS query syntax for "starts with"?
Is the an FTS syntax that allows me to find a field (or fields) that start with one of the terms in the search query? Or should I just be doing a LIKE query against the FTS table? Jason Boehle [EMAIL PROTECTED] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] is there a way to escape a '-' in FTS match syntax?
Is there a way to escape the negatory syntax (the minus sign / dash) in FTS MATCH syntax? I found that if I enclose the search term in quotes (ie. "T-Bone"), FTS does not treat the minus sign as a exclusion from the search. I was just wondering if there is another way that does not require me to parse the search string into terms and quote the ones that have dashes in them. Jason Boehle [EMAIL PROTECTED] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users