Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)
The precompiled version did work. I was just trying to compile it myself to get experience building a linux box. Lloyd - Original Message - From: <[EMAIL PROTECTED]> To:Sent: Tuesday, January 03, 2006 1:29 PM Subject: Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list) "Lloyd Thomas" <[EMAIL PROTECTED]> wrote: Thanks Kimball Your right about having a little experience. I am just running into error after error installing apps, but I'm learnoing slowly. Anyway, I was trying to install the sqlite support for another application I want to use and as a side issue it seems to have installed sqlite 3.2.8 correctly for me. It would be good if I could type sqlite3 at the prompt and it would just start. Did the precompiled binary on the website not work for you? http://www.sqlite.org/download.html -- D. Richard Hipp <[EMAIL PROTECTED]>
RE: [sqlite] LIMIT keyword does work in an UPDATE statement
Dennis, it works perfectly well, so thank you for your quick and relevant solution. test mjom <[EMAIL PROTECTED]> a écrit : Hi, i'm beginning with SQLite and it seems that the keyword LIMIT is not supported on an UPDATE statement. Does anybody would have a workaround to update only the very first row matching the search criteria ? Ex : create table tbl1 ( id integer primary key autoincrement, ref integer, sts varchar(16)); insert into tbl1 (ref,sts) values (10, 'ready' ); insert into tbl1 (ref,sts) values (20, 'ready' ); insert into tbl1 (ref,sts) values (30, 'ready' ); update tbl1 set sts='busy' where sts='ready' ORDER BY ref DESC LIMIT 1; => i would like to have only the third record (30,'busy') updated. Thank's in advance. - Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.Téléchargez la version beta. - Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.Téléchargez la version beta.
Re: [sqlite] LIMIT keyword does work in an UPDATE statement
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > On Tue, Jan 03, 2006 at 10:15:17AM -0500, [EMAIL PROTECTED] wrote: >> test mjom <[EMAIL PROTECTED]> writes: >> >> > create table tbl1 ( id integer primary key autoincrement, ref >> > integer, sts varchar(16)); >> > insert into tbl1 (ref,sts) values (10, 'ready' ); >> > insert into tbl1 (ref,sts) values (20, 'ready' ); insert into tbl1 >> > (ref,sts) values (30, 'ready' ); >> > update tbl1 set sts='busy' where sts='ready' ORDER BY ref DESC LIMIT 1; >> > >> > => i would like to have only the third record (30,'busy') updated. >> >> How about something like >> >> UPDATE tbl1 >> SET sts = 'busy' >> WHERE ref = >> (SELECT ref >> FROM tbl1 >> WHERE sts = 'ready' >> ORDER BY ref DESC >> LIMIT 1); > > That won't work. Instead: > > UPDATE ... > WHERE id = > (SELECT id > FROM tbl1 > WHERE ... > ); Yeah, what he said. :-) Duh! Sorry about that. Derrell
Re: [sqlite] LIMIT keyword does work in an UPDATE statement
test mjom wrote: Hi, i'm beginning with SQLite and it seems that the keyword LIMIT is not supported on an UPDATE statement. Does anybody would have a workaround to update only the very first row matching the search criteria ? Ex : create table tbl1 ( id integer primary key autoincrement, ref integer, sts varchar(16)); insert into tbl1 (ref,sts) values (10, 'ready' ); insert into tbl1 (ref,sts) values (20, 'ready' ); insert into tbl1 (ref,sts) values (30, 'ready' ); update tbl1 set sts='busy' where sts='ready' ORDER BY ref DESC LIMIT 1; => i would like to have only the third record (30,'busy') updated. I should clarify that my SQL is slightly different than Darrel's. By using the primary key, which is guaranteed to be unique, I am certain that only one record will be updated. Darrel's statement will update all the records that have the same value in the ref column. This is not necessarily the same thing. Dennis Cote
Re: [sqlite] LIMIT keyword does work in an UPDATE statement
On Tue, Jan 03, 2006 at 10:15:17AM -0500, [EMAIL PROTECTED] wrote: > test mjom <[EMAIL PROTECTED]> writes: > > > create table tbl1 ( id integer primary key autoincrement, ref > > integer, sts varchar(16)); > > insert into tbl1 (ref,sts) values (10, 'ready' ); > > insert into tbl1 (ref,sts) values (20, 'ready' ); insert into tbl1 > > (ref,sts) values (30, 'ready' ); > > update tbl1 set sts='busy' where sts='ready' ORDER BY ref DESC LIMIT 1; > > > > => i would like to have only the third record (30,'busy') updated. > > How about something like > > UPDATE tbl1 > SET sts = 'busy' > WHERE ref = > (SELECT ref > FROM tbl1 > WHERE sts = 'ready' > ORDER BY ref DESC > LIMIT 1); That won't work. Instead: UPDATE ... WHERE id = (SELECT id FROM tbl1 WHERE ... ); -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.comwork: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
Re: [sqlite] LIMIT keyword does work in an UPDATE statement
test mjom wrote: Hi, i'm beginning with SQLite and it seems that the keyword LIMIT is not supported on an UPDATE statement. Does anybody would have a workaround to update only the very first row matching the search criteria ? Ex : create table tbl1 ( id integer primary key autoincrement, ref integer, sts varchar(16)); insert into tbl1 (ref,sts) values (10, 'ready' ); insert into tbl1 (ref,sts) values (20, 'ready' ); insert into tbl1 (ref,sts) values (30, 'ready' ); update tbl1 set sts='busy' where sts='ready' ORDER BY ref DESC LIMIT 1; => i would like to have only the third record (30,'busy') updated. Thank's in advance. - Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.Téléchargez la version beta. This should do the trick. Basically you use a select to find the id (i.e. the primary key) of the record to update, and then update that record only. update tbl1 set sts='busy' where id in (select id from tbl1 where sts='ready' order by ref desc limit 1); HTH Dennis Cote
Re: [sqlite] LIMIT keyword does work in an UPDATE statement
test mjom <[EMAIL PROTECTED]> writes: > create table tbl1 ( id integer primary key autoincrement, ref > integer, sts varchar(16)); > insert into tbl1 (ref,sts) values (10, 'ready' ); > insert into tbl1 (ref,sts) values (20, 'ready' ); insert into tbl1 > (ref,sts) values (30, 'ready' ); > update tbl1 set sts='busy' where sts='ready' ORDER BY ref DESC LIMIT 1; > > => i would like to have only the third record (30,'busy') updated. How about something like UPDATE tbl1 SET sts = 'busy' WHERE ref = (SELECT ref FROM tbl1 WHERE sts = 'ready' ORDER BY ref DESC LIMIT 1); Derrell
[sqlite] 3.2.7 test failure
Hi, I've downloaded the 3.2.7 source and built it (on windows). Then I run the tcl test suite and got the following errors: malloc-10.105... Error: table abc already exists malloc-10.106... Error: table abc already exists malloc-10.107... Error: table abc already exists ... ... Error: table abc already exists malloc-10.1082... Error: table abc already exists malloc-10.1083... Error: table abc already exists malloc-10.1084... Error: table abc already exists malloc-10.1085... Error: table abc already exists Does someone have a clue what can be the problem ? Thanks, Avner
Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)
"Lloyd Thomas" <[EMAIL PROTECTED]> wrote: > Thanks Kimball > Your right about having a little experience. I am > just running into error after error installing apps, but I'm learnoing > slowly. Anyway, I was trying to install the sqlite support for another > application I want to use and as a side issue it seems to have installed > sqlite 3.2.8 correctly for me. It would be good if I could type sqlite3 at > the prompt and it would just start. > Did the precompiled binary on the website not work for you? http://www.sqlite.org/download.html -- D. Richard Hipp <[EMAIL PROTECTED]>
Re: [sqlite] undelete records?
Kimball Larsen <[EMAIL PROTECTED]> wrote: > I have an sqlite 2.1 format database file with records in it that > have been marked deleted (I believe the term for this is that their > pages are on the freelist) > Is there any simple way to get these records back? Or are they gone > forever? > Autovacuum was not on, and with a hex editor I can see portions of > the records we need to recover. > Important meta information has been lost. Your records are gone forever. -- D. Richard Hipp <[EMAIL PROTECTED]>
Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)
Lloyd Thomas wrote: > > Thanks Kimball > Your right about having a little experience. I am > just running into error after error installing apps, but I'm learnoing > slowly. Anyway, I was trying to install the sqlite support for another > application I want to use and as a side issue it seems to have installed > sqlite 3.2.8 correctly for me. It would be good if I could type sqlite3 at > the prompt and it would just start. > Hello Lloyd, you mean the sqlite3 command-line utility? Well, if all else fails, try it with a small script that you can put in a directory within your path: --- # Run command-line utility sqlite3 # export LD_LIBRARY_PATH=/your/install/dir/lib:$LD_LIBRARY_PATH export PATH=/your/install/dir/bin:$PATH sqlite3 --- (Store this in a convenient file like "mysqlite" and use: chmod +x mysqlite to make it executable) The environment variables LD_LIBRARY_PATH and PATH are changed locally. So as soon as you leave the utility and thus the script, you go back to the original environment. Regards, Arjen
Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)
Thanks Kimball Your right about having a little experience. I am just running into error after error installing apps, but I'm learnoing slowly. Anyway, I was trying to install the sqlite support for another application I want to use and as a side issue it seems to have installed sqlite 3.2.8 correctly for me. It would be good if I could type sqlite3 at the prompt and it would just start. Lloyd - Original Message - From: "Arjen Markus" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 03, 2006 7:51 AM Subject: Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list) Lloyd Thomas wrote: There does not seem to be a library file in /usr/lib/ called libsqlite3.so.0. would that be the problem. Please bear with me I am a linux newbie. Hello Lloyd, my reply may be a bit too detailed, but I assume you have very little experience with Linux/UNIX. So bare with me if the explanations are too basic. What about /usr/local/lib? That is the usual place for packages/libraries that are not part of the operating system. You can print the current setting of LD_LIBRARY_PATH by typing: echo $LD_LIBRARY_PATH on the prompt. It is a list of directories that the loader/linker will look at in search of shared objects. The sqlite3 library must be contained in any of these. If you find it in a different directory not listed there, you need to set LD_LIBRARY_PATH: export LD_LIBRARY_PATH=/your/new/directory:$LD_LIBRARY_PATH or: setenv LD_LIBRARY_PATH /your/new/directory:$LD_LIBRARY_PATH (Presumably the first, the second form is specific to the C-shell, and you probably have "bash".) What directory (the prefix option) did you use for installing SQLite? That is the directory where the library will live in (or in the subdirectory "lib" of that directory). Hope this helps. Regards, Arjen