[sqlite] Waiting on RESERVED locks

2015-02-18 Thread Tim Starling
We (Wikimedia) are observing SQLITE_BUSY errors in our integration testing. The integration test consists of having a single browser instance view a MediaWiki site which uses SQLite 3.8 for its backend. The browser sends several parallel requests for CSS, JS, etc., and MediaWiki writes to the

[sqlite] Waiting on RESERVED locks

2015-02-18 Thread Tim Starling
On 18/02/15 14:46, Richard Hipp wrote: > I'm guessing that running "PRAGMA busy_timeout=4000;" (or some other > reasonable number of milliseconds) shortly after opening the > database connection will likely cure your problem. > https://www.sqlite.org/pragma.html#pragma_busy_timeout You might >

[sqlite] Waiting on RESERVED locks

2015-02-18 Thread Dan Kennedy
On 02/18/2015 06:53 AM, Tim Starling wrote: > We (Wikimedia) are observing SQLITE_BUSY errors in our integration > testing. The integration test consists of having a single browser > instance view a MediaWiki site which uses SQLite 3.8 for its backend. > The browser sends several parallel requests

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread gunnar
Hello, When I execute a query that has a subquery behind a comparison operator in its where-clause and the subquery returns an empty result, then the result of the complete query is exactly how I want it: also an empty result. Can I assume that this behaviour will stay the same in next

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread Clemens Ladisch
gunnar wrote: > When I execute a query that has a subquery behind a comparison > operator in its where-clause and the subquery returns an empty result, > then the result of the complete query is exactly how I want it: also > an empty result. Can I assume that this behaviour will stay the same > in

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread gunnar
Thanks a lot Clemens! I will use your suggestion and add the 'UNION'. Then I only need to make sure that the comparison "[some number] > NULL" in my WHERE clause always return an empty set. Thanks again! Gunnar Gunnar Harms T +31 (0)20 53 53 487 F +31 (0)20 42 08 852 I www.hiqinvest.nl HiQ

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread Eduardo Morras
On Wed, 18 Feb 2015 10:23:16 +0100 Clemens Ladisch wrote: > gunnar wrote: > > When I execute a query that has a subquery behind a comparison > > operator in its where-clause and the subquery returns an empty > > result, then the result of the complete query is exactly how I want > > it: also an

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread Clemens Ladisch
Eduardo Morras wrote: > Clemens Ladisch wrote: >> ... WHERE cb_seq_num > ( >> SELECT cb_seq_num >> FROM ordercallback >> WHERE cb_uuid=@CBUUID >> UNION ALL >> SELECT NULL -- at least one result >> LIMIT 1) -- at most one result > > Shouldn't add an ORDER

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread gunnar
The subquery will always return one result or no result. So I only have to UNION it ALL with the SELECT NULL part. (I still have to refresh my memory how UNION ALL exactly works since I never used it and only know it from college long time ago :) I cannot imagine, but when it incurs a

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread Clemens Ladisch
gunnar wrote: > The subquery will always return one result or no result. So I only > have to UNION it ALL with the SELECT NULL part. >>> Clemens Ladisch wrote: ... WHERE cb_seq_num > ( SELECT cb_seq_num FROM ordercallback WHERE cb_uuid=@CBUUID

[sqlite] Complex insert query to normalised database

2015-02-18 Thread Flakheart
Apologies in advance folks, please forgive the question and the formatting. I have around 650,000 recipes and through lots of study have more or less determined that the table structures below will give me a reasonable normalised database. That is not to say that it is perfect, but it is a

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-18 Thread gunnar
Ah indeed! thanks! On 02/18/2015 12:22 PM, Clemens Ladisch wrote: > gunnar wrote: >> The subquery will always return one result or no result. So I only >> have to UNION it ALL with the SELECT NULL part. Clemens Ladisch wrote: > ... WHERE cb_seq_num > ( > SELECT cb_seq_num

[sqlite] Complex insert query to normalised database

2015-02-18 Thread Stephen Chrzanowski
AFAIK, you can't do 'nested insert', or, insert to multiple tables in one call. Not from a single command line, or, from a view. You're pretty much stuck with updating one table at a time. It would be nice, however, problems can come up with a many-to-many situation where the engine isn't sure

[sqlite] Complex insert query to normalised database

2015-02-18 Thread gunnar
Hi, I'm not an sqlite expert but in general I think you can insert in the tables one by one, but in the right order. And make sure the different inserts per recipe belong to one transaction (if one fails, the previous are rolled back automatically). You should probably also study

[sqlite] Complex insert query to normalised database

2015-02-18 Thread Flakheart
Thanks Stephen. At least I know now so I can go ahead and create my inserts from data from the form. I just have to be careful to make sure they are done in an efficient order with the data in the right place. The category one I have to be careful of as it isn't in a list control but a string

[sqlite] Complex insert query to normalised database

2015-02-18 Thread Simon Slavin
On 18 Feb 2015, at 11:38am, Flakheart wrote: > I can deal with single table inserts but I think this would be some sort of > nested insert statement? There are no statements in SQL which can modify more than one table. So you will need to use a number of commands, one for each table.

[sqlite] Complex insert query to normalised database

2015-02-18 Thread Staffan Tylen
I suspect that this is wrong as nobody has suggested it but isn't this what triggers are meant to solve? Staffan On Wed, Feb 18, 2015 at 2:13 PM, Simon Slavin wrote: > > On 18 Feb 2015, at 11:38am, Flakheart wrote: > > > I can deal with single table inserts but I think this would be some

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Richard Hipp
In a feeble effort to do "marketing", I have revised the "Appropriate Uses For SQLite" webpage to move trendy buzzwords like "Internet of Things" and "Edge of the Network" above the break. See: https://www.sqlite.org/whentouse.html Please be my "focus group", and provide feedback, comments,

[sqlite] EBCDIC 0xF0-0xF9 sqlite3UpperToLower values incorrect

2015-02-18 Thread Roland Martin
In global.c: #ifdef SQLITE_EBCDIC 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 0x */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 1x */ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 2x */ 48, 49, 50, 51, 52, 53,

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Jim Callahan
I would mention the open source statistical language R in the "data analysis" section. The interface in the RSqlite package is much better and faster than any of the Python interfaces in that the interface fully understands queries as tables and that the looping for the return of rows is done in

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Richard Hipp
On 2/18/15, Jim Callahan wrote: > I would mention the open source statistical language R in the "data > analysis" section. I've heard of R but never tried to use it myself. Is an SQLite interface built into R, sure enough? Or is that something that has to be added in separately? > The

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Rich Shepard
On Wed, 18 Feb 2015, Richard Hipp wrote: > Please be my "focus group", and provide feedback, comments, suggestions, > and/or criticism about the revised document. Send your remarks back to > this mailing list, or directly to me at the email in the signature. Richard, It is clear and well

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread John McKown
On Wed, Feb 18, 2015 at 8:53 AM, Richard Hipp wrote: > On 2/18/15, Jim Callahan wrote: > > I would mention the open source statistical language R in the "data > > analysis" section. > > I've heard of R but never tried to use it myself. Is an SQLite > interface built into R, sure enough? Or is

[sqlite] Error 1032: SQLITE_READONLY_DBMOVED with one writer and one reader process

2015-02-18 Thread Gillot Lamure Leo (Consultant)
Hello. We're trying to use sqlite on an embedded linux with one process regularly writing entries in a db and another process removing the entries by batch. It works fine on the first boot, however after stopping and relauching the processes I start to get errors on all sides: the reader gets

[sqlite] Error 1032: SQLITE_READONLY_DBMOVED with one writer and one reader process

2015-02-18 Thread Simon Slavin
On 18 Feb 2015, at 4:09pm, Gillot Lamure Leo (Consultant) wrote: > We're trying to use sqlite on an embedded linux with one process regularly > writing entries in a db and another process removing the entries by batch. What file system does the volume with the database file on use ? > It

[sqlite] Error 1032: SQLITE_READONLY_DBMOVED with one writer and one reader process

2015-02-18 Thread Richard Hipp
On 2/18/15, Gillot Lamure Leo (Consultant) wrote: > Hello. > > We're trying to use sqlite on an embedded linux with one process regularly > writing entries in a db and another process removing the entries by batch. > It works fine on the first boot, however after stopping and relauching the >

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Marcus Grimm
We use sqlite as the db engine inside a server application with a number of clients that connect to the server. Sqlite works just beatiful here and I wish these statements "sqlite shall not be used for client/server things" would be worded less generally. In fact when we mention sqlite as our db

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Darko Volaric
I second this notion. I think SQLite is uniquely suited to server based applications of all kinds. Its light footprint and the fact that it's a library rather than a full system gives it a flexibility and raw performance that other systems cannot. We use it at the core of each node in a

[sqlite] Trigger help or how to update id based on column content

2015-02-18 Thread Jose I. Cabrera
Greetings! I have this table CREATE TABLE LSOpenJobs ( id integer primary key, ProjID integer, PSubClass, lang, ProjFund, RateType ); Imagine this set of records... 171421|132959|DOC-Trans|DE-DE|860.69|PER-WORD 171422|132959|DOC-Trans|ES-LA|624.96|PER-WORD

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Richard Hipp
On 2/18/15, Darko Volaric wrote: > The only thing I'd change about SQLite is the SQL bit. Most people agree that the SQL language is a bit of a mess. But so is the Qwerty keyboard layout. The problem is that the improvement you get by moving to something else is less than the pain of making

[sqlite] Trigger help or how to update id based on column content

2015-02-18 Thread Igor Tandetnik
On 2/18/2015 2:36 PM, Jose I. Cabrera wrote: > these are my two steps: > 1. SELECT RateType FROM LSOpenJobs WHERE ProjID=132959 AND PSubClass='PM' AND > lang='DE-DE'; What is the point of this step? I don't see where and how the value you obtain therefrom is required for step 2. > 2. Use the

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/18/2015 11:43 AM, Richard Hipp wrote: > but I think the truth is we are probably stuck with SQL for a while > yet. In theory there could be an intermediate representation form (like compilers do) that is publicly available, with the (now

[sqlite] Trigger help or how to update id based on column content

2015-02-18 Thread jose i cabrera
On 2/18/2015 3:59 PM, Igor Tandetnik wrote: > On 2/18/2015 2:36 PM, Jose I. Cabrera wrote: >> these are my two steps: >> 1. SELECT RateType FROM LSOpenJobs WHERE ProjID=132959 AND >> PSubClass='PM' AND lang='DE-DE'; > > What is the point of this step? I don't see where and how the value > you

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Jay Kreibich
On Feb 18, 2015, at 3:13 PM, Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 02/18/2015 11:43 AM, Richard Hipp wrote: >> but I think the truth is we are probably stuck with SQL for a while >> yet. > > In theory there could be an intermediate representation form

[sqlite] Trigger help or how to update id based on column content

2015-02-18 Thread Igor Tandetnik
On 2/18/2015 4:19 PM, jose i cabrera wrote: > I need to know what the percentage for this specific project ID, 132959, > and language is going to be calculated. This may be different depending > on the project. So, it may be 3%, 5%, 10%, 20%, 25%, etc. That is my > problem, I don't know how to

[sqlite] Trigger help or how to update id based on column content

2015-02-18 Thread jose i cabrera
On 2/18/2015 4:37 PM, Igor Tandetnik wrote: > On 2/18/2015 4:19 PM, jose i cabrera wrote: >> I need to know what the percentage for this specific project ID, 132959, >> and language is going to be calculated. This may be different depending >> on the project. So, it may be 3%, 5%, 10%, 20%, 25%,

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Darko Volaric
I agree with you, and am not suggesting getting rid of it, but rather making it "pluggable" like many parts of the back end. Right now, roughly speaking, I'm doing: logical form -> SQL -> execution of logical form, and SQL seems to me to just be an arbitrary hoop that I have to jump through,

[sqlite] Trigger help or how to update id based on column content

2015-02-18 Thread Igor Tandetnik
On 2/18/2015 5:10 PM, jose i cabrera wrote: > So, in reality, all the tasks of the project of > like "lang" minus the PM, have to be added and 10% of that total be > calculated to the (on this instance) DE-DE PM task. UPDATE LSOpenJobs SET ProjFund = ( SELECT round(sum(t2.ProjFund) *

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Darko Volaric
I think that IR would be something like first order predicate logic, to which SQL and the relational calculus is closely related. Now that we have WITH and recursive queries, you've basically got a bottom-up evaluation of the declarative subset of Prolog (if you ignore issues relating to logic

[sqlite] Trigger help or how to update id based on column content

2015-02-18 Thread jose i cabrera
On 2/18/2015 6:48 PM, Igor Tandetnik wrote: > On 2/18/2015 5:10 PM, jose i cabrera wrote: >> So, in reality, all the tasks of the project of >> like "lang" minus the PM, have to be added and 10% of that total be >> calculated to the (on this instance) DE-DE PM task. > > UPDATE LSOpenJobs SET

[sqlite] Complex insert query to normalised database

2015-02-18 Thread Flakheart
Thanks Gunnar. Having never used foreign keys before, I am up for a lot of reading. Hope this isn't beyond me:):) -- View this message in context: http://sqlite.1065341.n5.nabble.com/Complex-insert-query-to-normalised-database-tp80590p80620.html Sent from the SQLite mailing list archive at

[sqlite] Appropriate Uses For SQLite

2015-02-18 Thread Adam Kennedy
But the great thing about SQLite is you don't have to go logical form in light weight apps. http://search.cpan.org/dist/ORLite/lib/ORLite.pm ORLite does a half-and-half approach that generates the easy parts of the SQL with very little code, but avoids the code weight needed to generate all of