[sqlite] Query optimizer not doing so well with my queries

2016-04-11 Thread Richard Warburton
Hi, I'm a big fan of SQLite, but I've been having some terrible speed problems when doing joins between subqueries. Strangely, if I join twice (first to the main table and then to its subquery), I can get the same answer in tenths of seconds and not minutes - or one thousand times faster. For

[sqlite] Best way to handle time slicing of SQL data.

2015-06-03 Thread Richard Warburton
tra storage as rowid would exist anyway. 2) Can I auto fill Id to UID on insert instead of having to do two operations? 3) Am I on track or is there a better way to approach this problem? Thanks in advance for any feedback. -- Richard Warburton

Re: [sqlite] Transactions for read operations

2014-09-07 Thread Richard Warburton
Thanks to those who responded to my query. Simon: It will be easier to code if every page commits, regardless of whether any write operations occurred (and rollback only error) - so your answer pleased me greatly. Keith: Yes, you're right. I'm not passing a single database connection around,

[sqlite] Transactions for read operations

2014-09-06 Thread Richard Warburton
otherwise. However, given that the page will read many times more often than it writes, I'm wondering if this is a bad idea. Thoughts? Thanks. -- Richard Warburton - MSc(Hons), PGDipSci, BE(Hons) +64 9 377-2881 ext 9 Senior Developer - http://www.skagerraksoftware.com/ Skagerrak Software - P.O.Box 56-710

Re: [sqlite] Prevent non-Integers going into int fields.

2014-08-09 Thread Richard Warburton
uch the same a conversion via affinity, producing a consistent set of results. And this has the advantage of round that text integers will still be allowed. Peter On 3 August 2014 16:52, Richard Warburton <rich...@skagerraksoftware.com> wrote: > Whilst any type going into a field is oft

[sqlite] Prevent non-Integers going into int fields.

2014-08-02 Thread Richard Warburton
Whilst any type going into a field is often seen as a big plus, there are occasions where this may be undesirable. For such occasions, I'm currently thinking that: NOT NULL CHECK( ROUND(fieldname)=fieldname ) looks ok, but I'm wondering if there's a case that still gets through or if there's a

Re: [sqlite] Only allow child record if another field in parent is false.

2014-08-02 Thread Richard Warburton
Hi, Thanks to those who gave feedback. It looks like that it will be best left to business rules. In the event that enrolmentItems are attached to leaver enrolments (due to a coding error), they will be ignored. Thanks. ___ sqlite-users mailing list

[sqlite] Only allow child record if another field in parent is false.

2014-07-31 Thread Richard Warburton
Hi, Consider: CREATE TABLE enrolment ( id INTEGER PRIMARY KEY, child INT NOT NULL REFERENCES child (id), start INT NOT NULL, leaver INT NOT NULL DEFAULT 0 CHECK (leaver BETWEEN 0 AND 1), -- BOOL ); CREATE TABLE enrolmentItem ( id INTEGER PRIMARY KEY, enrolment INT NOT NULL