Re: [sqlite] order of select result

2010-07-12 Thread Lloyd
Thanks Swithun. I dont have any supportive column in table to issue "order by". Can it be achieved by issuing an "ordr by" query on "row_id" (used by sqlite internaly)? Thanks, Lloyd > Hello > > L> Lets assume that we have a very simple without any indexing or > L>constraints. Now we have

Re: [sqlite] order of select result

2010-07-12 Thread Swithun Crowe
Hello L> Lets assume that we have a very simple without any indexing or L>constraints. Now we have inserted some data to the table. When we do a L>simple "select" query, is it guranteed that the rows will be retrieved L>in the same order as they are inserted? No. It may look like they are

[sqlite] order of select result

2010-07-12 Thread Lloyd
Hi, Lets assume that we have a very simple without any indexing or constraints. Now we have inserted some data to the table. When we do a simple "select" query, is it guranteed that the rows will be retrieved in the same order as they are inserted? Thanks a lot, Lloyd

Re: [sqlite] EXTERNAL: database is locked(5) too often - what am i doing wrong?

2010-07-12 Thread raf
Black, Michael (IS) wrote: > Combining your transactions would probably help a fair bit. > And I think you're sleeping WAY too long. thanks. > Besides upgrading your sqlite use sqlite3_busy_timeout() -- it will > handle the sleeps for you and do it much faster than what you're doing > (besides

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Nicolas Williams
On Mon, Jul 12, 2010 at 08:43:32PM -0700, Roger Binns wrote: > > They're insane (the _first_, not last, fildes close(2) in a process > > drops all locks on the underlying file), but the child won't clobber the > > parent's locks. > > That is assuming all components (C libraries, threading,

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Nicolas Williams
On Mon, Jul 12, 2010 at 08:43:32PM -0700, Roger Binns wrote: > Earlier you were trying to optimise out calls to getpid() and now you want > every SQLite function source to be changed? No, just entry points into the library. What makes you think that I meant that every function in the library

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/12/2010 02:59 PM, Nicolas Williams wrote: > You can return an error to the caller too. That would require substantial surgery to SQLite. Almost every routine acquires and releases locks so they would have to be changed along with SQLite

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Nicolas Williams
On Mon, Jul 12, 2010 at 02:47:19PM -0700, Roger Binns wrote: > About the only correct thing to do in a process using SQLite through a fork > is to terminate the process. You can return an error to the caller too. Of course, if you're using the mutex functions to do this then it's too late, so

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/12/2010 12:07 PM, Eric Smith wrote: > I don't think the devs would complain about that. "This code has too > few lines!" They also have to have signed paper copies dedicating the code to public domain and acknowledging the right to do so.

Re: [sqlite] Version 3.7.0 delayed. Was: no longer able to use read-only databases?

2010-07-12 Thread Simon Slavin
On 12 Jul 2010, at 8:42pm, Noah Hart wrote: > consider that if you embed the WAL within the SQLite > database itself, past the high-water mark, it would also take case of this > problem. No. Because whichever file stores the WAL information is stored in has to be opened with read/write

Re: [sqlite] EXTERNAL:Re: Version 3.7.0 delayed. Was: no longer able to use read-only databases?

2010-07-12 Thread Black, Michael (IS)
I must be missing something...why does a read-only database require WAL at all? If you can't update tables then how can you use WAL? Michael D. Black Senior Scientist Northrop Grumman Mission Systems From: sqlite-users-boun...@sqlite.org on behalf of Noah

Re: [sqlite] Version 3.7.0 delayed. Was: no longer able to use read-only databases?

2010-07-12 Thread Noah Hart
Richard, In thinking about this, consider that if you embed the WAL within the SQLite database itself, past the high-water mark, it would also take case of this problem. Noah Hart On Fri, Jul 9, 2010 at 3:21 PM, Matthew L. Creech wrote: > In testing the latest SQLite

[sqlite] Version 3.7.0 delayed. Was: no longer able to use read-only databases?

2010-07-12 Thread Richard Hipp
On Fri, Jul 9, 2010 at 3:21 PM, Matthew L. Creech wrote: > In testing the latest SQLite snapshot with WAL enabled, it seems that > there's no way to use a database in a read-only location. > The release of SQLite version 3.7.0 will likely be delayed while we try to figure out

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Eric Smith
Roger Binns wrote: > I'd have no problem contributing the code to SQLite, but there isn't > very much of it I don't think the devs would complain about that. "This code has too few lines!" > and it is an open issue as to how you report the cross fork usage should > it happen. (In my case

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Nicolas Williams
On Mon, Jul 12, 2010 at 01:59:30PM -0500, Nicolas Williams wrote: > The result is that you end up with a tiny penalty for fork > detection: two loads, a compare and a likely-not-taken branch. Actually three loads, two compares and two likely-not-taken branch, unless you know you

Re: [sqlite] quickly insert multiple rows into multiple table

2010-07-12 Thread Eric Smith
W.-H. Gu wrote: > For (1), after I wrapped inserts into a transaction, I face an issue: > the cpu usage is too high. I think the reason is that I use prepare > statement to insert a row at a time, it than does sqlite3_step for > thousands times every second. If I'm reading this right,

Re: [sqlite] open db cx to fork(2)d children

2010-07-12 Thread Nicolas Williams
On Sat, Jul 10, 2010 at 11:27:41AM -0700, Roger Binns wrote: > On 07/10/2010 07:12 AM, Eric Smith wrote: > > Your wrapper is nice -- have you considered folding something like it > > into the core (disabled by default, enabled by a compile-time flag) and > > submitting it to drh for official

Re: [sqlite] EXTERNAL:Re: quickly insert multiple rows into multiple table

2010-07-12 Thread Black, Michael (IS)
Are you serious??? Run fast...more CPU...run slow...less CPU...you're choice. If you want to run less then 9000 rows/seconds put a sleep in there somewhere. The only reason you're at 30% and not 100% is due to your disk-speed limitation. I really can't see what you're complaining about.

Re: [sqlite] quickly insert multiple rows into multiple table

2010-07-12 Thread W.-H. Gu
Hi, For (1), after I wrapped inserts into a transaction, I face an issue: the cpu usage is too high. I think the reason is that I use prepare statement to insert a row at a time, it than does sqlite3_step for thousands times every second. Every second I insert 9184 rows, which

Re: [sqlite] quickly insert multiple rows into multiple table

2010-07-12 Thread Kees Nuyt
1On Mon, 12 Jul 2010 09:29:35 -0700, "W.-H. Gu" wrote: >Hi, > > I have 5 tables. Every second I want to insert 1 row into the main table, >and multiple rows into every other table. What I do right now is to prepare >5 statements for those 5 tables, where the statements for

Re: [sqlite] noobie Is there an additional web site for noobie questions.??

2010-07-12 Thread Kees Nuyt
On Mon, 12 Jul 2010 06:47:55 -0700 (PDT), B H wrote: >also is there a web site or blog for questions and answers in additional to >the email?  Internet Relay Chat: Channel #sqlite on irc.freenode.net -- ( Kees Nuyt ) c[_]

[sqlite] quickly insert multiple rows into multiple table

2010-07-12 Thread W.-H. Gu
Hi, I have 5 tables. Every second I want to insert 1 row into the main table, and multiple rows into every other table. What I do right now is to prepare 5 statements for those 5 tables, where the statements for multiple row insertion is like INSERT INTO MyTable (FirstCol, SecondCol)

Re: [sqlite] How is the table getting locked and how to unlock it?

2010-07-12 Thread Jay A. Kreibich
On Mon, Jul 12, 2010 at 12:00:40PM -0400, Sam Carleton scratched on the wall: > On Mon, Jul 12, 2010 at 10:36 AM, Jay A. Kreibich wrote: > > > > > Are you using sqlite3_exec() for all of these? My first guess is that > > you're not finalizing the INSERT statement (or allowing

Re: [sqlite] How is the table getting locked and how to unlock it?

2010-07-12 Thread Sam Carleton
On Mon, Jul 12, 2010 at 10:36 AM, Jay A. Kreibich wrote: > > Are you using sqlite3_exec() for all of these? My first guess is that > you're not finalizing the INSERT statement (or allowing it to run to > completion) before trying to drop the table. > I am using

Re: [sqlite] binding an IN

2010-07-12 Thread Richard Hipp
Have you looked at the "test_intarray" code. http://www.sqlite.org/src/artifact/489edb9068bb926583445cb02589344961054207 On Sun, Jul 11, 2010 at 9:42 PM, Sam Carleton wrote: > Is there any way to bind to this query? > > SELECT * FROM table WHERE tableId IN ( ? ); > >

Re: [sqlite] How is the table getting locked and how to unlock it?

2010-07-12 Thread Jay A. Kreibich
On Mon, Jul 12, 2010 at 09:47:24AM -0400, Sam Carleton scratched on the wall: > Then I get a value from one table, begin a transaction, create a temp > customer table, fill it with the current values from the customer > table.?? Here is that SQL run by calling sqlite3_exec(): > This all works

Re: [sqlite] EXTERNAL: binding an IN

2010-07-12 Thread Jay A. Kreibich
On Mon, Jul 12, 2010 at 09:45:20AM -0400, Sam Carleton scratched on the wall: > Michael, > > Actually I am building the string myself and it is very controlled, the Id's > are coming from an internal source, but it violates my general rule of never > building query strings. Of course there are

[sqlite] Is there busy handling in SQLite jdbc drivers?

2010-07-12 Thread Gerry Snyder
I could not find any information on either the zentus or xerial websites on any built-in provisions for busy handling. Did I miss it, or is the functionality there but not documented, or do I need to check error codes and retry in my code? TIA, Gerry

Re: [sqlite] noobie where is my data base? I am new

2010-07-12 Thread Simon Slavin
On 12 Jul 2010, at 2:43pm, B H wrote: > Downloaded sqlite to desktop. > ran getting started. > so where is my example ex1. > or How do and where can I save the ex data base and related tables. If you did not specify a path for your database file, it is in whatever directory your operating

Re: [sqlite] noobie Is there an additional web site for noobie questions.??

2010-07-12 Thread Timothy A. Sawyer
www.sqlite.org is the web site. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of B H Sent: Monday, July 12, 2010 9:48 AM To: sqlite-users@sqlite.org Subject: [sqlite] noobie Is there an additional web site for noobie

[sqlite] noobie Is there an additional web site for noobie questions.??

2010-07-12 Thread B H
also is there a web site or blog for questions and answers in additional to the email?  ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[sqlite] How is the table getting locked and how to unlock it?

2010-07-12 Thread Sam Carleton
I posted this over the weekend, I am assuming it was overlooked because it was, well, the weekend:) Does anyone have any thoughts? -- I am on Window 7, opening an existing database with these flags: SQLITE_OPEN_EXCLUSIVE |

