Re: [sqlite] any way to find out how many current connections to db?

2007-08-12 Thread John Stanton
Try using lsof. Chase wrote: is there any way (in c/c++) to find out how many current connections there are to a database that i am connected to? i'd like to do some housekeeping on the database every so often, but only if there's no one else connected to it at the time. any ideas? thank

Re: [sqlite] Help with performance...

2007-08-12 Thread Joe Wilson
Forget about the alternate insert statements I suggested. Assuming "id" is declared INTEGER PRIMARY KEY in all tables, you can't get better performance than this in a single insert statement: insert into x select x1.* from a.x x1, y where x1.id = y.id;

Re: [sqlite] Help with performance...

2007-08-12 Thread Ken
Joe, Yes I have temp_store = memory... I think during the compilation of the library. I don't think I need the order by clause but I'll try it just to see if it helps... The original table is created and stored in sorted order so just a plain select returns sorted rows. I'll

Re: [sqlite] Trying to link static library from my embedded application

2007-08-12 Thread Daniel Berenguer
Thanks Joe!! It works now!! Daniel. On Sun, 2007-08-12 at 09:56 -0700, Joe Wilson wrote: > You probably have another shared sqlite library in your path somewhere. > > Explicitly link with /absolute/directory/to/your/libsqlite.a rather than > -lsqlite. > > --- Daniel Berenguer <[EMAIL PROTECTED]

Re: [sqlite] Help with performance...

2007-08-12 Thread Joe Wilson
--- Joe Wilson <[EMAIL PROTECTED]> wrote: > This should be faster: > > insert into x > select * from a.x x1 > where exists (select 1 from Y where x1.id = y.id); > > See if adding an order by statement will make it faster by speeding > up the inserts: > > insert into x > select * from a

Re: [sqlite] Help with performance...

2007-08-12 Thread Joe Wilson
This should be faster: insert into x select * from a.x x1 where exists (select 1 from Y where x1.id = y.id); See if adding an order by statement will make it faster by speeding up the inserts: insert into x select * from a.x x1 where exists (select 1 from Y where x1.id = y.id) orde

Re: [sqlite] Trying to link static library from my embedded application

2007-08-12 Thread Joe Wilson
You probably have another shared sqlite library in your path somewhere. Explicitly link with /absolute/directory/to/your/libsqlite.a rather than -lsqlite. --- Daniel Berenguer <[EMAIL PROTECTED]> wrote: > I've downloaded the sqlite-2.8.17 source code in order to create my own > static library for

Re: [sqlite] Help with performance...

2007-08-12 Thread Ken
Joe, Thanks for the reply. The id field is also the Primary Key and no other indices exist. I've run the explan query plan and they seem optimal, reading table X, and using an index access into Z. I just had a thought. It seems to me that doing the insert into X select from

[sqlite] Trying to link static library from my embedded application

2007-08-12 Thread Daniel Berenguer
Hi all, I've downloaded the sqlite-2.8.17 source code in order to create my own static library for my embedded platform (OpenSlug) source code package: sqlite-source-2_8_17.zip Ok, I get to cross-compile the static library (libsqlite.a) using this simple makefile: include ../Makefile_opnode.in

Re: [sqlite] Query has problems with string that looks like a number

2007-08-12 Thread Christopher Backhouse
OK, that fixes it on the commandline. Now to figure out how to link against the new version... Joe Wilson wrote: Time to upgrade. --- Christopher Backhouse <[EMAIL PROTECTED]> wrote: I repeated exactly what you have there and confirm it doesn't work for me. [EMAIL PROTECTED]:/tmp$ sqlite3 te

Re: [sqlite] Query has problems with string that looks like a number

2007-08-12 Thread Joe Wilson
Workaround for 3.3.13: select distinct bar, baz as z from foo where bar in (( select bar from foo where baz==z order by length(bar) desc limit 1 )); It's just different enough to prevent sqlite 3.3.13 from choking on the "order by" clause in the "in" subquery. --- Christopher Backhouse <[EM

Re: [sqlite] Query has problems with string that looks like a number

2007-08-12 Thread Joe Wilson
Time to upgrade. --- Christopher Backhouse <[EMAIL PROTECTED]> wrote: > I repeated exactly what you have there and confirm it doesn't work for me. > > [EMAIL PROTECTED]:/tmp$ sqlite3 testing > SQLite version 3.3.13 > Enter ".help" for instructions > sqlite> CREATE TABLE foo(bar text, baz text); >

Re: [sqlite] Query has problems with string that looks like a number

2007-08-12 Thread Christopher Backhouse
I repeated exactly what you have there and confirm it doesn't work for me. [EMAIL PROTECTED]:/tmp$ sqlite3 testing SQLite version 3.3.13 Enter ".help" for instructions sqlite> CREATE TABLE foo(bar text, baz text); sqlite> INSERT INTO "foo" VALUES('123','345'); sqlite> INSERT INTO "foo" VALUES('12

Re: [sqlite] Query has problems with string that looks like a number

2007-08-12 Thread Joe Wilson
--- Christopher Backhouse <[EMAIL PROTECTED]> wrote: > I have a table: > create table foo(bar text,baz text); > > I want to produce a list of all bar's paired with the longest baz they > are ever associated with. I came up with the following query: > > select distinct bar,baz as z from foo where

[sqlite] Query has problems with string that looks like a number

2007-08-12 Thread Christopher Backhouse
I have a table: create table foo(bar text,baz text); I want to produce a list of all bar's paired with the longest baz they are ever associated with. I came up with the following query: select distinct bar,baz as z from foo where bar in (select bar from foo where baz==z order by length(bar) d

[sqlite] Re: ATTACH/DETACH DATABASE

2007-08-12 Thread Igor Tandetnik
Igor Mironchick <[EMAIL PROTECTED]> wrote: If I attach database "db_attached" into "db" and then close "db". After opening "db" does I need to attach "db_attached" again or this attachment was stored??? Attachment is a property of database connection, it is not reflected in the physical databa

[sqlite] ATTACH/DETACH DATABASE

2007-08-12 Thread Igor Mironchick
Hi, guys. If I attach database "db_attached" into "db" and then close "db". After opening "db" does I need to attach "db_attached" again or this attachment was stored??? -- Regards, Igor Mironchick, Intervale © #ICQ 492-597-570 ---

Re: [sqlite] sqlite3 datatype

2007-08-12 Thread yahoo
On 11 Aug, Gerry Snyder wrote: > fred238 wrote: >> Gerry Snyder a écrit : >>> fred238 wrote: Is necessary to set column datatype in sqlite3 ? Is better to use class storage in sqlite3 (TEXT, NUMERIC, INTEGER, REAL, NONE) ? >>> Check out http://www.sqlite.org/datatype3.html and