[sqlite] file structure issue
hi, i can see the source file structure has been changed from 65 (sqliteint.h, os_common.h,. )files before to only 2 files (sqlite3.h&sqlite3.c)now. and this change bring me a problem when i try to integrate sqlite with other platforms. in my sqlite integration, i have to put my porting layer os_xxx into a seperate 'cpp' file and to include related defines (defined in sqliteint.hand os_common.h in early file structure). and due to compiler issues, i cant include sqlite3.c in my 'cpp' file. i am trapped here. does anyone know how can i get the source codes with the early file structure? (65 seperate files)? thanks in advance. wang
Re: [sqlite] bizarre query problem
Joe Wilson <[EMAIL PROTECTED]> wrote: > Just for kicks, what happens on both platforms when you issue: > > select genre, length(genre), hex(genre), filename > from objects where media_type=1; > Make that: select genre, typeof(genre), length(genre), hex(genre), filename from objects where media_type=1; -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SQL error: disk I/O error
What is the OS you're using and what kind of media is it? Hard drive or USB key or ??? --- Shilpa Sheoran <[EMAIL PROTECTED]> wrote: > It seems that rc = fsync(fd); is failing in function > static int full_fsync(int fd, int fullSync, int dataOnly) in file os_unix.c > { > #else /* if !defined(F_FULLSYNC) */ > if( dataOnly ){ > rc = fdatasync(fd); > }else{ > > //*this call is failing >rc = fsync(fd); > } > > } > > using -DSQLITE_NO_SYNC in the Makefile works > What is the way out for this problem? > What happens if we use this option -DSQLITE_NO_SYNC ? Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] bizarre query problem
Just for kicks, what happens on both platforms when you issue: select genre, length(genre), hex(genre), filename from objects where media_type=1; as well as: select count(*) from objects where genre LIKE '%POP%'; > I have a bizarre problem. Here is an example of something I tried in > sqlite3 3.3.8: > > sqlite> select genre,filename from objects where media_type=1; > query abbreviated... > Msica independiente|0056_People Get Ready1_test1.wma > POP|0057_The Mighty Ship1_test1.wma > POP|0058_The Mighty Quinn1_test1.wma > query abbreviated... > sqlite> select genre,filename from objects where genre='POP'; > sqlite> > > So basically, no results are returned from the second query although > clearly there are items in the list with genre='POP'. > > This problem only happens on Linux. On Windows, the query returns the > results as expected... Which makes it yet more bizarre. Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. http://new.toolbar.yahoo.com/toolbar/features/mail/index.php - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SQL error: disk I/O error
It seems that rc = fsync(fd); is failing in function static int full_fsync(int fd, int fullSync, int dataOnly) in file os_unix.c { #else /* if !defined(F_FULLSYNC) */ if( dataOnly ){ rc = fdatasync(fd); }else{ //*this call is failing rc = fsync(fd); } } using -DSQLITE_NO_SYNC in the Makefile works What is the way out for this problem? What happens if we use this option -DSQLITE_NO_SYNC ? Thanks Shilpa On 5/21/07, Joe Wilson <[EMAIL PROTECTED]> wrote: If you're using Linux, try: echo "create table t1(a);" |strace ./sqlite3 my.db 2>&1 |less and examine the output. See where it differs from the successful tmpfs run. Newer versions of sqlite3 may have better IO error messages. > I'm running the command line tool to create sqlite3 db. > My directory permissions are drwxrwxrwt. > I'm getting the following error. > > > ./sqlite3 newdb > SQLite version 3.3.12 > Enter ".help" for instructions > sqlite> create table tbl1(one varchar(10), two smallint); > SQL error: disk I/O error > > If I try the same thing in a tmpfs, it works. Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] bizarre query problem
Nothing you've mentioned is out of the ordinary. I would expect the same behavior on both platforms. Can you post the complete schema, and the exact query that exhibits the problem? (And perhaps a couple of insert statements into the objects table). Without this I don't think anyone can recreate the problem. --- Brett Keating <[EMAIL PROTECTED]> wrote: > I have a bizarre problem. Here is an example of something I tried in > sqlite3 3.3.8: > > sqlite> select genre,filename from objects where media_type=1; > query abbreviated... > Msica independiente|0056_People Get Ready1_test1.wma > POP|0057_The Mighty Ship1_test1.wma > POP|0058_The Mighty Quinn1_test1.wma > query abbreviated... > sqlite> select genre,filename from objects where genre='POP'; > sqlite> > > So basically, no results are returned from the second query although > clearly there are items in the list with genre='POP'. > > This problem only happens on Linux. On Windows, the query returns the > results as expected... Which makes it yet more bizarre. Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] bizarre query problem
Hi, I have a bizarre problem. Here is an example of something I tried in sqlite3 3.3.8: sqlite> select genre,filename from objects where media_type=1; query abbreviated... Msica independiente|0056_People Get Ready1_test1.wma POP|0057_The Mighty Ship1_test1.wma POP|0058_The Mighty Quinn1_test1.wma query abbreviated... sqlite> select genre,filename from objects where genre='POP'; sqlite> So basically, no results are returned from the second query although clearly there are items in the list with genre='POP'. This problem only happens on Linux. On Windows, the query returns the results as expected... Which makes it yet more bizarre. The exact same query run "in code" using the C interface, rather than on the command line interface, also behaves similarly... Works on Windows, not on Linux. In both cases I am careful to put the entire query into UTF-16, as the strings are stored as UTF-16 for internationalization purposes. I have a couple questions: 1) Would having an index on the genre column cause any potential issues here? 2) Is there a potential issue in string handling between linux/windows that I should be aware of? 3) Are there any build-time configuration differences I may have inadvertently introduced that may cause behavior like this? The Linux version runs on an ARM-11. The Windows version runs on a typical Dell PC in a visual studio environment. Thanks, Brett - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] Re: How to retrieve results in a array?
Ok, thanks for that quick response! ppcinfo -Original Message- From: Igor Tandetnik [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 22, 2007 4:18 PM To: SQLite Subject: [sqlite] Re: How to retrieve results in a array? Dave Furey <[EMAIL PROTECTED]> wrote: > I've got a C routine that queries for integer data, and I'm currently > stepping through each row to fill an integer array. Is there a more > convenient way of doing this? For example, is there a special sqlite3 > call I can make that will fill up an integer array directly with me > having to step through all the returned rows? No. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: How to retrieve results in a array?
Dave Furey <[EMAIL PROTECTED]> wrote: I've got a C routine that queries for integer data, and I'm currently stepping through each row to fill an integer array. Is there a more convenient way of doing this? For example, is there a special sqlite3 call I can make that will fill up an integer array directly with me having to step through all the returned rows? No. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] How to retrieve results in a array?
I've got a C routine that queries for integer data, and I'm currently stepping through each row to fill an integer array. Is there a more convenient way of doing this? For example, is there a special sqlite3 call I can make that will fill up an integer array directly with me having to step through all the returned rows? Thanks, ppcinfo
Re: [sqlite] R-Trees and SQLite
At 18:09 20/05/2007, you wrote: >In a previous post drh mentioned: > > You need an R-Tree index to do something like this. The > public-domain version of SQLite only supports B-Tree indices. > > (http://www.mail-archive.com/sqlite-users%40sqlite.org/msg24643.html) > >Does this imply that there exists a commercial version of SQLite with >R-Tree indexing? > >I did not see it mentioned here: > > http://www.hwaci.com/sw/sqlite/prosupport.html No, it just says that if you want a R-Tree SQLite version you can contact and contract him for add this feature. - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] file structure-can i get the source codes with original structure?
hi, i can see the source file structure has been changed from 65 files before to only 2 files now. and this change bring me a problem when i try to integrate sqlite with other platforms. in my sqlite integration, i have to put my porting layer os_xxx into a seperate 'cpp' file and to include related defines (defined in sqliteint.hand os_common.h in early file structure). and due to compiler issues, i cant include sqlite3.c in my 'cpp' file. i am trapped here. does anyone know how can i get the source codes with the early file structure? (65 seperate files)? thanks in advance. wang
Re: [sqlite] Re: Problem with Unicode surrogates
Ok, I reviewed the sources (utf.c) and I'd say that it's still incorrect. Actually, it doesn't test for surrogates at all, the problem I was experiencing was caused by the fact that SQLite reads unallocated memory when there's an unpaired surrogate present as the last character of string - see READ_UTF16LE macro. I tried searching cvstrac, but haven't find this issue there, haven't anyone entered it or even fixed? Was my description clear? Should I enter the issue myself? It isn't anything huge, but at least in can result in AV in SQLite... Jiri - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: sqlite3_reset (or sqlite3_finalize) and error reporting?
Scott McDonald wrote: Jef Driesen wrote: I have some questions on the usage of sqlite3_reset (or sqlite3_finalize) after sqlite3_step. In the legacy interface I use sqlite3_reset after sqlite3_step to obtain a more specific error code for SQLITE_ERROR (to be able to detect schema errors and automatically reprepare the statement, like the v2 interface does): int myprepare(sqlite3* db, const char* sql, int nbytes, sqlite3_stmt** stmt, const char** tail) { #ifdef USE_LEGACY int rc = sqlite3_prepare (db, sql, nbytes, stmt, tail); #else int rc = sqlite3_prepare_v2 (db, sql, nbytes, stmt, tail); #endif if (rc != SQLITE_OK && *stmt != 0) { sqlite3_finalize (*stmt); *stmt = 0; } } int mystep(sqlite3_stmt* stmt) { int rc = sqlite3_step (stmt); #ifdef USE_LEGACY if (rc == SQLITE_ERROR) rc = sqlite3_reset (stmt); #endif return rc; } This works well, but now I also want to report an appropriate error message to the user (by throwing an exception). But I'm having some problems with that. In some cases, the correct errcode and errmsg (from the sqlite3_errcode and sqlite3_errmsg functions) can be obtained directly after calling sqlite3_step, but sometimes sqlite3_reset is required because sqlite3_step only returns a generic error. My idea was now to always use sqlite3_reset (see example results below): int mystep(sqlite3_stmt* stmt) { int rc = sqlite3_step (stmt); if (rc != SQLITE_DONE && rc != SQLITE_ROW) rc = sqlite3_reset (stmt); return rc; } This also makes my code behave the same for both the legacy and the v2 interface, since I have to use sqlite3_reset anyway in the legacy interface (except for the few return codes that are reported directly). This works well in most cases, but as you can see from the results below, I can't get a correct error message for SQLITE_MISUSE. Now my questions are: 1. How do I retrieve the errmsg for SQLITE_MISUSE? Are there any other codes with this problem? Maybe it's worth adding a function to obtain the errmsg from an error code (e.g. not only the most recent one). 2. Is it normal that sometimes the rc value is different from the errcode (and its associated errmsg)? The documentation for sqlite3_errcode seems to suggest that this should not happen. Sample output (in the format "function: rc, errcode, errmsg") for a few errors: SQLITE_CONSTRAINT (legacy) sqlite3_step: 1, 1, SQL logic error or missing database sqlite3_reset: 19, 19, column is not unique SQLITE_CONSTRAINT (v2) sqlite3_step: 19, 1, SQL logic error or missing database sqlite3_reset: 19, 19, column is not unique SQLITE_BUSY (legacy and v2) sqlite3_step: 5, 5, database is locked sqlite3_reset: 5, 5, database is locked SQLITE_MISUSE (legacy and v2) sqlite3_step: 21, 0, not an error sqlite3_reset: 0, 0, not an error I was getting similar results, for me I noticed this behavior with a CONSTRAINT failure was getting a 19 return code but in my logging for this I use the error code and error message API and was getting 1 and "SQL logic or missing database" or something like that. On the "sqlite_finalize" I would get a 19 return code and in my logging would get a 19 error code and error message of "PRIMARY KEY must be unique" - this is what I would expect after calling "sqlite_step" not after calling "sqlite_finalize" - this is like the legacy behavior you mentioned, etc. In the v2 interface, the return code is always reported immediately, without the need to call sqlite3_reset or sqlite3_finalize. This is explained in the documentation. So far no problem, but I noticed the functions sqlite3_errcode and sqlite3_errmsg are always behaving as they did with the legacy interface. The correct error code and error message is only returned after calling sqlite3_reset or sqlite3_finalize. But this is something that is *NOT* mentioned in the documentation at all. As it turns out I'm not the only one who finds this really confusing, so this should really be added to the documentation. I noticed you took it a couple of steps further and analyzed other possible "prepared statement" errors in this area, nice work... Just wondering if you got any resolution on this as it doesn't feel "clean" to me - I would like my logging statements to actually provide some useful information when the error occurs, etc. You can get the useful error information from sqlite3_step after calling sqlite3_reset (no matter which interface you used to prepare the statement). But as I found out, this does not work for SQLITE_MISUSE (and maybe others?). In this case I never get an appropriate error message (I always get "not an error") and the error code is even lost after calling sqlite3_reset! I'm not aware of a solution for this problem. - To unsubscribe, send email to [EMAIL PROTECTED] -