Re: [sqlite] EXTERNAL: binding an IN

2010-07-12 Thread Sam Carleton
Michael, Actually I am building the string myself and it is very controlled, the Id's are coming from an internal source, but it violates my general rule of never building query strings. Of course there are always exceptions to the rule and it looks like this is one of those exceptions. Thank

[sqlite] noobie where is my data base? I am new

2010-07-12 Thread B H
Downloaded sqlite to desktop. ran getting started. so where is  my example ex1. or How do and where can I save the ex data base and related tables.   thanks,     ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Suggestion for sqlite shell

2010-07-12 Thread Max Vlasov
On Mon, Jul 12, 2010 at 5:00 PM, Alexey Pechnikov wrote: > Maxim, please show example here and the link to your implementation. > > Alexey, to illustrate I prepared a screen shot http://www.maxerist.net/downloads/temp/bind_iterate.png excel and cells to be copied are at

Re: [sqlite] Suggestion for sqlite shell

2010-07-12 Thread Alexey Pechnikov
Maxim, please show example here and the link to your implementation. -- Best regards, Alexey Pechnikov. http://pechnikov.tel/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Terminate blocking SELECT-operation?

2010-07-12 Thread Simon Davies
On 12 July 2010 12:39, Kristoffer Danielsson wrote: > > I would like to perform an asynchronous SELECT, terminatable by a semaphore > or equivalent. The problem I'm trying to solve is to allow termination of a > blocking SELECT-operation that take too long. > > >

