Re: [sqlite] precompiled SQL and transactions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Christian Smith wrote: | This has come up on the list before, and should probably be documented on | the Wiki in http://www.sqlite.org/cvstrac/wiki?p=PrecompiledSql. [...] | As the sqlite3_compile API is still experimental (the SQLite V3 API | reference doesn't list it) this is probably a good time to augment the | API, especially if done in a backward compatible way. I don't think anyone | would argue with that. AFAIK sqlite_compile in sqlite3 is called sqlite3_prepare?!?! And sqlite3_prepare is documented: http://www.sqlite.org/capi3ref.html#sqlite3_prepare Exists the same error in the sqlite3_prepare call? Anybody validated this? -BEGIN PGP SIGNATURE- Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBFBhQSIrOxc3jOmoRAqVfAJ4x03t8eoQ7Kbwirch2kSsu+pDuXwCfao4c j/yB4secbAug+nhuHXExugs= =dXcg -END PGP SIGNATURE-
Re: [sqlite] Test
On 6 ago 2004, at 13:34, Peter Lau wrote: it works... what's up? On Aug 5, 2004, at 11:41 AM, Tito Ciuro wrote: Test It didn't seem to work yesterday. I though the mailing list was down... -- Tito
Re: [sqlite] Why is 'database schema has changed' being reported?
Hello again, Following the email I sent yesterday, I've discovered why I get a SQLITE_SCHEMA error: VACUUM changes the schema version numbering. The question is why? The schema is exactly the same, it has the same tables, columns and indexes. Sure, the data is now compacted, but what has this to do with the schema? Am I missing something? Thanks again, -- Tito On 5 ago 2004, at 3:39, Tito Ciuro wrote: Hello, This happens with SQLite 3.0.3 on Mac OS X 10.3.4. I'm issuing a simple 'SELECT * FROM people' on my database. When I reach 'sqlite3VdbeExec', it falls on the following error: if( rc==SQLITE_OK && iMeta!=pOp->p2 ){ sqlite3SetString(>zErrMsg, "database schema has changed", (char*)0); rc = SQLITE_SCHEMA; } In my code, I execute the query like this: int result = sqlite3_prepare(db, query, strlen(query), &_vm, _tail); I get SQLITE_OK back. '_vm' is also set. Then I call: result = sqlite3_step(_vm); and I get result == 1. The error string tells me "database schema has changed". The weird thing is that if I inspect the database, all records in the people table are there! What's going on? Any ideas? Thanks, -- Tito
Re: [sqlite] Test
it works... what's up? On Aug 5, 2004, at 11:41 AM, Tito Ciuro wrote: Test
Re: [sqlite] Compiling Linux SQLite with thread safe
Corwin Burgess wrote: I'm looking for some help in compiling a Linux version of SQLite v2.8.15 that is thread safe capable. Corwin Ignore my previous message using zip file. I used the Makefile.linux.gcc to compile the source files in sqlite-source-2.8.15.tar.gz from Fedora Core 1. I modified the Makefile to add threadsafe and removed tcl capability. When I ran 'make' from the /bld directory I had no errors but this also didn't create either the './lib' directory or the sqlite library. In the /bld directory I have the 'sqlite' executable and 'libsqlite.a' ar archive files. How do I create the sqlite library using these source files and Makefile? Has any Linux user compile the sqlite library with threadsafe defined? Corwin
[sqlite] QNX and PPC
Hello everybody, does someone have any experience with building for the QNX operating system? And for the Power PC processor? QNX 6.2.1 is a real-time Linux but it behaves strangely sometimes. It has not gcc but a qcc compiler. Our testing program runs correctly on the x86 PC. It creates a database, a table, inserts and selects data. But the same program cross-compiled on the same computer for PPC ends at the first "CREATE TABLE" statement with SQLITE_BUSY. I am using SQLite 2.8.6. Is it possible that the little-or-big-endian thing could cause this trouble? Or do you have any other ideas? Thank you very much, Jakub
[sqlite] Return value of authorizer callback
Hello, according to the documentation of sqlite3_set_authorizer(), the callback sould return SQLITE_OK, SQLITE_DENY or SQLITE_IGNORE. My questions: a.) What is the behavour of sqlite, if the callback returns a value that isn't allowed? What will sqlite3_prepare() return in this situation? b.) How should the authorizer callback signal an error to sqlite? Thanks Michael signature.asc Description: OpenPGP digital signature
Re: [sqlite] Lemon Parser Examples - I'll show you my examples
Many thanks for your contribution! -joe On Wed, 4 Aug 2004 22:02:48 -0400, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > A user earlier posted a question about terminating > the grammer for a simple calculator done with lemon. > > I ran into the same problem and had to use > the following, which worked fine: > > main ::= in. > in ::= . > in ::= in state NEWLINE. > > I cannot reduce it any further. For instance, > the following does not work: > > in ::= . > in ::= in stmt ENDLINE. > > The version of lemon I'm using is from the > cvs 3.0.3. > > The full calculator, there are 4 examples, can > be downloaded from the following link: > > http://prdownloads.sourceforge.net/souptonuts/lemon_examples.tar.gz?download > > Look at example4.y, if you want to go directly to > the terminating issue above. Everything should be in > this download including lemon.c and lempar.c, so you > won't have to download anything else. > > Take a look at the README. I tried to add documentation > on creating custom tokens, destructors, and a little bit > on what the grammer does. > > To run everything, just run make > >$ make > > Then, each example can be run separately > >$ ./ex1 > >$ ./ex2 > > >$ ./ex4 > > Anyway, I hope this examples will help. Or > inspire you to take a took at lemon. > > Regards, > > Mike Chirico > >
[sqlite] Test
Test smime.p7s Description: S/MIME cryptographic signature
[sqlite] Mailing list problem
According to the instructions at http://www.sqlite.org/support.html... "For additional information about operating and using this mailing list, send a message to [EMAIL PROTECTED] and instructions will be sent by to you by return email." This doesn't seem to be working. I've tried twice. - Steve
[sqlite] sqlite date?
hi, can i use date type in sqlite or i must save as varchar? thx yesso
[sqlite] Fwd: Why is 'database schema has changed' being reported?
Hello, This happens with SQLite 3.0.3 on Mac OS X 10.3.4. I'm issuing a simple 'SELECT * FROM people' on my database. When I reach 'sqlite3VdbeExec', it falls on the following error: if( rc==SQLITE_OK && iMeta!=pOp->p2 ){ sqlite3SetString(>zErrMsg, "database schema has changed", (char*)0); rc = SQLITE_SCHEMA; } In my code, I execute the query like this: int result = sqlite3_prepare(db, query, strlen(query), &_vm, _tail); I get SQLITE_OK back. '_vm' is also set. Then I call: result = sqlite3_step(_vm); and I get result == 1. The error string tells me "database schema has changed". The weird thing is that if I inspect the database with another tool/app, all records in the people table are there! What's going on? Any ideas? Thanks, -- Tito smime.p7s Description: S/MIME cryptographic signature
Re: [sqlite] precompiled SQL and transactions
This has come up on the list before, and should probably be documented on the Wiki in http://www.sqlite.org/cvstrac/wiki?p=PrecompiledSql. As to whether it's a problem, I think probably not as the 'fix' is so trivial. If you want to fix, then simply wrap the begin/compile/commit in a new function called, say sqlite3_compile_transaction, which will do the compile in a transaction as per your code, and create a ticket with a patch for DRH to possibly intergrate into the next release. As the sqlite3_compile API is still experimental (the SQLite V3 API reference doesn't list it) this is probably a good time to augment the API, especially if done in a backward compatible way. I don't think anyone would argue with that. Christian On Wed, 4 Aug 2004, Dennis Cote wrote: >Hi All, > >I have discovered a quirk in the SQLite API (both 2.8 and 3.0) when using >precompiled SQL statements with transactions. > >My goal was to perform a series of inserts into a database as quickly as >possible. To this end I first used a single explicit transaction around the >series of inserts. Secondly, to eliminate the overhead of compiling the SQL >code for each insert I precompiled the SQL statement using sqlite_compile. >Furthermore since this loop is repeated many times, the SQL is compiled only >once at the beginning of the program and reused when needed. > >In pseudocode my loop looks like this; > >vm = sqlite_compile ("insert into t values (?,?)") > >sqlite_exec ("begin") >loop { >sqlite_reset(vm) >sqlite_bind(vm, 1, ...) >sqlite_bind(vm, 2, ...) >sqlite_step(vm) >} >sqlite_exec("commit") > >The problem is that the loop executed very slowly. The reason it ran slowly >is that the virtual machine was compiled outside of the transaction, so it >included the instructions to open and commit a default transaction. As a >result my explicit transaction was ended by the first sqlite_step call in >the loop and every other insert ran in its own automatic transaction (which >everyone knows is quite slow). > >The workaround is quite straightforward; simply begin a transaction before >compiling the statement, and end it afterwards. Since there is an explicit >transaction active when the VM is compiled, it does not contain the >instructions to open and commit a default transaction. > >My pseudocode now looks like this; > >sqlite_exec ("begin") >vm = sqlite_compile ("insert into t values (?,?)") >sqlite_exec("commit") > >sqlite_exec ("begin") >loop { >sqlite_reset(vm) >sqlite_bind(vm, 1, ...) >sqlite_bind(vm, 2, ...) >sqlite_step(vm) >} >sqlite_exec("commit") > >The loop now runs much much faster (on the order of 100 times faster). > >My concern is that opening and closing a real transaction, which does no >I/O, in order to compile an SQL statement is "strange". It seems to me that >I should be able to pass a flag to the sqlite_compile function that >explicitly tells it to include the automatic transaction instructions or >not. > >What do you think? Is this quirk worth an API change? I know the version 3.0 >API is supposed to be frozen, but maybe it's better to change it now rather >than later. On the otherhand there is a pretty simple workaround if you are >aware of the problem. > -- /"\ \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \
RE: [sqlite] Building for Windows
On Thu, 5 Aug 2004, Dennis Volodomanov wrote: >I'm sorry, but I just can't build it :-( I'm using CygWin and I've ran >the 'configure' command and then I type 'make' and this is what I get: > >$ make >./libtool --mode=compile gcc -g -O2 -DOS_WIN=1 -DHAVE_USLEEP=1 -I. >-I./src -DNDE >BUG -c ./src/build.c > gcc -g -O2 -DOS_WIN=1 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG -c >./src/build.c -D >PIC -o .libs/build.o >src/build.c: In function `sqlite3EndTable': >src/build.c:1401: error: `OP_ParseSchema' undeclared (first use in this >function >) >src/build.c:1401: error: (Each undeclared identifier is reported only >once >src/build.c:1401: error: for each function it appears in.) >src/build.c: In function `sqlite3DropTable': >src/build.c:1689: error: `OP_DropTable' undeclared (first use in this >function) >src/build.c: In function `sqlite3CreateIndex': >src/build.c:2159: error: `OP_ParseSchema' undeclared (first use in this >function >) >src/build.c: In function `sqlite3DropIndex': >src/build.c:2258: error: `OP_DropIndex' undeclared (first use in this >function) >make: *** [build.lo] Error 1 > >Does anyone have any ideas on how to do this or what is wrong? Is opcodes.h empty? Try removing it so it gets regenerated, and look for errors in regeneration of opcodes.h: $ rm opcodes.h $ make opcodes.h You may be missing some command required. If grep, sed or awk are missing, you'll get a broken pipeline when regenerating the file and be left with essentially an empty file. Christian -- /"\ \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \
[sqlite] Why is 'database schema has changed' being reported?
Hello, This happens with SQLite 3.0.3 on Mac OS X 10.3.4. I'm issuing a simple 'SELECT * FROM people' on my database. When I reach 'sqlite3VdbeExec', it falls on the following error: if( rc==SQLITE_OK && iMeta!=pOp->p2 ){ sqlite3SetString(>zErrMsg, "database schema has changed", (char*)0); rc = SQLITE_SCHEMA; } In my code, I execute the query like this: int result = sqlite3_prepare(db, query, strlen(query), &_vm, _tail); I get SQLITE_OK back. '_vm' is also set. Then I call: result = sqlite3_step(_vm); and I get result == 1. The error string tells me "database schema has changed". The weird thing is that if I inspect the database, all records in the people table are there! What's going on? Any ideas? Thanks, -- Tito smime.p7s Description: S/MIME cryptographic signature
Re: [sqlite] Compiling Linux SQLite with thread safe
Corwin Burgess wrote: I'm looking for some help in compiling a Linux version of SQLite v2.8.15 that is thread safe capable. Corwin I've decided to compile a Linux sqlite library using the sqlite-source-2_8_15.zip file with the Fedora Core 1 distro. I created the following directory structure for this purpose. /sqlite-source /bld Makefile /sqlite main.mk VERSION /src source files from sqlite-source-2_8_15.zip sqlite.in.h parse.y /tool I used the Makefile.Linux-gcc file, modified it to add threadsafe and removed tcl capability. I ran 'make' from the /bld directory and each time I had an error I added the missing file or directory. With the above changes I had no errors but this didn't create the './lib' directory or sqlite library. In the /bld directory I have the 'sqlite' executable and 'libsqlite.a' ar archive files. What did I fail to do to create the sqlite library? Corwin
Re: [sqlite] Compiling sqlite3.0.3 on dec-osf1 with gcc 3.04 failed
I added `-DUINTPTR_TYPE=u64' to the TCC line of the Makefile but it does not help either! [EMAIL PROTECTED]:/project/amphioxus/src/sqlite-3.0.3/build> gmake clean all rm -f *.lo *.la *.o sqlite3 libsqlite3.la rm -f sqlite3.h opcodes.* rm -rf .libs .deps rm -f lemon lempar.c parse.* sqlite*.tar.gz rm -f rm -f *.da *.bb *.bbg gmon.out rm -f testfixture test.db rm -rf doc rm -f common.tcl rm -f sqlite3.dll sqlite3.lib sed -e s/--VERS--/`cat ../sqlite/VERSION`/ \ ../sqlite/src/sqlite.h.in >sqlite3.h echo '/* Automatically generated file. Do not edit */' >opcodes.h grep '^case OP_' ../sqlite/src/vdbe.c | \ sed -e 's/://' | \ awk '{printf "#define %-30s %3d\n", $2, ++cnt}' >>opcodes.h gcc -g -O2 -o lemon ../sqlite/tool/lemon.c cp ../sqlite/tool/lempar.c . cp ../sqlite/src/parse.y . ./lemon parse.y ./libtool --mode=compile gcc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -DUINTPTR_TYPE=u64 -I. -I../sqlite/src -DNDEBUG -c ../sqlite/src/attach.c gcc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -DUINTPTR_TYPE=u64 -I. -I../sqlite/src -DNDEBUG -c ../sqlite/src/attach.c -o attach.o In file included from ../sqlite/src/attach.c:16: ../sqlite/src/sqliteInt.h:129: parse error before "uptr" ../sqlite/src/sqliteInt.h:129: warning: data definition has no type or storage class gmake: *** [attach.lo] Error 1 >Detlef Groth wrote: >> Hello, >> >> I could recently compile the sqlite2.x code without problems but now I can't >> compile the the 3.0.3 branch. >> >> The main problem is in: >> sqliteInt.h:129: parse error before "uptr" >> sqliteInt.h:129: warning: data definition has no type or storage class >> >Try adding '-DUINTPTR_TYPE=u64' to the compiler command line. Please let me know if that helps. >-- >D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565 -- Dr. Detlef Groth dgroth at gmx.de