[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread R.Smith
On 2015-04-01 09:09 PM, Gert Van Assche wrote: > Dr. Hipp, thanks for the tip. I put > .bail on > in the script. > > > Ryan, I think I don't know how to trigger the bail out from within a SELECT > statement. > I tried > SELECT CASE (select count(*) from T1) WHEN (select count(*) from

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Simon Slavin
On 1 Apr 2015, at 8:09pm, Gert Van Assche wrote: > But this is definitely not the right way to do it. If I understand the doc > correctly, it should be an expression, but I don't see how I can do this... You can trigger a bail by causing any SQL error. For example, inserting a duplicate

[sqlite] Did A Recent Windows & Update Affect SQLite???

2015-04-01 Thread R.Smith
On 2015-04-01 09:17 PM, Mark Romero wrote: > Hello everyone and thanks for your replies (I am new to using a mailing > list so I hope that everyone gets this response). Everyone did. As to the question - as Simon mentioned, we are not aware - but I am not a Lightroom or Win7 user, so I phoned

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Gert Van Assche
Dr. Hipp, thanks for the tip. I put .bail on in the script. Ryan, I think I don't know how to trigger the bail out from within a SELECT statement. I tried SELECT CASE (select count(*) from T1) WHEN (select count(*) from T2) then 'OK' else RAISE(FAIL) END; But this is definitely not the

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread R.Smith
On 2015-04-01 08:29 PM, Gert Van Assche wrote: > Hi all, > > When running SQLite3 from command line, is there a way to interrupt the CMD > file when a condition is true? > > I'm importing a lot of plain text files that should all count the same > number of lines, so I want to compare the record

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Gert Van Assche
Hi all, When running SQLite3 from command line, is there a way to interrupt the CMD file when a condition is true? I'm importing a lot of plain text files that should all count the same number of lines, so I want to compare the record count of all imported data with the first file that was

[sqlite] Did A Recent Windows & Update Affect SQLite???

2015-04-01 Thread Simon Slavin
We can only answer your original question with a 'No'. We're not aware of any dramatic SQLite slow-down with any recent Windows update, let alone W7 specifically. As Alex wrote, it's probably better if you ask questions on a forum about Lightroom. Simon.

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread R.Smith
On 2015-04-01 07:10 PM, Kumar Suraj wrote: > Hi Richard.. this wont work for me due to following reason. > > If a separate thread performs a new INSERT > on the same database connection > while the sqlite3_last_insert_rowid() >

[sqlite] Did A Recent Windows & Update Affect SQLite???

2015-04-01 Thread Jim Callahan
You may or may not find this Adobe Lightroom thread helpful (it winds up discussing critical sections and thread proliferation -- which are not a SQLite issues): https://forums.adobe.com/thread/1229203?tstart=0 Jim Callahan On Wed, Apr 1, 2015 at 3:21 PM, Simon Slavin wrote: > We can only

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Richard Hipp
On 4/1/15, Gert Van Assche wrote: > > My question is: when the import fails (detected in the script.sql file), I > would like to stop executing the batch file (runscript.cmd). > > Is there a way to do so? > Have you tried the -bail command-line option? -- D. Richard Hipp drh at sqlite.org

[sqlite] Did A Recent Windows & Update Affect SQLite???

2015-04-01 Thread Mark Romero
Thank you all for all your help. I have been soliciting advice from all sorts of Lightroom forums / adobe forums / Dell computer forums and other forums more specific to hardware and Lightroom, and they all ended up in a dead end. But seeing as though it DOESN'T look like a recent Win 7 update

[sqlite] Behaviour changed from 3.7 to 3.8

2015-04-01 Thread Marcel Keller
Hi, Consider the following database: sqlite> .schema CREATE TABLE counter (i integer); CREATE TABLE expenses (date float, month text, amount numeric); sqlite> select * from counter; 0 1 2 sqlite> select * from expenses; 2457113.5163101||100 In the latest binary from the website, I get the

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Doug Currie
Suraj, Don't use the same database connection in multiple threads. Each thread should use its own connection. Then last insert rowid is predictable. e On Wed, Apr 1, 2015 at 1:10 PM, Kumar Suraj wrote: > Hi Richard.. this wont work for me due to following reason. > > If a separate thread

[sqlite] WAL with linux and win

2015-04-01 Thread Simon Slavin
On 1 Apr 2015, at 12:16am, MM wrote: > Is all I need to do: PRAGMA journal_mode=WAL; once from sqlite3 command > line? Yes. Just do it once, from any connection or any program. The mode is stored inside the database file and will then be used by any program which opens a connection. > Any

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/01/2015 10:10 AM, Kumar Suraj wrote: > Hi Richard.. this wont work for me due to following reason. Yes it will. This is how I do it: BEGIN TRANSACTION; INSERT INTO table .; SELECT last_insert_rowid(); COMMIT; That will always

[sqlite] Performance issue

2015-04-01 Thread GB
In case of SELECTing "all available" I recommend invoking a different statement without the timestamp-part instead of providing some min and max values for timestamp. This avoids tricking the query planner into some wrong decisions (if you have an index with protocol as the first column). And

[sqlite] Did A Recent Windows & Update Affect SQLite???

2015-04-01 Thread Mark Romero
Hello everyone and thanks for your replies (I am new to using a mailing list so I hope that everyone gets this response). - Viruses and Antivirus software: I use Avast in real time and I have scanned my system several times and it came up clean. I installed malwarebytes shortly after Lightroom

[sqlite] Performance issue

2015-04-01 Thread R.Smith
On 2015-04-01 10:20 AM, Jeff Roux wrote: > Here is the complete schema: > > sqlite> .schema > CREATE TABLE application (id INTEGER CONSTRAINT applpk PRIMARY KEY, > shortname VARCHAR(64), name VARCHAR(256)); > > CREATE TABLE flows (idx INTEGER PRIMARY KEY, ipLan INTEGER, ipWan INTEGER, > flags

[sqlite] Two different Order By in one statement

2015-04-01 Thread R.Smith
On 2015-04-01 10:29 AM, Bart Smissaert wrote: > OK, let me give the simplest example possible. > > Table with 3 integer fields, A, B and C > > AB C > > 1 1 2 > 2 1 2 > 1 2 1 > 2 2 1 > > This needs to be sorted on column A asc >

[sqlite] Two different Order By in one statement

2015-04-01 Thread Bart Smissaert
Also, performance is very good with a compound index on emis_number, status, entry_date, significance. RBS On Wed, Apr 1, 2015 at 11:06 AM, Bart Smissaert wrote: > Thanks, that does work indeed. My actual real order is now this: > > ORDER BY emis_number asc, status desc, > (case status when 2

[sqlite] Two different Order By in one statement

2015-04-01 Thread Bart Smissaert
Thanks, that does work indeed. My actual real order is now this: ORDER BY emis_number asc, status desc, (case status when 2 then entry_date when 1 then significance end) desc, entry_date desc All working perfect. Never realised you could do this. RBS On Wed, Apr 1, 2015 at 10:03 AM, Simon

[sqlite] Performance issue

2015-04-01 Thread Jeff Roux
Here is the complete schema: sqlite> .schema CREATE TABLE application (id INTEGER CONSTRAINT applpk PRIMARY KEY, shortname VARCHAR(64), name VARCHAR(256)); CREATE TABLE flows (idx INTEGER PRIMARY KEY, ipLan INTEGER, ipWan INTEGER, flags INTEGER, portLan INTEGER, portWan INTEGER, tos INTEGER,

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Kumar Suraj
Hi Richard.. this wont work for me due to following reason. If a separate thread performs a new INSERT on the same database connection while the sqlite3_last_insert_rowid() function is running and thus

[sqlite] Two different Order By in one statement

2015-04-01 Thread Simon Slavin
On 1 Apr 2015, at 9:29am, Bart Smissaert wrote: > This needs to be sorted on column A asc > Then when the value in A is 1 the second sort needs to be asc on column B, > but when the value in A is 2 then the second sort needs to be asc on > column C. You just put it all in your ORDER BY

[sqlite] Behaviour changed from 3.7 to 3.8

2015-04-01 Thread Richard Hipp
On 4/1/15, Marcel Keller wrote: > Hi, > > Consider the following database: > > sqlite> .schema > CREATE TABLE counter (i integer); > CREATE TABLE expenses (date float, month text, amount numeric); > sqlite> select * from counter; > 0 > 1 > 2 > sqlite> select * from expenses; >

[sqlite] Two different Order By in one statement

2015-04-01 Thread Bart Smissaert
OK, let me give the simplest example possible. Table with 3 integer fields, A, B and C AB C 1 1 2 2 1 2 1 2 1 2 2 1 This needs to be sorted on column A asc Then when the value in A is 1 the second sort needs to be asc on

[sqlite] Did A Recent Windows & Update Affect SQLite???

2015-04-01 Thread Donald Griggs
Regarding: "... would love to see the SQLite schema Lightroom uses" Hi, Rob I am not a user of Lightroom, but there's a start at this link: http://www.earthboundlight.com/phototips/querying-sqlite-lightroom-database.html

[sqlite] Did A Recent Windows & Update Affect SQLite???

2015-04-01 Thread Andy Rahn
Hi Mark I echo the suggestion that you make sure your HDD is working properly by doing a disk scan of some sort. It's dangerous to start trying other solutions if the drive is about to fail! While you're at it, it's probably a good idea to make sure your backups are up to date -- and by backup

[sqlite] Two different Order By in one statement

2015-04-01 Thread R.Smith
On 2015-04-01 01:50 AM, Bart Smissaert wrote: > Say I have a table with 3 fields. Depending on a value in field 1 (this > value will be either 1 or 2) > I want to do a different sort order sorting on fields 2 and 3. > This will be either order by field2 desc, field3 desc or field3 desc, > field2

[sqlite] insert in sqlite (returning value for inserted row)

2015-04-01 Thread Simon Slavin
On 1 Apr 2015, at 2:19am, Kumar Suraj wrote: > I am using sqlite C interface for inserting data in the table. The primary > key is a 64 bit integer which i need to auto-increment and get populated > automatically as we do not provide that value in insert statement. Is there > a way i can get

[sqlite] Two different Order By in one statement

2015-04-01 Thread Bart Smissaert
Say I have a table with 3 fields. Depending on a value in field 1 (this value will be either 1 or 2) I want to do a different sort order sorting on fields 2 and 3. This will be either order by field2 desc, field3 desc or field3 desc, field2 desc. I thought of a union, but doesn't allow this. Any

[sqlite] WAL with linux and win

2015-04-01 Thread MM
I have a sqlite3 3.8.8.2/3 database me.db. I access it from: 1. C++/odb (linux64/win64) in read only mode 2. python3 (linux64 server) in readonly mode from process 1 and read/write mode from process 2, concurrently. 3. python3/DB BrowserSQLite (win64 PC) in read/write mode, not