Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Alexander Batyrshin
I got it. Fixed my program with "IMMEDIATE" transaction. On Fri, Apr 25, 2008 at 12:01 AM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > "Alexander Batyrshin" <[EMAIL PROTECTED]> > wrote in message > news:[EMAIL PROTECTED] > > >> Dropping the read lock is the same as rolling back the > >>

[sqlite] Performance statistics?

2008-04-24 Thread Richard Klein
Does SQLite have a mechanism, in addition to the ANALYZE statement, for recording and dumping performance statistics? Thanks, - Richard Klein ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Igor Tandetnik
"Alexander Batyrshin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Dropping the read lock is the same as rolling back the >> transaction. The first process can, in fact, do this. And >> the second process is waiting for the first process to do >> this. But the first

Re: [sqlite] How to set memory usage as high as possible -- but not too high?

2008-04-24 Thread Ralf Junker
Jay A. Kreibich wrote: >> >Are you using a 32 bit or 64 bit process. >> >> 32, but it does not matter to the problem. > > When you give examples like "PRAGMA cache_size = 1000;", or 10M > pages which would take something on the order of 15 GB of memory to > service with the default 1K

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Alexander Batyrshin
> Dropping the read lock is the same as rolling back the > transaction. The first process can, in fact, do this. And > the second process is waiting for the first process to do > this. But the first process cannot do it automatically. The > application must issue a "COMMIT" or "ROLLBACK"

Re: [sqlite] How to execute the statment file using sqlite API

2008-04-24 Thread Dennis Cote
Joanne Pham wrote: > So I don't want to read the file into array and executes it. > I have the define the array of characters as below: > .output outputFile.mode csv select startTime, appName, appType, > isAppDeleted, remoteWXId; > but it didn't work. From the ".output" command above it

Re: [sqlite] Blob truncation

2008-04-24 Thread Dennis Cote
Vasil Boshnyakov wrote: > > It is not so effective to read the file twice - the first time to check the > compressed size and the second pass - to do the actual streaming in the > blob. That is what I am trying to avoid. Yes, I understand that, but SQLite is designed to store and retrieve

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread D. Richard Hipp
On Apr 24, 2008, at 7:42 AM, Alexander Batyrshin wrote: > I am not understand this example. First of all second process can't > promote exclusive lock from reserved. It should use intermediate > pending lock. It does go to pending. But it still cannot complete the transaction until it is able

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread John Stanton
If you are using processes you can sync them using a semaphore so that it automatically blocks. Alternatively do not use sqlite3_exec (it is an old interface) and instead use sqlite3_prepare ... sqlite3_step. If you get an SQLITE_BUSY returned by sqlite3_step then pause a hundred mS or so

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Alexander Batyrshin
I am not understand this example. First of all second process can't promote exclusive lock from reserved. It should use intermediate pending lock. And secondary why first process can't just drop read lock and then invoke busy handler? In this case any write to database that already has process

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Simon Davies
Alexander, >From http://www.sqlite.org/c3ref/busy_handler.html "The presence of a busy handler does not guarantee that it will be invoked when there is lock contention. If SQLite determines that invoking the busy handler could result in a deadlock, it will go ahead and return SQLITE_BUSY or

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Alexander Batyrshin
Oh... Nope, I am not using any thread-mechanism. I am using simple processes (via fork). So synchronization should be task for SQLite library. But right now I am confused, because my processes do not blocks on sqlite3_exec. They immediately report BUSY_TIMEOUT, without awaiting for time set by

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread John Stanton
If it is one process I would assign a mutex to the resource (Sqlite) and wait on it to get access to the resource. When the Sqlite operation is complete release the mutex and the next thread will have exclusive access to it. If you use pthreads you can use read and write locks to get

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread Alexander Batyrshin
So, you advice me, to implement synchronization inside my process by my self? On Thu, Apr 24, 2008 at 3:40 PM, John Stanton <[EMAIL PROTECTED]> wrote: > You have a single shared resource, Sqlite, and you have to synchronize > access. You can use the internal locking in Sqlite and use polling or

Re: [sqlite] Concurrency access to SQLite

2008-04-24 Thread John Stanton
You have a single shared resource, Sqlite, and you have to synchronize access. You can use the internal locking in Sqlite and use polling or wait on a mutex or semaphore. Alexander Batyrshin wrote: > Hello All, > > I am observing situation, that my concurrency process does not have > access

[sqlite] Concurrency access to SQLite

2008-04-24 Thread Alexander Batyrshin
Hello All, I am observing situation, that my concurrency process does not have access to SQLite database with equal probability. Here is example. I have N process that do work like this: while (1) { do_some_work(); // takes ~ 30 sec save_work_result_to_sqlite(); // takes ~ 1 sec } So,

Re: [sqlite] blob :: storing files within sqlite3

2008-04-24 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 João Macaíba wrote: > I've installed sqlite3 through a binary package. How can I know what is > the maximum length permited to a blob column ? The sqlite3_limit C api can tell you (introduced in 3.5.8). Unless compiled with a non-default value for

Re: [sqlite] blob :: storing files within sqlite3

2008-04-24 Thread Eduardo Morras
At 09:57 24/04/2008, you wrote: >Hi. > >I intend to use sqlite3 to store files. > >I've tested inserting an 7.6MB file in a blob column but it returns a >SQLite3::TooBigException. I'm using ruby API. > >I've installed sqlite3 through a binary package. How can I know what is >the maximum length

Re: [sqlite] blob :: storing files within sqlite3

2008-04-24 Thread John Stanton
My guees is that you have encountered a limitation in the Ruby wrapper. Can you write the BLOB in chunks using your interface? João Macaíba wrote: > Hi. > > I intend to use sqlite3 to store files. > > I've tested inserting an 7.6MB file in a blob column but it returns a >

[sqlite] blob :: storing files within sqlite3

2008-04-24 Thread João Macaíba
Hi. I intend to use sqlite3 to store files. I've tested inserting an 7.6MB file in a blob column but it returns a SQLite3::TooBigException. I'm using ruby API. I've installed sqlite3 through a binary package. How can I know what is the maximum length permited to a blob column ? Is there any

Re: [sqlite] Database open problem

2008-04-24 Thread John Stanton
In your second case you have the wrong pathname for your database file and Sqlite is creating an empty one at whatever path you actually specified. Yang WenYuan wrote: > Hi, > > There is a very strange problem when I play with the sqlite-ce database. > > I put the database file and my

[sqlite] Database open problem

2008-04-24 Thread Yang WenYuan
Hi, There is a very strange problem when I play with the sqlite-ce database. I put the database file and my application program together in the same folder. I call sqlite3_open(), the database can be opened properly. I call sqlite3_step(), it return SQLITE_ROW, that means it found the record