Re: [sqlite] new to sqlite rec'd BadImageFormatException error
I tried several different sqlite.dlls now it works Thanks kp2011 wrote: > > this is the vb net code I was running > > Dim f As New OpenFileDialog > f.Filter = "SQLite 3 (*.db)|*.db|All Files|*.*" > If f.ShowDialog() = DialogResult.OK Then > Dim SQLconnect As New SQLite.SQLiteConnection() > Dim SQLcommand As SQLite.SQLiteCommand > SQLconnect.ConnectionString = "Data Source=" & f.FileName > & ";" > SQLconnect.Open() this line produces the error > > this is the error > An attempt was made to load a program with an incorrect format. (Exception > from HRESULT: 0x8007000B) > BadImageFormatException was unhandled > > do you know what did I do wrong? > Ken > -- View this message in context: http://old.nabble.com/new-to-sqlite-rec%27d-BadImageFormatException-error-tp31544682p31545950.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Out of memory? How could that be on a 32G iPhone?
Hi Hartwig... I'm looking at the FMDB code, and I don't see any "open" for the d/b. Does FMDB do this for me and I'm just missing it? Also looked at Gus Mueller's blog of examples, and I don't see it there either Regards, Rolf On 5/4/11 2:38 PM, skywind mailing lists wrote: > Hi Rolf, > > I am using FMDB and SQLite for more than 2 years now and have not experienced > any problems so far. Therefore, I expect that the bug is somewhere else but > not inside SQLite (3.7.2) nor FMDB (2009-10-18). > > Greetings, > Hartwig > > Am 04.05.2011 um 23:22 schrieb Rolf Marsh: > >> >> Prior to getting this error, I opened the d/b and inserted one (1) very >> small record... >> Where do I start looking? I am using FMDB, ZBarSDK (used to read >> barcodes), but I can't imagine that's using all of my memory... and I >> have the d/b set to be a singleton, as indicated by the NSLog entries... >> >> How do I tell how much active memory I'm using? Where do I start >> looking (I'm a newbie, as you can probably tell by now) :-P >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Out of memory? How could that be on a 32G iPhone?
Hi Rolf, I am using FMDB and SQLite for more than 2 years now and have not experienced any problems so far. Therefore, I expect that the bug is somewhere else but not inside SQLite (3.7.2) nor FMDB (2009-10-18). Greetings, Hartwig Am 04.05.2011 um 23:22 schrieb Rolf Marsh: > > > Prior to getting this error, I opened the d/b and inserted one (1) very > small record... > Where do I start looking? I am using FMDB, ZBarSDK (used to read > barcodes), but I can't imagine that's using all of my memory... and I > have the d/b set to be a singleton, as indicated by the NSLog entries... > > How do I tell how much active memory I'm using? Where do I start > looking (I'm a newbie, as you can probably tell by now) :-P > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Out of memory? How could that be on a 32G iPhone?
Prior to getting this error, I opened the d/b and inserted one (1) very small record... Where do I start looking? I am using FMDB, ZBarSDK (used to read barcodes), but I can't imagine that's using all of my memory... and I have the d/b set to be a singleton, as indicated by the NSLog entries... How do I tell how much active memory I'm using? Where do I start looking (I'm a newbie, as you can probably tell by now) :-P ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] new to sqlite rec'd BadImageFormatException error
Is it possible you're trying to load a 64 bit .dll with a 32 bit .exe? Or visa versa. Joe Mokos Sr. Software Engineer OPNET Technologies, Inc. jmo...@opnet.com (603) 598-2582 x377 -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of kp2011 Sent: Wednesday, May 04, 2011 3:18 PM To: sqlite-users@sqlite.org Subject: [sqlite] new to sqlite rec'd BadImageFormatException error this is the vb net code I was running Dim f As New OpenFileDialog f.Filter = "SQLite 3 (*.db)|*.db|All Files|*.*" If f.ShowDialog() = DialogResult.OK Then Dim SQLconnect As New SQLite.SQLiteConnection() Dim SQLcommand As SQLite.SQLiteCommand SQLconnect.ConnectionString = "Data Source=" & f.FileName & ";" SQLconnect.Open() this line produces the error this is the error An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) BadImageFormatException was unhandled do you know what did I do wrong? Ken -- View this message in context: http://old.nabble.com/new-to-sqlite-rec%27d-BadImageFormatException-error-tp 31544682p31544682.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] new to sqlite rec'd BadImageFormatException error
What platform is set as target for the VB.NET code (x86 / x64 / Any CPU)? Which build of the SQLite library and the ADO.NET provider are you using? On Wed, May 4, 2011 at 9:17 PM, kp2011 wrote: > > this is the vb net code I was running > > Dim f As New OpenFileDialog > f.Filter = "SQLite 3 (*.db)|*.db|All Files|*.*" > If f.ShowDialog() = DialogResult.OK Then > Dim SQLconnect As New SQLite.SQLiteConnection() > Dim SQLcommand As SQLite.SQLiteCommand > SQLconnect.ConnectionString = "Data Source=" & f.FileName & > ";" > SQLconnect.Open() this line produces the error > > this is the error > An attempt was made to load a program with an incorrect format. (Exception > from HRESULT: 0x8007000B) > BadImageFormatException was unhandled > > do you know what did I do wrong? > Ken > -- > View this message in context: > http://old.nabble.com/new-to-sqlite-rec%27d-BadImageFormatException-error-tp31544682p31544682.html > Sent from the SQLite mailing list archive at Nabble.com. > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] new to sqlite rec'd BadImageFormatException error
this is the vb net code I was running Dim f As New OpenFileDialog f.Filter = "SQLite 3 (*.db)|*.db|All Files|*.*" If f.ShowDialog() = DialogResult.OK Then Dim SQLconnect As New SQLite.SQLiteConnection() Dim SQLcommand As SQLite.SQLiteCommand SQLconnect.ConnectionString = "Data Source=" & f.FileName & ";" SQLconnect.Open() this line produces the error this is the error An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) BadImageFormatException was unhandled do you know what did I do wrong? Ken -- View this message in context: http://old.nabble.com/new-to-sqlite-rec%27d-BadImageFormatException-error-tp31544682p31544682.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Page Size with NAND FLASH
On Tue, May 3, 2011 at 4:44 PM, Sugathan, Rupesh wrote: > I am planning to use sqlite on a Linux system with JFFS2 file system on > NAND flash. NAND device that I am using has page size of 2048 bytes and > a erase sector size of 128K. I would like to take advantage of sqlite > rollback for the safety of my database files during power-fail. > > As per http://www.sqlite.org/pragma.html#pragma_page_size, the PAGE_SIZE > should be set between 512 bytes and 64K. The page size of NAND devices, > in my understanding, is only good for 2 to 3 writes before needing to > erase the whole sector. This indicate that the PAGE_SIZE in this case > should be set to 128K (the erase size). Given that this is not a > possibility, how is the power-fail safety achieved in sqlite used on > large sectored flash devices? I do not have specific experience to share, but I think your reasoning is wrong. If you set the SQLite page size to 128kb, then any time SQLite needs to write anything, it's going to write an entire erase sector. Even if SQLite is just updating a tiny piece of data in the middle of a page. That seems like the worst thing you could do. You probably rather want your PAGE_SIZE set to the size which minimizes the amount of overall data written for your workload, keeping in mind that smaller pages mean more overhead in SQLite and the filesystem (so it's not a straight linear function). I think you misunderstand the number of writes per erase sector, too. My understanding is that erase clears the sector, and that you can write each individual page within the sector before needing to erase again. You just cannot re-write an individual page. So PAGE_SIZE of 2048 should work, though you'll have to consider your workload to see if it is the best selection. BTW, in case it wasn't clear, it's really impossible to answer this question without building a system to simulate your workload. Most likely your filesystem driver can be run against non-flash backing stores, and you can probably pull stats from it about how often it writes pages and how often it needs to rearrange pages for purposes of erasing a sector. If it doesn't have such stats, you should complain over there and/or add them yourself. Because all we can do over here is make theories, and what you really want to know is what's going to happen in real life. -scott ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] INNER JOIN Optimization
> The problem is that I would like to avoid splitting the query into two parts. > I would expect SQLite to do the same thing for me automatically (at least in > the second scenario), but it does not seem to happen... Why is that? In short, because SQLite cannot read your mind. To understand the answer compare speeds of executing one query (with one TABLE_A) and creating an in-memory database, creating a table in it and using that table in one query (with the same TABLE_A). I bet the first option (straightforward query without in-memory database) will be much faster. So SQLite selects the fastest way to execute your query. It cannot predict what the future queries will be to understand how to execute the whole set of queries faster. You can do that and you should split your query in two parts. Pavel On Wed, May 4, 2011 at 10:13 AM, petmal Malik wrote: > > Hello. > > I have two tables to join. TABLE_A (contains column 'a') and TABLE_BC > (contains columns 'b' and 'c'). There is a condition on TABLE_BC. The two > tables are joined by 'rowid'. > Something like: > > SELECT a, b, c FROM main.TABLE_A INNER JOIN main.TABLE_BC WHERE (b > 10.0 AND > c < 10.0) ON main.TABLE_A.rowid = main.TABLE_BC.rowid ORDER BY a; > > Alternatively: > > SELECT a, b, c FROM main.TABLE_A AS s1 INNER JOIN (SELECT rowid, b, c FROM > main.TABLE_BC WHERE (b > 10.0 AND c < 10.0)) AS s2 ON s1.rowid = s2.rowid > ORDER BY a; > > I need to do this a couple of time with different TABLE_A, but TABLE_BC does > not change... I could therefore speed things up by creating a temporary > in-memory database (mem) for the constant part of the query. > > CREATE TABLE mem.cache AS SELECT rowid, b, c FROM main.TABLE_BC WHERE (b > > 10.0 AND c < 10.0); > > followed by (many): > > SELECT a, b, c FROM main.TABLE_A INNER JOIN mem.cache ON main.TABLE_A.rowid = > mem.cache.rowid ORDER BY a; > > I get the same result set from all the queries above, but the last option is > by far the fastest one. > The problem is that I would like to avoid splitting the query into two parts. > I would expect SQLite to do the same thing for me automatically (at least in > the second scenario), but it does not seem to happen... Why is that? > > Thanks. > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] INNER JOIN Optimization
Hello. I have two tables to join. TABLE_A (contains column 'a') and TABLE_BC (contains columns 'b' and 'c'). There is a condition on TABLE_BC. The two tables are joined by 'rowid'. Something like: SELECT a, b, c FROM main.TABLE_A INNER JOIN main.TABLE_BC WHERE (b > 10.0 AND c < 10.0) ON main.TABLE_A.rowid = main.TABLE_BC.rowid ORDER BY a; Alternatively: SELECT a, b, c FROM main.TABLE_A AS s1 INNER JOIN (SELECT rowid, b, c FROM main.TABLE_BC WHERE (b > 10.0 AND c < 10.0)) AS s2 ON s1.rowid = s2.rowid ORDER BY a; I need to do this a couple of time with different TABLE_A, but TABLE_BC does not change... I could therefore speed things up by creating a temporary in-memory database (mem) for the constant part of the query. CREATE TABLE mem.cache AS SELECT rowid, b, c FROM main.TABLE_BC WHERE (b > 10.0 AND c < 10.0); followed by (many): SELECT a, b, c FROM main.TABLE_A INNER JOIN mem.cache ON main.TABLE_A.rowid = mem.cache.rowid ORDER BY a; I get the same result set from all the queries above, but the last option is by far the fastest one. The problem is that I would like to avoid splitting the query into two parts. I would expect SQLite to do the same thing for me automatically (at least in the second scenario), but it does not seem to happen... Why is that? Thanks. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Virtual tables and OR clause
On 05/04/2011 08:58 PM, Schrum, Allan wrote: > Hi Folks, > > Using virtual tables the WHERE clause is broken up and sent to the "best > index" function to determine the best index. Then the "filter" function is > called to perform the actual work. I've noticed that the SQLITE engine seems > to process OR clauses outside of the virtual table process, while AND clauses > are provided to the "filter" function to use. How can we get the OR clauses > sent to the "filter" function where we can make use of that information? > > Using SQLITE 3.6.18. If you do this: SELECT * FROM vtab WHERE a=1 OR b=2 Then SQLite will invoke xBestIndex once for each of the two conditions and once for a full-scan (no WHERE conditions at all). If it thinks there is advantage in doing so (based on the estimatedCost values returned by the three xBestIndex calls), SQLite may implement the query by using xFilter/xNext to get all the a=1 rows from the virtual table, then again for all of the b=2 rows. It uses the rowid values to avoid returning duplicates to the caller. It is not possible for SQLite to request a (a=1 OR b=2) with a single xFilter/xNext scan. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Virtual tables and OR clause
Hi Folks, Using virtual tables the WHERE clause is broken up and sent to the "best index" function to determine the best index. Then the "filter" function is called to perform the actual work. I've noticed that the SQLITE engine seems to process OR clauses outside of the virtual table process, while AND clauses are provided to the "filter" function to use. How can we get the OR clauses sent to the "filter" function where we can make use of that information? Using SQLITE 3.6.18. Thanks, -Allan ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How do I make a "singleton" using FMDB?
I think I figured it out on my own (a good night's sleep helps!)... thanks everybody... R On 5/3/11 4:14 PM, Rolf Marsh wrote: > I'm having a hard time changing my Obj-C SQLite3 code to FMDB... the > code works (after a fashion), but I need it to be a singleton (my > current SQLite3 code is currently a singleton)... my problem is I don't > know what has to be changed from my existing code, since FMDB has it's > own initialization routine. > > Any help would be greatly appreciated. > > Regards, > Rolf > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting an error 21 when doing a sqlite3_prepare_v2
On Tue, May 3, 2011 at 10:29 AM, Rolf Marsh wrote: > Good Morning Richard... thanks for the response... after making the > change you suggested and when doing the build, I get the following error: > > > > > l "_sqlite3MisuseError", referenced from: > -[PointPeekViewController > imagePickerController:didFinishPickingMediaWithInfo:] in > PointPeekViewController.o > ld: symbol(s) not found for architecture armv6 > collect2: ld returned 1 exit status > PointPeekViewController is not a part of SQLite, so something else is seriously wrong here. > > This is an iPhone app, using XCode 4 for the build... > > Regards, > Rolf > > > > > > On 5/3/11 6:52 AM, Richard Hipp wrote: > > On Tue, May 3, 2011 at 9:46 AM, Rolf Marsh >wrote: > > > >> Here is my code, written in Obj-C. I can't figure out what I'm doing > >> wrong... can someone enlighten me? Please? > >> > > Set a breakpoint on sqlite3MisuseError() and see where it is being hit. > > > > > >> NSString * errmsg = nil; > >> SQLiteDB* db = [SQLiteDB sharedSQLiteDB]; // create the d/b > >> > >> NSString *insertCommand = [NSString stringWithFormat:@"INSERT FAIL > >> INTO CardData (CARD_ID, CARD_NAME, CODE_VAL) VALUES ('/%@', '/%@', > >> '/%@')", symbol.data, @"Test Card", symbol.typeName]; > >> > >> sqlite3_exec(db, [insertCommand UTF8String], NULL, NULL,&errmsg); > >> if(errmsg != NULL) > >> NSLog(@"insert error: /%@",&errmsg); // DEBUGGING ONLY! > >> > >> // now, pull it back out of the d/b and display the data > >> NSString *sqlStatement = @"SELECT card_id, card_name, code_val FROM > >> CardData"; > >> sqlite3_stmt *compiledStatement; > >> int err = sqlite3_prepare_v2(db, [sqlStatement UTF8String], -1, > >> &compiledStatement, NULL); //<--- error 21 occurs here > >> if(err != SQLITE_OK) > >> NSLog(@"prepare error: /%@", err); > >> else { > >> // Loop through the results and add them to the feeds array > >> while(sqlite3_step(compiledStatement) == SQLITE_ROW) { > >> > >> // Read the data from the result row > >> resultText.text = [NSString stringWithFormat:@"\nDatabase: > >> \n%@ \n%@ \n%@", resultText.text, > >> [NSString stringWithUTF8String:(char > >> *)sqlite3_column_text(compiledStatement, 0)], > >> [NSString stringWithUTF8String:(char > >> *)sqlite3_column_text(compiledStatement, 1)], > >> [NSString stringWithUTF8String:(char > >> *)sqlite3_column_text(compiledStatement, 2)]]; > >> } > >> sqlite3_finalize(compiledStatement); // release it... > >> sqlite3_close(db); > >> } > >> ___ > >> sqlite-users mailing list > >> sqlite-users@sqlite.org > >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > >> > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > 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
[sqlite] BUG: incremental_vacuum in combination with SQLITE_FCNTL_CHUNK_SIZE
With respect to SQLite 3.7.6 Situation: - incremental vacuum mode - old "journal" mode (have not tested with WAL) - extra tail-room using SQLITE_FCNTL_CHUNK_SIZE - some free pages - execute PRAGMA incremental_vacuum Problem: - the journal will be created for all extra tail pages This is just a performance issue, no database corruption, and the incremental_vacuum is done well. However, such a situation is not uncommon. SQLITE_FCNTL_CHUNK_SIZE may be used to prevent on disk fragmentation, and incremental_vacuum(...) is used for *quick* background database compacting. Reproduction: - new database - PRAGMA auto_vacuum = 2 - SQLITE_FCNTL_CHUNK_SIZE with 1 GiB (huge, just for demonstration) - CREATE TABLE test (id INTEGER) - DROP TABLE test - PRAGMA incremental_vacuum(1) - a journal of 1 GiB will be created Workaround we are using: - PRAGMA page_count - PRAGMA page_size - close database - truncate database file (page_count * page_size) - reopen database - PRAGMA incremental_vacuum Proposed solution: incremental_vacuum should only consider the pages before the last used page and issue a truncate to the VFS for the final required size (i.e. the size up to the last used page), which may again be rounded up by the VFS to the next multiple of SQLITE_FCNTL_CHUNK_SIZE. This will allow incremental_vaccum to be used for quick partial compacting in the background and also recover disk space in multiples of SQLITE_FCNTL_CHUNK_SIZE. Kind regards, Frans van Dorsselaer ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Feature request: Fuzzy searching
Hi all, I am interested in seeing "fuzzy searching" in SQLite, for lack of a better term. This type of search would return more results than LIKE currently does today. The search would return matches based on expanded criteria, each one may be considered a separate RFE for LIKE or for another specialized function (FLIKE, maybe). 1) Case insensitivity This is already implemented in SQLite for ASCII characters, but it would be nice to have for the rest of the UTF-8 characters (those defined with tolower values, of course). 2) ASCII-equivalent searching This would allow users to search for non-ASCII characters using ASCII-equivalents. For example, searching for "beisen" would return both "beisen" and "beißen". Another example would be a search for "daemon" returning both "daemon" and "dæmon". 3) Diacritic-elimination searching This would allow user to search for words without adding the diacritics. For example, searching for "Jose" would return both "Jose" and "José". Another example would be a search for "דותן" returning both "דותן" and "דוֹתָן". 4) Punctuation-elimination searching This would allow user to search for words without adding punctuation. For example, searching for "Marc Anthony" would return both "Marc Anthony" and "Marc-Anthony". Another example would be a search for "Beer Sheva" returning both "Beer Sheva" and "Be'er Sheva". I have seen this issue brought up on all types of software, from Anki to Kontact to Yum: https://groups.google.com/group/ankisrs/browse_thread/thread/6fc8374b75a4bf4f/bbce3eb5e8401356?lnk=raot&pli=1 https://bugs.kde.org/show_bug.cgi?id=158365 http://comments.gmane.org/gmane.linux.redhat.fedora.general/389336 Thanks! -- Dotan Cohen http://gibberish.co.il http://what-is-what.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting an error 21 when doing a sqlite3_prepare_v2
Good Morning Richard... thanks for the response... after making the change you suggested and when doing the build, I get the following error: l "_sqlite3MisuseError", referenced from: -[PointPeekViewController imagePickerController:didFinishPickingMediaWithInfo:] in PointPeekViewController.o ld: symbol(s) not found for architecture armv6 collect2: ld returned 1 exit status This is an iPhone app, using XCode 4 for the build... Regards, Rolf On 5/3/11 6:52 AM, Richard Hipp wrote: > On Tue, May 3, 2011 at 9:46 AM, Rolf Marshwrote: > >> Here is my code, written in Obj-C. I can't figure out what I'm doing >> wrong... can someone enlighten me? Please? >> > Set a breakpoint on sqlite3MisuseError() and see where it is being hit. > > >> NSString * errmsg = nil; >> SQLiteDB* db = [SQLiteDB sharedSQLiteDB]; // create the d/b >> >> NSString *insertCommand = [NSString stringWithFormat:@"INSERT FAIL >> INTO CardData (CARD_ID, CARD_NAME, CODE_VAL) VALUES ('/%@', '/%@', >> '/%@')", symbol.data, @"Test Card", symbol.typeName]; >> >> sqlite3_exec(db, [insertCommand UTF8String], NULL, NULL,&errmsg); >> if(errmsg != NULL) >> NSLog(@"insert error: /%@",&errmsg); // DEBUGGING ONLY! >> >> // now, pull it back out of the d/b and display the data >> NSString *sqlStatement = @"SELECT card_id, card_name, code_val FROM >> CardData"; >> sqlite3_stmt *compiledStatement; >> int err = sqlite3_prepare_v2(db, [sqlStatement UTF8String], -1, >> &compiledStatement, NULL); //<--- error 21 occurs here >> if(err != SQLITE_OK) >> NSLog(@"prepare error: /%@", err); >> else { >> // Loop through the results and add them to the feeds array >> while(sqlite3_step(compiledStatement) == SQLITE_ROW) { >> >> // Read the data from the result row >> resultText.text = [NSString stringWithFormat:@"\nDatabase: >> \n%@ \n%@ \n%@", resultText.text, >> [NSString stringWithUTF8String:(char >> *)sqlite3_column_text(compiledStatement, 0)], >> [NSString stringWithUTF8String:(char >> *)sqlite3_column_text(compiledStatement, 1)], >> [NSString stringWithUTF8String:(char >> *)sqlite3_column_text(compiledStatement, 2)]]; >> } >> sqlite3_finalize(compiledStatement); // release it... >> sqlite3_close(db); >> } >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Feature request: Fuzzy searching
I apologize if double-post, the first one didn't make it to the list. - Hi, >Hi all, I am interested in seeing "fuzzy searching" in SQLite, for >lack of a better term. This type of search would return more results >than LIKE currently does today. The search would return matches based >on expanded criteria, each one may be considered a separate RFE for >LIKE or for another specialized function (FLIKE, maybe). > >1) Case insensitivity Yes >2) ASCII-equivalent searching Yes >3) Diacritic-elimination searching Yes >4) Punctuation-elimination searching Not out of the box. I've written a small SQLite extension for dealing with Unicode text: unifuzz. It contains, among other [I believe] useful functions, an unaccent() scalar function which will do right that: map accented characters to their basic form (unaccented) equivalent. It also handles a few special cases like the German Eszet 'ß' and a number of ligatures. All Unicode functions rely on Unicode v5.1 tries internal to the extension. You'll also find a set of Unicode-aware set of functions: upper, lower, title, proper. There are as well a set of Unicode-aware locale-independant collations: nocase and names and a collation usefull to sort numerically strings with numeric prefix (built-in collations will sort lexicographically, which is a pain in this case). Being able to deal with text as locale-INdependant was a need for me as I manipulate data from customers in more that 27 countries now. Of course it's far from perfect since doing things "perfectly" means first selecting a single locale, which would ruin operations applied to text from another country/language. The numeric-prefix collation recognizes all known zero_to_nine representations and maps them all to "our" 0-9. All this is detailed at length in headers/comments of the code. Finally, there is a fuzzy search function which works internally with unaccented versions of the strings supplied. It returns the Damerau-Levenshtein distance between its two arguments, and is (uncreatively) named 'typos'. There is one limitation with this extension: the collation functions rely on invoking a Windows call (from kernel32.dll), which makes them currently non-portable across systems outside the Windows world. The extension can probably be easily built without collation for compiling on non-Windows systems. I didn't have the need yet to build for 64 bits but I don't believe this should pose unduly complex issues. It should also be quite easy to port the offending function to unix like OSes. Full source is included and contains detailed explanations: read them! Last note: all this comes without guaranty of any kind. I still consider these extensions as beta, but I've been using them daily on our production base for months, like several other users. Of course, it can't pretend be as perfect as ICU, but it's way smaller (170Kb vs many Mb) and much, much faster. Aother advantage is that it doesn't require that you select a specific locale to register collations. Not only does this simplify the code but it's also a prerequisite when you need to deal with data from several languages at once. The source contains detailed explanations. The binaries are x86 32bit ready for use. If you have any question or would like to obtain a download link, feel free to drop me a mail. I also would appreciate it if you can report how this extension behave w.r.t. your language(s). Cheers, ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] NAND flash whit lot of writes (erases)
I found few topics on this issue but still. For instance from here http://www.mail-archive.com/sqlite-users@sqlite.org/msg54904.html. I have similar problem of writing multiple small data (max 100bytes per entry), but do not think that those advices from upper link were right. I have to tell that I have no idea how SQLite of Flash file system is implemented but lets pretend that there is no FFS and SQLite and storage is implemented using hand crafted drivers optimised for writing as many times as possible (endurance). in case of for http://download.micron.com/pdf/datasheets/flash/nand/2gb_nand_m29b.pdf (that is just first link from my search engine) there are 2048 blocks for 2Gb (256 MB) device and each block has 64 pages and device endurance is 100k erasures. That men that in ideal world I am able to write at least NumberOfWriteUnits * Endurance = 64*2048*100k = 1.0e+10 times. In 10 years that mean 40 writes per second. Of course I do not have that may space but I can download data frequently enough and make space for new data. Lets say that memory utilisation is not that efficient and we have overhead by factor 100 per write using SQLite, Flash file system and having some other data on flash and other unexpected issues. This still means that we end up whit at worst 1 write per 2 seconds over 10 years what is I think enough for most this kind of applications. Am I right? Are there more and less efficient file systems for this task? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Advice to choose an index for quad tree?
I found the R-Tree idea fascinating. Conceptually, this is exactly what I need. But indeed, my case is very simple: my dataset is not sparse, my tiles never overlap (for a given zoom factor), the number of tiles is still rather small, they are all rectangular and the same size (modulo edge effects). So while the asymptotic behavior of the R-Tree is likely to be much better, I am more concerned with the behavior towards small data sizes... The other important criterion is ease of implementation. Thanks to the SQLite R-Tree extension, both ways seem equally easy. I guess I'll start with my initial idea of a 3 column index, and experiment with R-Tree a bit later. Thanks for your suggestions. Jean-Denis On 3 mai 2011, at 19:42, David Garfield wrote: > Actually, for what he wants, you don't need anything fancy. A simple > multi-column index is enough. > > The R-Tree is to allow queries of a sparse dataset, that might also > have overlaps. > > So: A simple index for your background imagery. An R-Tree index for > the features added on top of your background imagery. > > --David Garfield > > Enrico Thierbach writes: >> Hi, >> >> I think an R Tree is what you are after. >> >> http://www.sqlite.org/rtree.html >> >> /eno >> ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Page Size with NAND FLASH
>From here http://download.micron.com/pdf/datasheets/flash/nand/2gb_nand_m29b.pdf you can se what PAGE_SIZE is Page size is smallest writeable unit. Technically you can write less multiple times but as far as I know jffs2 does not use this technique, but lot of other flash file systems does (jffs for instance). In any case you can go only from 1 to 0 before erasure. For erasing You can not erase page but you have to erase whole block of multiple pages called blocks (in case of device I appended there is 64 pages per block ). This is smallest erasable unit. In order to find out about your NAND flash check/google in datasheet. 2011/5/4 Sugathan, Rupesh > I am planning to use sqlite on a Linux system with JFFS2 file system on > NAND flash. NAND device that I am using has page size of 2048 bytes and > a erase sector size of 128K. I would like to take advantage of sqlite > rollback for the safety of my database files during power-fail. > > > > As per http://www.sqlite.org/pragma.html#pragma_page_size, the PAGE_SIZE > should be set between 512 bytes and 64K. The page size of NAND devices, > in my understanding, is only good for 2 to 3 writes before needing to > erase the whole sector. This indicate that the PAGE_SIZE in this case > should be set to 128K (the erase size). Given that this is not a > possibility, how is the power-fail safety achieved in sqlite used on > large sectored flash devices? > > > > I would appreciate if anyone can comment on this topic and/or share > their experience with using sqlite on Flash devices with large sector > sizes. > > Thanks > > -- > > Rupesh > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users