[sqlite] Suggestion for sqlite shell

2010-07-12 Thread Max Vlasov
Hi, recently I implemented a feature for an gui admin I use internally, but I think it would be useful also for sqlite shell. Sorry if it already exists in some form, I could not find similar. The idea is to use bind syntax together with csv (or clipboard compatible) import. So if one enters a

Re: [sqlite] Export data into CSV format every 10 minuts

2010-07-12 Thread Simon Slavin
On 12 Jul 2010, at 1:13pm, Giuseppe Scopelliti wrote: > I need a command sequence that is able to export data from a single > table to csv format. > > I use .output command from sqlite3 shell, and set to column with ; to > separe field at the same line. > > But I need to: > > 1. run that

[sqlite] Export data into CSV format every 10 minuts

2010-07-12 Thread Giuseppe Scopelliti
Hello, I use sqlite3 for embedded arm system. I need a command sequence that is able to export data from a single table to csv format. I use .output command from sqlite3 shell, and set to column with ; to separe field at the same line. But I need to: 1. run that script every 10 minuts. 2.

Re: [sqlite] EXTERNAL: binding an IN

2010-07-12 Thread Black, Michael (IS)
Is there any reason why you need to bind it? Can't you just build the SQL string yourself? As long as your IN parameters are well-controlled I don't think it should be a security risk. Plus you can check for more then one"(" after you build the string. #include #include int

