Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread liubin liu
How to rollback current transaction? Pavel Ivanov-2 wrote: > >> I assume you want the sqllite3_stmt to work -- so you need to loop that >> while it's busy. > > Michael, don't give bad advices. > The most general advice when one gets SQLITE_BUSY is to reset/finalize > all statements and roll

[sqlite] .import, after a peek at the code

2010-05-13 Thread Matt Young
I mentioned a while back that .import can be made to work with flexible number columns by setting a mode that says 'ignore column error on import'. The idea is that SQLite can import from csv files where the number of columns is not known. I looked that the code for import. If there was a column

[sqlite] Composite Foreign Key not enforced

2010-05-13 Thread George Somers
Hello, It seems that composite FK are not enforced on SQLite 3.6.23.1. The following script shows that the DELETE FROM table "artist" will work, even though there is a composite FK from table "track" toward table "artist". PRAGMA foreign_keys = ON; CREATE TABLE artist( artistidINTEGER PR

Re: [sqlite] Incorrect assertion in mutexes plus pcache1Alloc

2010-05-13 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/13/2010 12:22 PM, Nikolaus Rath wrote: > Where can I find the corresponding ticket? The sqlite homepage seems to > have lost all references to the bug tracker... I know that bug reporting is > no longer open to the public, but I hope there is sti

Re: [sqlite] Incorrect assertion in mutexes plus pcache1Alloc

2010-05-13 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/13/2010 12:56 PM, Pavel Ivanov wrote: > Roger, '-g' flag doesn't necessarily mean SQLITE_DEBUG turned on and > doesn't mean all debugging stuff turned on. This flag (if we're > talking about gcc) We aren't talking about gcc, but rather Python's

Re: [sqlite] Incorrect assertion in mutexes plus pcache1Alloc

2010-05-13 Thread Pavel Ivanov
>> Correct. Also, it only happens when apsw is compiled with -g. > > The amalgamation is being used when you compiled APSW.  When you compile > APSW with debug and the amalgamation, two things happen.  Firstly assertions > are turned on in both APSW and SQLite. > ... > Secondly it enables SQLITE_DE

Re: [sqlite] [csv extension] Error while reading long lines

2010-05-13 Thread gwenn
Done! Index: ext/csv/csv.c === --- ext/csv/csv.c +++ ext/csv/csv.c @@ -60,10 +60,11 @@ char *zRow; /* Buffer for current CSV row */ char cDelim; /* Character to use for delimiting columns */ i

Re: [sqlite] Incorrect assertion in mutexes plus pcache1Alloc

2010-05-13 Thread Nikolaus Rath
Roger Binns writes: > On 05/13/2010 06:43 AM, Nikolaus Rath wrote: >> Yeah, I'm around. I don't know what an "exact disassembly" is or how to >> provide one, but if someone tells me what to do then I'm most likely >> willing to do it. > > We can test the hypothesis very easily. Find line 15472 in

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Pavel Ivanov
> Perhaps SQLite should have a no-nonsense approach to this issue and > introduce some determinism, even in a primitive way.  I find it worst > than unfair, as the waiting process can do absolutely nothing against > the situation where it is "ignored". Unfortunately it's impossible to do that usin

Re: [sqlite] select intersecting intervals

2010-05-13 Thread Jean-Christophe Deschamps
>The Minimal-Perfect-Hash-INTERSECTION-OF-VECTORS approach might benefit >queries against tables having several million rows. What I'm wondering >(and >lack the C skills to find out for myself) is whether SQLite's underlying >algorithms for INTERSECT could be optimized with a minimal perfect hash

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Jean-Christophe Deschamps
> > In my low-concurrency, familly-business context, I have no problem at > > all setting 3 hours timeout using the built-in function, when the > > slowest transaction may only take less than 5 minutes. > >With this condition as a 4th one in your list and with 5th one stating >that you have less t

Re: [sqlite] Incorrect assertion in mutexes plus pcache1Alloc

2010-05-13 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/13/2010 06:43 AM, Nikolaus Rath wrote: > Yeah, I'm around. I don't know what an "exact disassembly" is or how to > provide one, but if someone tells me what to do then I'm most likely > willing to do it. We can test the hypothesis very easily.

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Pavel Ivanov
> In my low-concurrency, familly-business context, I have no problem at > all setting 3 hours timeout using the built-in function, when the > slowest transaction may only take less than 5 minutes. With this condition as a 4th one in your list and with 5th one stating that you have less than 30 slo

Re: [sqlite] select intersecting intervals

2010-05-13 Thread Jay A. Kreibich
On Thu, May 13, 2010 at 10:49:48AM -0400, Pavel Ivanov scratched on the wall: > > ?You have three basic conditions, and they're all AND'ed together. > > ?Just build an index that each condition can walk through. > > > > ?Or am I missing something? ?I know there are some odd rules about how > > ?SQL

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Jean-Christophe Deschamps
Let me take a reality check for the case of my own usage. If I guarantee that the following conditions are all true: All R^n (Read-Read-...-Read) atomic operations are enclosed in BEGIN transactions. All W^n (Write-Write-...-Write) and RMW (Read-Modify-Write) atomic operations are enclosed i

Re: [sqlite] select intersecting intervals

2010-05-13 Thread Pavel Ivanov
>  You have three basic conditions, and they're all AND'ed together. >  Just build an index that each condition can walk through. > >  Or am I missing something?  I know there are some odd rules about how >  SQLite will use (or won't use) indexes for greater-than/less-than >  conditions, but I don'

Re: [sqlite] Incorrect assertion in mutexes plus pcache1Alloc

2010-05-13 Thread Nikolaus Rath
Roger Binns writes: >> Although I see that it can return false in this case if another thread >> is inside pthreadMutexEnter and optimizer has switched order of >> assignment of the values to owner and nRef inside pthreadMutexEnter >> (it is allowed to do so because variables are not volatile). Is

Re: [sqlite] select intersecting intervals

2010-05-13 Thread Jay A. Kreibich
On Wed, May 12, 2010 at 06:00:29PM +0200, Jan Asselman scratched on the wall: > Hi, > > Given the following table with large row count 'row_count': > > CREATE TABLE table > ( > i_name TEXT, > i_from INTEGER, > i_toINTEGER, > i_data BLOB > ) > > I

Re: [sqlite] API not responding correctly for vc++

2010-05-13 Thread a1rex
I hope that you know that sprintf(sql, "SELECT count(*) FROM table1;"); is not a going to give you count(*) FROM table1. Where is your real query? From: Prajeed chathuar To: sqlite-users@sqlite.org Sent: Thu, May 13, 2010 4:10:01 AM Subject: [sqlite] API not

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Pavel Ivanov
> So as long as you're in the simple case (e.g. doing a simple SELECT while > another process INSERTs). you should never see a deadlock, correct? Yes, as long as you don't use transactions, or your transactions are homogeneous (in terms of using only SELECTs or only INSERTs/UPDATEs/DELETEs), or a

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Black, Michael (IS)
OK...so after reading that it sounds like the situation you need to avoid is a deadlock. So as long as you're in the simple case (e.g. doing a simple SELECT while another process INSERTs). you should never see a deadlock, correct? And the explanation would seem to indicate this: sqlite3_busy_

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Pavel Ivanov
> Hmmm...bad assumption on my partseems so logical that if it's busy just > try again -- and that idea worked on Liubin's problem. Read 4th paragraph from here http://www.sqlite.org/c3ref/busy_handler.html ("The presence of a busy handler ...") and see why it's not a good idea to always wait

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Black, Michael (IS)
Hmmm...bad assumption on my partseems so logical that if it's busy just try again -- and that idea worked on Liubin's problem. I see this http://www.sqlite.org/c3ref/stmt.html -- but it doesn't quite address the BUSY condition. I also found this thread http://www.mail-archive.com/sqlite-u

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Jay A. Kreibich
On Thu, May 13, 2010 at 12:07:50AM -0700, liubin liu scratched on the wall: > > I see many SQLITE_BUSY returned from sqlite3_finalize(). Are they memory leak > because it don't succeed in finalizing the sqlite3_stmt pointer? It sounds like you're using using sqlite3_prepare() rather than sqli

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Pavel Ivanov
> I assume you want the sqllite3_stmt to work -- so you need to loop that while > it's busy. Michael, don't give bad advices. The most general advice when one gets SQLITE_BUSY is to reset/finalize all statements and rollback current transaction. It's only in certain type of transactions and certa

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Black, Michael (IS)
It also means you're not handling the SQLITE_BUSY from the sqlite3_stmt() before it. I assume you want the sqllite3_stmt to work -- so you need to loop that while it's busy. Michael D. Black Senior Scientist Northrop Grumman Mission Systems From: sqlite-user

Re: [sqlite] select intersecting intervals

2010-05-13 Thread Tim Romano
Right, Jean-Christophe, about "moving too much data around". You'd want each of the inner selects to produce a vector of integer ids. "select *" is clearly not going to be very efficient. 200K rows is a very small table for this sort of test, in my view. Were the faster intereections any faster t

Re: [sqlite] Query to get the updated rows from table.

2010-05-13 Thread Pavel Ivanov
>> > What is the Query to get the updates from the table (updated (added, >> edited, >> > deleted row information) rows from last 5 mins/1 hour/5 hours/24 hours.) If you don't store change timestamp of the row by yourself then there's no way to know when the row was last changed. Pavel On Thu,

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread Pavel Ivanov
sqlite3_finalize (as well as sqlite3_reset) return SQLITE_BUSY only when sqlite3_stmt returned SQLITE_BUSY before that. It doesn't mean error of any kind or memory leak - sqlite3_finalize still did its job successfully and freed all resources it had to release. Pavel On Thu, May 13, 2010 at 3:07

Re: [sqlite] API not responding correctly for vc++

2010-05-13 Thread Simon Davies
On 13 May 2010 10:10, Prajeed chathuar wrote: > Hi > I am a sotware trainee of Bangalore,India base company...i am working for > the first time in sqlite data baase.. > I am trying sqlite and vc++ for last one week iam not getting correct > output.there is no linking and compiling error but no

Re: [sqlite] Query to get the updated rows from table.

2010-05-13 Thread Meenakshi Yakri
thanks for reply before also i have seen through this link... but I din't get any answer to my question in this link On Thu, May 13, 2010 at 3:38 PM, Simon Slavin wrote: > > On 13 May 2010, at 10:20am, Meenakshi Yakri wrote: > > > Hi wanted to check > > What is the Query to get the updates from

Re: [sqlite] Query to get the updated rows from table.

2010-05-13 Thread Simon Slavin
On 13 May 2010, at 10:20am, Meenakshi Yakri wrote: > Hi wanted to check > What is the Query to get the updates from the table (updated (added, edited, > deleted row information) rows from last 5 mins/1 hour/5 hours/24 hours.) http://www.sqlite.org/lang_datefunc.html See the 'Modifiers' section.

[sqlite] Query to get the updated rows from table.

2010-05-13 Thread Meenakshi Yakri
Hi wanted to check What is the Query to get the updates from the table (updated (added, edited, deleted row information) rows from last 5 mins/1 hour/5 hours/24 hours.) like for example SELECT * FROM ORDERS WHERE ROW CHANGE TIMESTAMP FOR ORDERS > CURRENT TIMSTAMP - 24 HOURS; returns all the rows

[sqlite] API not responding correctly for vc++

2010-05-13 Thread Prajeed chathuar
Hi I am a sotware trainee of Bangalore,India base company...i am working for the first time in sqlite data baase.. I am trying sqlite and vc++ for last one week iam not getting correct output.there is no linking and compiling error but not getting correct output: here is the code int sqlresu

[sqlite] SQLite error no such table: tablename

2010-05-13 Thread Catalinus
Hello everyone, I am sorry if I might be placing this problem on a wrong forum, but after googling several hours in vain, this is my only solution for the problem I am experiencing. I am implementing the persistence layer with NHibernate and SQLite. I am building dinamically the session configs:

Re: [sqlite] multi processes, so many errores of SQLITE_BUSY and SQLITE_MISUSE

2010-05-13 Thread liubin liu
I see many SQLITE_BUSY returned from sqlite3_finalize(). Are they memory leak because it don't succeed in finalizing the sqlite3_stmt pointer? Black, Michael (IS) wrote: > > SQLITE_BUSY is not an error...just a fact. > > All your processes cannot work on the database at the same time...at l