Re: [sqlite] Distinguishing between sqlite3_stmts

2008-11-07 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dan wrote: >> http://www.sqlite.org/cvstrac/tktview?tn=3483 > > Are there advantages to implementing this internally instead of > externally? Firstly there is an advantage to having a statement cache. I use a benchmark based on

Re: [sqlite] .dump often fails silently

2008-11-07 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 raf wrote: >> printing error messages to stderr rather than ignoring >> them shoulden't require an overhaul. It does though. You need to fix every place where an error can be detected and take an appropriate action. One extra printf is not the

Re: [sqlite] Finding rows not in second table?

2008-11-07 Thread Dan
On Nov 8, 2008, at 7:34 AM, BareFeet wrote: >>> I'd like to fetch all the rows in "code" that don't exist in >>> "companies": >>> >>> SELECT code.id FROM code,companies WHERE code.id IS NOT IN (SELECT >>> code FROM companies); >> >> select code.id from code >> where code.id not in (select code

Re: [sqlite] sqlite-users Digest, Vol 11, Issue 24

2008-11-07 Thread Igor Tandetnik
"Rick Pritchett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I understand about the different errors that sqlite returns I need to > know how to access them. What do you mean, access them? Your program calls sqlite3_step function. This function returns a value. Your program

Re: [sqlite] Distinguishing between sqlite3_stmts

2008-11-07 Thread Dan
On Nov 8, 2008, at 3:25 AM, Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Douglas E. Fajardo wrote: >> ( To the 'powers that be'... I wonder if some form of 'cache' for >> prepared statements might be built in to the 'sqlite3_prepare*' >> functions as a

Re: [sqlite] sqlite-users Digest, Vol 11, Issue 24

2008-11-07 Thread Rick Pritchett
I understand about the different errors that sqlite returns I need to know how to access them. And I am curious how sqlite decides what transaction with a shared lock to process next. And when using the timeout command does the transaction continuously try to complete for the time the user

Re: [sqlite] sqlite-users Digest, Vol 11, Issue 24

2008-11-07 Thread Rick Pritchett
I understand about the different errors that sqlite returns I need to know how to access them. And I am curious how sqlite decides what transaction with a shared lock to process next. > Message: 6 > Date: Fri, 07 Nov 2008 12:09:05 -0600 > From: John Stanton <[EMAIL PROTECTED]> > Subject: Re:

Re: [sqlite] .dump often fails silently

2008-11-07 Thread raf
Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > raf wrote: > > the sqlite3 .dump command (version 3.4.2 and earlier) often fails > > silently. i.e. it produces a file containing nothing but: > > The code for the shell mostly just runs sqlite3_exec and often ignores >

Re: [sqlite] Finding rows not in second table?

2008-11-07 Thread BareFeet
>> I'd like to fetch all the rows in "code" that don't exist in >> "companies": >> >> SELECT code.id FROM code,companies WHERE code.id IS NOT IN (SELECT >> code FROM companies); > > select code.id from code > where code.id not in (select code from companies); A technically better (eg faster)

Re: [sqlite] Finding rows not in second table?

2008-11-07 Thread Gilles Ganault
On Fri, 7 Nov 2008 12:18:35 -0500, "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: >select code.id from code >where code.id not in (select code from companies); Thank you. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Summing without duplicating

2008-11-07 Thread BareFeet
Hi All, > I have three tables (simplified here): Invoices, Orders and Moves. > Each Invoice to a customer is for one or more products moved to them > (ie sold to them). Each one of those products is moved (ie bought) > from a supplier, incurring one or more Orders to satisfy each Invoice.

Re: [sqlite] How does sqlite return the status of the data base

2008-11-07 Thread Ribeiro, Glauber
It uses OS-level file locking. Read http://sqlite.org/atomiccommit.html Here's some more: http://sqlite.org/lockingv3.html Documentation page: http://sqlite.org/docs.html g -Original Message- From: Igor Tandetnik [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2008 2:14 PM

Re: [sqlite] How does sqlite return the status of the data base

2008-11-07 Thread Ribeiro, Glauber
It uses OS-level file locking. Read http://sqlite.org/atomiccommit.html g -Original Message- From: Igor Tandetnik [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2008 2:14 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] How does sqlite return the status of the data base

Re: [sqlite] Minimum write size on disk

2008-11-07 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > The atomic write size on the system file hosting my database is limited by > design to 32Kbyte. I want to verify that SQLite will never write more than > this amount. You can make your own VFS where you can return the

Re: [sqlite] sqlite3 for server (experience)

2008-11-07 Thread Ken
Marcus. Blocking reads during a write is how sqlite operates. Read the sqlite locking page: http://www.sqlite.org/lockingv3.html The biggest problem I have with the locking is getting a handle on the "spills to disk" portion. So rather than allowing sqlite to escalate the locking when it

Re: [sqlite] Distinguishing between sqlite3_stmts

2008-11-07 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Douglas E. Fajardo wrote: >( To the 'powers that be'... I wonder if some form of 'cache' for prepared > statements might be built in to the 'sqlite3_prepare*' functions as a > performance enhancement? ) I couldn't find an existing ticket so

Re: [sqlite] How does sqlite return the status of the data base

2008-11-07 Thread Igor Tandetnik
Rick Pritchett <[EMAIL PROTECTED]> wrote: > So how does it handle the transactions? Is it just however it > retrieves them What do you mean, "retrieves them"? Retrieves from where? > or just which notices that the DB is available? And > how does sql return the state its in to the proc? When

Re: [sqlite] How does sqlite return the status of the data base

2008-11-07 Thread Rick Pritchett
So how does it handle the transactions? Is it just however it retrieves them or just which notices that the DB is available? And how does sql return the state its in to the proc? > Message: 1 > Date: Fri, 7 Nov 2008 11:02:27 -0600 > From: "Ribeiro, Glauber" <[EMAIL PROTECTED]> > Subject: Re:

Re: [sqlite] prep'ed query ... LF function to returncolumn_isNull?? (fwd)

2008-11-07 Thread Igor Tandetnik
Rob Sciuk <[EMAIL PROTECTED]> wrote: > Ooops, it appears that sqlite3_column_type( smt, i ) returns > SQLITE_NULL iff the data are missing. Is this correct?? If by "data are missing" you mean "the column contains null value", then you are correct. Igor Tandetnik

Re: [sqlite] How does sqlite return the status of the data base?

2008-11-07 Thread John Stanton
Igor Tandetnik wrote: > I'm not sure I understand the question. What precisely do you mean by > "serialized queue"? > > Igor Tandetnik > Is it a repeated tautology? > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org >

Re: [sqlite] sqlite3 for server (experience)

2008-11-07 Thread John Stanton
Since the server is one process there is no need for Sqlite to use its sync capability derived for multiple processes and you can KISS by wrapping Sqlite in your own synhronization. The nice feature of a threaded application server using embedded Sqlite is that there is no interprocess

Re: [sqlite] copy tables between databases or join databases

2008-11-07 Thread P Kishor
On 11/7/08, baxy77bax <[EMAIL PROTECTED]> wrote: > > hi, > > well i need some help considering ways to copy files between databases or if > it is somehow possible to join several sqlite databases. i'm familiar with > perl modules that deal with sql databases but so far all transactions are >

[sqlite] copy tables between databases or join databases

2008-11-07 Thread baxy77bax
hi, well i need some help considering ways to copy files between databases or if it is somehow possible to join several sqlite databases. i'm familiar with perl modules that deal with sql databases but so far all transactions are too slow for ma project , so i'm looking for a way to just

Re: [sqlite] prep'ed query ... LF function to return column_isNull?? (fwd)

2008-11-07 Thread Rob Sciuk
> > I don't see in the documentation a function to return whether or not the > database value returned by the sqlite3_step() function is NULL. Surely there > should be such a beast, no? > > Something like: > int sqlite3_column_isNull( stmt, i ) ; > or even: > int

Re: [sqlite] prep'ed query ... LF function to returncolumn_isNull??

2008-11-07 Thread Igor Tandetnik
Rob Sciuk <[EMAIL PROTECTED]> wrote: > I don't see in the documentation a function to return whether or not > the database value returned by the sqlite3_step() function is NULL. > Surely there should be such a beast, no? sqlite3_column_type Igor Tandetnik

[sqlite] HELP: prep'ed query ... LF function to return column_isNull??

2008-11-07 Thread Rob Sciuk
I don't see in the documentation a function to return whether or not the database value returned by the sqlite3_step() function is NULL. Surely there should be such a beast, no? Something like: int sqlite3_column_isNull( stmt, i ) ; or even: int

Re: [sqlite] Distinguishing between sqlite3_stmts

2008-11-07 Thread Douglas E. Fajardo
If I am understanding you correctly, you are attempting to 'cache' prepared statements. My solution was to implement a wrapper function around the SQLITE3_PREPARE call function that stored pointers to the sql statement, the database handle, and the 'prepared' statement in a linked list. On

Re: [sqlite] How does sqlite return the status of the data base?

2008-11-07 Thread Ribeiro, Glauber
Do you mean "First come first serve"? In that case, I suppose not, since there is no server processed involved, to mediate access. -Original Message- From: Igor Tandetnik [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2008 10:44 AM To: sqlite-users@sqlite.org Subject: Re:

Re: [sqlite] Finding rows not in second table?

2008-11-07 Thread Igor Tandetnik
Gilles Ganault <[EMAIL PROTECTED]> wrote: > I'd like to fetch all the rows in "code" that don't exist in > "companies": > > SELECT code.id FROM code,companies WHERE code.id IS NOT IN (SELECT > code FROM companies); select code.id from code where code.id not in (select code from companies); Igor

[sqlite] Finding rows not in second table?

2008-11-07 Thread Gilles Ganault
Hello, This must be something very simple for experienced SQL/SQLite users, but I don't know how to write this query: I have two tables ("code" and "companies", with code.id being used as foreign key as companies.code). I'd like to fetch all the rows in "code" that don't exist in "companies":

Re: [sqlite] sqlite3 for server (experience)

2008-11-07 Thread Marcus Grimm
Ken wrote: > Marcus, > Ken, thanks for this. > I'm not using a "SERVER" but I do run a threaded application. might be the same, anyhow. > I'd suggest removing the cache and pragma for now. why? Do you see a problem with this ? (I did use them as a result of try and error and I'm not sure

Re: [sqlite] How does sqlite return the status of the data base?

2008-11-07 Thread Igor Tandetnik
Rick Pritchett <[EMAIL PROTECTED]> wrote: > What I would like to do is if the data base returns a busy or locked > status is to set up my proc to retry the write. Or can I take care > of this easier by setting a long timeout? And from what I read > timeout basically keeps retrying the write for

Re: [sqlite] How does sqlite return the status of the data base?

2008-11-07 Thread Marcus Grimm
from what I understood is that installing a busyhandler is equivalent to use a loop around your sqlite3_step() that tests against busy state. setting a timeout via sqlite3_busy_timeout works similar but doesn't allow to trace the busy states. please note that a LOCK state will not invoke the

Re: [sqlite] sqlite3 for server (experience)

2008-11-07 Thread Ken
Marcus, I'm not using a "SERVER" but I do run a threaded application. I'd suggest removing the cache and pragma for now. Here is what I do in my app to handle the "locking". Each thread creates it's own db connection. Then for any update/insert/delete type of transaction where sqlite will

[sqlite] How does sqlite return the status of the data base?

2008-11-07 Thread Rick Pritchett
What I would like to do is if the data base returns a busy or locked status is to set up my proc to retry the write. Or can I take care of this easier by setting a long timeout? And from what I read timeout basically keeps retrying the write for a specified amount of time. Is this correct? Or

[sqlite] (no subject)

2008-11-07 Thread Rick Pritchett
What I would like to do is if the data base returns a busy or locked status is to set up my proc to retry the write. Or can I take care of this easier by setting a long timeout? And from what I read timeout basically keeps retrying the write for a specified amount of time. Is this correct? Or

Re: [sqlite] sqlite3 for server (experience)

2008-11-07 Thread Marcus Grimm
John, thanks for the reply. you mean you do the synchronization by your selve rather than let it do sqlite internally ? Marcus John Stanton wrote: > We have been using such a server embadding Sqlite for some time with > success. We actually use pthreads exclusive and read only mutexes for >

Re: [sqlite] sqlite3 for server (experience)

2008-11-07 Thread John Stanton
We have been using such a server embadding Sqlite for some time with success. We actually use pthreads exclusive and read only mutexes for synchronization since all Sqlite access is threaded in the one process. JS Marcus Grimm wrote: > Hi all, > > a few weeks ago I discovered sqlite3 and

Re: [sqlite] Deadlock on SQLite

2008-11-07 Thread vlemaire
Hi, I've read that there is a compile option to unable connexion being thread-safe : http://www.sqlite.org/compile.html#threadsafe I guess also there could be problems if you have a not commited transaction pending while you are using another for write access, and/or a previous statement not

[sqlite] sqlite3 for server (experience)

2008-11-07 Thread Marcus Grimm
Hi all, a few weeks ago I discovered sqlite3 and found it extremely exiting and I decided to make an attempt to use it as a replacement for an access-based (via ODBC) database server. Our server is actually a quite simple application but using access via ODBC of course may run into serious

[sqlite] Minimum write size on disk

2008-11-07 Thread vlemaire
Hello, The atomic write size on the system file hosting my database is limited by design to 32Kbyte. I want to verify that SQLite will never write more than this amount. When I say "atomic write" it concerns calls to the pwrite function of standard library, with buffer size parameter set to up

Re: [sqlite] Delete based on timestamp very slow

2008-11-07 Thread Mohit Sindhwani
dbikash wrote: > However, the delete command "DELETE FROM table WHERE time < XXX" is very > slow (XXX is in time_t format). VACUUM is even slower. (I need to VACUUM > since I have a restriction on the database size.) My database has 1 million > records and is more than 100 MB in size. > Bikash,

[sqlite] Getting the size of a in-memory table somehow?

2008-11-07 Thread Christophe Leske
Hi, I asked this a couple of days ago and would still be interested to know if there is any chance, method or way to get the current size of an in-memory database. We are using a static DB as well as a temporary cache-DB in memory for which we would like to know the size in order to purge

[sqlite] Deadlock on SQLite

2008-11-07 Thread RanRan
Good day! I would just like to ask if SQLite transactions might result to a deadlock? Because I have this type of code snippet: [code] printf( "before sqlite3_prepare\n" ); sqlite3_prepare( ... ); printf( "after sqlite3_prepare" ); [/code] Then sometimes, when my program is executing, the