Re: [sqlite] EXTERNAL: Terminate blocking SELECT-operation?

2010-07-12 Thread Kristoffer Danielsson
Thanks. That's exactly what I need. > Date: Mon, 12 Jul 2010 06:57:13 -0500 > From: michael.bla...@ngc.com > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] EXTERNAL: Terminate blocking SELECT-operation? > > Do you maybe want a combination of > >

Re: [sqlite] EXTERNAL: Terminate blocking SELECT-operation?

2010-07-12 Thread Black, Michael (IS)
Do you maybe want a combination of http://www.sqlite.org/c3ref/progress_handler.html And http://www.sqlite.org/c3ref/interrupt.html If you really need asynch queries then I think you'll have to thread it or fork it yourself. Michael D. Black Senior Scientist Northrop Grumman Mission Systems

[sqlite] Terminate blocking SELECT-operation?

2010-07-12 Thread Kristoffer Danielsson
I would like to perform an asynchronous SELECT, terminatable by a semaphore or equivalent. The problem I'm trying to solve is to allow termination of a blocking SELECT-operation that take too long. Does SQLite support that?

[sqlite] Journal file not locked - problems with virus checkers

2010-07-12 Thread John Wood
I've been having an ongoing issue with some deployed code (Windows). Occasionally, operations would fail with the SQLITE_FULL error. I've now tracked this issue down to being caused by other processes (virus scanners) locking the journal file at sensitive times. (I'm fairly certain that the

Re: [sqlite] EXTERNAL: database is locked(5) too often - what am i doing wrong?

2010-07-12 Thread Black, Michael (IS)
Combining your transactions would probably help a fair bit. And I think you're sleeping WAY too long. Besides upgrading your sqlite use sqlite3_busy_timeout() -- it will handle the sleeps for you and do it much faster than what you're doing (besides doing it automaticalliy for you whenever it

Re: [sqlite] binding an IN

2010-07-12 Thread Igor Sereda
We have a similar task and we solve it by using a statement with lots of parameters SELECT * FROM table WHERE tableId IN (?, ?, ?, ?, ) The number of "?", let's call it N, is fixed, and set to ~100 -- tuned by measuring performance. When the actual number of parameters is less