Re: [sqlite] 'dump' from the C API
--- Keith Godfrey <[EMAIL PROTECTED]> wrote: > Does anyone know how to do a database dump from the C API? I'm linking > to sqlite3.o (the amalgamated file) and was hoping to open a database > and dump the contents to an sql file. > > I know this can be done from the shell, but as of yet, I can't get the > shell running on AIX. Can you compress the sqlite db file and ftp it to linux for further processing? Or if you have java on the AIX machine you could run this pure java sqlite3 shell: http://sqlite.org/contrib/download/sqlite-java-shell-3.4.0.zip?get=19 java -jar sqlite3i.jar -batch your.db .dump Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV. http://tv.yahoo.com/ - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: 'dump' from the C API
Keith Godfrey <[EMAIL PROTECTED]> wrote: Does anyone know how to do a database dump from the C API? I'm linking to sqlite3.o (the amalgamated file) and was hoping to open a database and dump the contents to an sql file. The code to sqlite3 command line utility is provided. You can see how it's done there. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] 'dump' from the C API
Hello, Does anyone know how to do a database dump from the C API? I'm linking to sqlite3.o (the amalgamated file) and was hoping to open a database and dump the contents to an sql file. I know this can be done from the shell, but as of yet, I can't get the shell running on AIX. Thanks in advance, Keith - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] troubles w/ sqlite on AIX 5.3
Greetings, I need to compile and run a program on an AIX box and then get the data back onto a linux machine for processing. I'm using sqlite3 as an embedded database (excellent software, btw). Unfortunately, this "easy" task has proved a tad bit complicated. Compiling the regular 3.5.1 source code gave me a fatal error. ./libtool --mode=link xlc -q32 -qarch=pwr4 -qlonglong -D_LARG_FILE=1 -D_LARGE_FILES=1 -DUSE_TCL_STUBS=1 -O2 -DOS_UNIX=1 -DOS_WIN=0 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -o . libtool: link: unable to infer tagged configuration libtool: link: specify a tag with `--tag' make: 1254-004 The error code from the last command is 1. This error is from IBM's compiler 'xlc' - the errors from compiling w/ gcc are quite different and are at the end of the message (in short, gcc choked on the file tclsqlite.c). Might anybody have an idea on how to resolve this? I need the command line tool 'sqlite3' on AIX, hence the need to compile the source. Somewhat relatedly, the amalgamation also has problems on AIX. It works running inside a simple program compiled w/ gcc, but I get an out-of-memory error when I run the same program compiled w/ 'xlc'. This can be fixed by turning off all optimization in xlc. This suggests it's an IBM bug, but it seems a bit weird. Any ideas on resolving the general AIX build problem will be greatly appreciated. Thanks in advance, Keith --- compile error of 3.5.1 using gcc: /libtool --mode=compile --tag=CC gcc -g -O2 -I. -I./src -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -c ./src/tclsqlite.c gcc -g -O2 -I. -I./src -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -c ./src/tclsqlite.c -DPIC -o .libs/tclsqlite.o src/tclsqlite.c:285: warning: initialization from incompatible pointer type src/tclsqlite.c:295: warning: excess elements in struct initializer src/tclsqlite.c:295: warning: (near initialization for `IncrblobChannelType') src/tclsqlite.c: In function `DbUpdateHandler': src/tclsqlite.c:580: warning: passing arg 3 of `Tcl_ListObjAppendElement' makes pointer from integer without a cast src/tclsqlite.c: In function `tclSqlFunc': src/tclsqlite.c:666: warning: passing arg 1 of `Tcl_NewByteArrayObj' discards qualifiers from pointer target type src/tclsqlite.c:674: warning: assignment makes pointer from integer without a cast src/tclsqlite.c:732: error: `Tcl_WideInt' undeclared (first use in this function) src/tclsqlite.c:732: error: (Each undeclared identifier is reported only once src/tclsqlite.c:732: error: for each function it appears in.) src/tclsqlite.c:732: error: parse error before "v" src/tclsqlite.c:733: error: `v' undeclared (first use in this function) src/tclsqlite.c: In function `DbObjCmd': src/tclsqlite.c:937: warning: passing arg 3 of `Tcl_GetIndexFromObj' from incompatible pointer type src/tclsqlite.c:1589: warning: passing arg 2 of `Tcl_GetVar2Ex' discards qualifiers from pointer target type src/tclsqlite.c:1613: error: `Tcl_WideInt' undeclared (first use in this function) src/tclsqlite.c:1613: error: parse error before "v" src/tclsqlite.c:1614: error: `v' undeclared (first use in this function) src/tclsqlite.c:1663: warning: passing arg 1 of `Tcl_NewByteArrayObj' discards qualifiers from pointer target type src/tclsqlite.c:1671: warning: assignment makes pointer from integer without a cast src/tclsqlite.c:1951: error: parse error before "rowid" src/tclsqlite.c:1956: error: `rowid' undeclared (first use in this function) src/tclsqlite.c:2172: warning: passing arg 3 of `Tcl_GetIndexFromObj' from incompatible pointer type src/tclsqlite.c: In function `DbMain': src/tclsqlite.c:2345: warning: passing arg 2 of `Tcl_TranslateFileName' discards qualifiers from pointer target type src/tclsqlite.c:2377: warning: passing arg 2 of `Tcl_CreateObjCommand' discards qualifiers from pointer target type make: 1254-004 The error code from the last command is 1. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] any way to SELECT the 100th-104th row of a table?
At 3:00 PM -0700 10/7/07, Adam Megacz wrote: Hello. This is probably a stupid question, but... Is there any way to include some phrase in a SELECT clause that will match only the Nth-Mth rows of a table, for some values of N and M? Note that ROWID isn't what I'm looking for -- if you delete rows from a table the ROWID no longer matches the "row number". SELECT * FROM table LIMIT 120 OFFSET 100; http://sqlite.org/lang_select.html "The LIMIT clause places an upper bound on the number of rows returned in the result. A negative LIMIT indicates no upper bound. The optional OFFSET following LIMIT specifies how many rows to skip at the beginning of the result set. In a compound query, the LIMIT clause may only appear on the final SELECT statement. The limit is applied to the entire query not to the individual SELECT statement to which it is attached." -pmb - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] any way to SELECT the 100th-104th row of a table?
select * from table limit (n-1),(m-n) n-1 because it is 0-based http://www.sqlite.org/lang_select.html On 10/8/07, Adam Megacz <[EMAIL PROTECTED]> wrote: > > Hello. This is probably a stupid question, but... > > Is there any way to include some phrase in a SELECT clause that will > match only the Nth-Mth rows of a table, for some values of N and M? > > Note that ROWID isn't what I'm looking for -- if you delete rows from > a table the ROWID no longer matches the "row number". > > Thanks, > > - a > > -- > PGP/GPG: 5C9F F366 C9CF 2145 E770 B1B8 EFB1 462D A146 C380 > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] any way to SELECT the 100th-104th row of a table?
"LIMIT 4 OFFSET 100" at the end of the select. On 10/7/07, Adam Megacz <[EMAIL PROTECTED]> wrote: > > Hello. This is probably a stupid question, but... > > Is there any way to include some phrase in a SELECT clause that will > match only the Nth-Mth rows of a table, for some values of N and M? > > Note that ROWID isn't what I'm looking for -- if you delete rows from > a table the ROWID no longer matches the "row number". > > Thanks, > > - a > > -- > PGP/GPG: 5C9F F366 C9CF 2145 E770 B1B8 EFB1 462D A146 C380 > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - > > -- Cory Nelson http://www.int64.org - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] any way to SELECT the 100th-104th row of a table?
The only way I can think of doing it without modifying the table (i.e. adding a rowid column that's updated on every delete) is to select all the rows on the table and then increment count for every step that returns a row. Adam Megacz wrote: Hello. This is probably a stupid question, but... Is there any way to include some phrase in a SELECT clause that will match only the Nth-Mth rows of a table, for some values of N and M? Note that ROWID isn't what I'm looking for -- if you delete rows from a table the ROWID no longer matches the "row number". Thanks, - a - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] any way to SELECT the 100th-104th row of a table?
Hello. This is probably a stupid question, but... Is there any way to include some phrase in a SELECT clause that will match only the Nth-Mth rows of a table, for some values of N and M? Note that ROWID isn't what I'm looking for -- if you delete rows from a table the ROWID no longer matches the "row number". Thanks, - a -- PGP/GPG: 5C9F F366 C9CF 2145 E770 B1B8 EFB1 462D A146 C380 - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: Callback fonction really not flexible to use
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 07 October 2007 17:39 To: sqlite-users@sqlite.org Subject: Re: [sqlite] Re: Callback fonction really not flexible to use Igor Tandetnik a écrit : [EMAIL PROTECTED] wrote: Here a sample (in c) of the use i would like to do with sqlite fucntion1() call fonction2() where is sqlite3_exec() Callback function is the function3() and i would like to add data in an array, which is retuned to function1() after the call of function(2). How i can do that ? does the Callback function can return something else than an int ? A callback function must return 0. Any non-zero return value is an error indicator. However, the callback can, and usually does, have side effects. The void* parameter you pass to sqlite3_exec is passed through to the callback. Normally, this points to some kind of a data structure that the callback modifies. Having said that, be aware that sqlite3_exec is retained for backward compatibility only. It is highly recommended for new code to use API like sqlite3_prepare, sqlite3_step, sqlite3_finalize, sqlite3_column_* to iterate over the resultset. In fact, sqlite3_exec itself is implemented entirely in terms of these public API functions. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] - Thanks for your answer, Is there somewhere an snipet code to read a db in C with "sqlite3_step, sqlite3_finalize, sqlite3_column_*" In the official doc, there is only the call to the sqlite3_exec() function. Mike Marshall a écrit : Here's something from some code I was working on this morning that hopefully will help sqlite3_stmt* pStatement; char* acQuery = sqlite3_mprintf("SELECT feedurl FROM feeds WHERE pageurl = '%q'",sUrl.c_str()); int nError = sqlite3_prepare_v2(m_pDB,acQuery,-1,&pStatement,NULL); while (nError == SQLITE_OK && sqlite3_step(pStatement) == SQLITE_ROW) { string sFeed = (char*)sqlite3_column_text(pStatement,0); } sqlite3_finalize(pStatement); sqlite3_free(acQuery); Thanks you very much that helped me ! it seem to work fine and thats really better than that satanas vade retro calback function. Fred. - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] Re: Callback fonction really not flexible to use
Here's something from some code I was working on this morning that hopefully will help sqlite3_stmt* pStatement; char* acQuery = sqlite3_mprintf("SELECT feedurl FROM feeds WHERE pageurl = '%q'",sUrl.c_str()); int nError = sqlite3_prepare_v2(m_pDB,acQuery,-1,&pStatement,NULL); while (nError == SQLITE_OK && sqlite3_step(pStatement) == SQLITE_ROW) { string sFeed = (char*)sqlite3_column_text(pStatement,0); } sqlite3_finalize(pStatement); sqlite3_free(acQuery); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 07 October 2007 17:39 To: sqlite-users@sqlite.org Subject: Re: [sqlite] Re: Callback fonction really not flexible to use Igor Tandetnik a écrit : > [EMAIL PROTECTED] wrote: >>Here a sample (in c) of the use i would like to do with sqlite >>fucntion1() call fonction2() where is sqlite3_exec() >>Callback function is the function3() and i would like to add data >>in an array, which is retuned to function1() after the call of >> function(2). >>How i can do that ? does the Callback function can return >> something else than an int ? > > A callback function must return 0. Any non-zero return value is an error > indicator. > > However, the callback can, and usually does, have side effects. The > void* parameter you pass to sqlite3_exec is passed through to the > callback. Normally, this points to some kind of a data structure that > the callback modifies. > > > Having said that, be aware that sqlite3_exec is retained for backward > compatibility only. It is highly recommended for new code to use API > like sqlite3_prepare, sqlite3_step, sqlite3_finalize, sqlite3_column_* > to iterate over the resultset. In fact, sqlite3_exec itself is > implemented entirely in terms of these public API functions. > > Igor Tandetnik > > - > > To unsubscribe, send email to [EMAIL PROTECTED] > - > > > > Thanks for your answer, Is there somewhere an snipet code to read a db in C with "sqlite3_step, sqlite3_finalize, sqlite3_column_*" In the official doc, there is only the call to the sqlite3_exec() function. - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: Callback fonction really not flexible to use
Igor Tandetnik a écrit : [EMAIL PROTECTED] wrote: Here a sample (in c) of the use i would like to do with sqlite fucntion1() call fonction2() where is sqlite3_exec() Callback function is the function3() and i would like to add data in an array, which is retuned to function1() after the call of function(2). How i can do that ? does the Callback function can return something else than an int ? A callback function must return 0. Any non-zero return value is an error indicator. However, the callback can, and usually does, have side effects. The void* parameter you pass to sqlite3_exec is passed through to the callback. Normally, this points to some kind of a data structure that the callback modifies. Having said that, be aware that sqlite3_exec is retained for backward compatibility only. It is highly recommended for new code to use API like sqlite3_prepare, sqlite3_step, sqlite3_finalize, sqlite3_column_* to iterate over the resultset. In fact, sqlite3_exec itself is implemented entirely in terms of these public API functions. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] - Thanks for your answer, Is there somewhere an snipet code to read a db in C with "sqlite3_step, sqlite3_finalize, sqlite3_column_*" In the official doc, there is only the call to the sqlite3_exec() function. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SELECT crashes with small cache?
--- Joe Wilson <[EMAIL PROTECTED]> wrote: > --- Richard Klein <[EMAIL PROTECTED]> wrote: > > I am seeing SQLite crashing during execution > > of a SELECT statement when I make the page > > cache very small (40 pages). > > > > When I bump the cache up to 50 pages, the > > problem goes away. > > > > The problem only occurs on my RISC platform, > > not on my x86-based platform. Also, I am > > using SQLite 2 (not 3). > > I've never used the sqlite2 library, so I can't comment on that. It seems that I did test against sqlite 2.x once before: http://www.mail-archive.com/sqlite-users@sqlite.org/msg16450.html There is more to consider other than just code size when trying to minimize memory usage. SQLite3 used 1/4 of the memory (temp store) as SQLite2 in a large bulk insert transaction. You have to test to see what works best for your application. Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: Callback fonction really not flexible to use
[EMAIL PROTECTED] wrote: Here a sample (in c) of the use i would like to do with sqlite fucntion1() call fonction2() where is sqlite3_exec() Callback function is the function3() and i would like to add data in an array, which is retuned to function1() after the call of function(2). How i can do that ? does the Callback function can return something else than an int ? A callback function must return 0. Any non-zero return value is an error indicator. However, the callback can, and usually does, have side effects. The void* parameter you pass to sqlite3_exec is passed through to the callback. Normally, this points to some kind of a data structure that the callback modifies. Having said that, be aware that sqlite3_exec is retained for backward compatibility only. It is highly recommended for new code to use API like sqlite3_prepare, sqlite3_step, sqlite3_finalize, sqlite3_column_* to iterate over the resultset. In fact, sqlite3_exec itself is implemented entirely in terms of these public API functions. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Callback fonction really not flexible to use
hello, Here a sample (in c) of the use i would like to do with sqlite fucntion1() call fonction2() where is sqlite3_exec() Callback function is the function3() and i would like to add data in an array, which is retuned to function1() after the call of function(2). How i can do that ? does the Callback function can return something else than an int ? - To unsubscribe, send email to [EMAIL PROTECTED] -