[sqlite] Feature Suggestions

2015-09-24 Thread Allen
> The problem with going to EXCLUSIVE manually is that you lock out other > connections for longer than necessary. I have only one connection that does writes. In any event, I wanted to confirm the readers would work correctly while another connection held an EXCLUSIVE lock, because if they

[sqlite] Feature Suggestions

2015-09-24 Thread Allen
> Why on earth are you using BEGIN EXCLUSIVE? If WAL works "as advertised", I might as well go straight to EXCLUSIVE so I don't have to later escalate the lock from RESERVED to EXCLUSIVE. And it does work just fine, once I turned off the shared cache mode.

[sqlite] Feature Suggestions

2015-09-24 Thread Allen
> I was under the apparently mistaken impression that starting any transaction would block writes, even in WAL mode. My problem was that I was using sqlite3_enable_shared_cache(true). I enabled this because I was under the impression that is required for multiple connections to share an

[sqlite] Feature Suggestions

2015-09-24 Thread Simon Slavin
On 24 Sep 2015, at 5:37pm, Allen wrote: > I was under the apparently mistaken impression that starting any > transaction would block writes, even in WAL mode. In WAL mode, a writing connection writes to the journal. Other connections will continue to read from the 'live' database. When the

[sqlite] Feature Suggestions

2015-09-24 Thread Clemens Ladisch
Allen wrote: > 1. It would be nice to have read-only transactions for use with WAL > databases. When a read-only transaction was started, it would take a > "lock" on the WAL and then not advance further into the WAL until the > transaction ended. Thus, all select statements issued while the read

[sqlite] Any database unique ID across multiple connections ?

2015-09-24 Thread Scott Hess
On Thu, Sep 24, 2015 at 4:56 AM, ALBERT Aur?lien < aurelien.albert at alyotech.fr> wrote: > @ Stephan Beal > > "Every instance of a :memory: db is a unique instance, so you cannot have > multiple connections to a single :memory: db." > > >> I know, this is one of the various reasons that made my

[sqlite] safety of WAL with SQLITE_THREADSAFE=0 on SMP system with multiple processes

2015-09-24 Thread Török Edwin
Hi, When -DSQLITE_THREADSAFE=0 is used then unixShmBarrier becomes a noop because unixEnterMutex/unixLeaveMutex are empty functions. Digging through the SQLite source code I found this comment: /* Read the header. This might happen concurrently with a write to the ** same area of shared memory

[sqlite] Trigger, fetch matching rows and process/insert each row into multiple tables?

2015-09-24 Thread Daniel Polski
Hello again, I think I can simplify the actual question: Can I use a SELECT returning multiple rows as input to some INSERT logic, and in that logic INSERT into multiple tables? Like if I have a table t1 containing id 1, 2, 3. For each id in t1, do INSERT INTO t2 (...) INSERT INTO t3 (...)

[sqlite] Any database unique ID across multiple connections ?

2015-09-24 Thread Kees Nuyt
On Thu, 24 Sep 2015 11:42:27 +0200, ALBERT Aur?lien wrote: >Hi, > >I'm using SQLite C API and my application use multiple databases, each >database having multiple connections. >I need to identify which connection use the same database as another >connection. >For the moment, I use the

[sqlite] Any database unique ID across multiple connections ?

2015-09-24 Thread ALBERT Aurélien
@ Stephan Beal "Every instance of a :memory: db is a unique instance, so you cannot have multiple connections to a single :memory: db." >> I know, this is one of the various reasons that made my solution not really >> ideal @ Simon Slavin "There's a PRAGMA for storing and retrieving a

[sqlite] Trigger, fetch matching rows and process/insert each row into multiple tables?

2015-09-24 Thread Daniel Polski
Den 2015-09-24 kl. 13:03, skrev Simon Slavin: > On 24 Sep 2015, at 11:38am, Daniel Polski wrote: > >> -- Here is where my real question starts. Can I fetch a list of rows in a >> trigger >> -- and update different tables from that data? > Create a VIEW which does this > > SELECT ... FROM t1 JOIN

[sqlite] Feature Suggestions

2015-09-24 Thread Keith Medcalf
> > WAL does this already. You just need to BEGIN a transaction when you > want it to BEGIN and COMMIT or ROLLBACK when you are done with it. > > I was under the apparently mistaken impression that starting any > transaction would block writes, even in WAL mode. > > Just to be clear, this would

[sqlite] Trigger, fetch matching rows and process/insert each row into multiple tables?

2015-09-24 Thread Daniel Polski
Hello! --Table t1 contains some "base" data CREATE TABLE t1 ( idINTEGER PRIMARY KEY, name VARCHAR(10), value INT NOT NULL ); INSERT INTO t1 VALUES(1, 't1 1', 0); INSERT INTO t1 VALUES(2, 't1 2', 0); --Table t2 can contain extra data for a row in table t1 CREATE TABLE t2(

[sqlite] Feature Suggestions

2015-09-24 Thread Allen
> WAL does this already. You just need to BEGIN a transaction when you want it to BEGIN and COMMIT or ROLLBACK when you are done with it. I was under the apparently mistaken impression that starting any transaction would block writes, even in WAL mode. Just to be clear, this would work: On

[sqlite] Trigger, fetch matching rows and process/insert each row into multiple tables?

2015-09-24 Thread Simon Slavin
On 24 Sep 2015, at 11:38am, Daniel Polski wrote: > -- Here is where my real question starts. Can I fetch a list of rows in a > trigger > -- and update different tables from that data? Create a VIEW which does this SELECT ... FROM t1 JOIN t2 ON t2.t1_id = t1.id Then set the triggers for the

[sqlite] Any database unique ID across multiple connections ?

2015-09-24 Thread Stephan Beal
On Thu, Sep 24, 2015 at 11:42 AM, ALBERT Aur?lien < aurelien.albert at alyotech.fr> wrote: > (for example, if one day I need the same about ":memory:" databases, bad > things are gonna to happen) > Every instance of a :memory: db is a unique instance, so you cannot have multiple connections to

[sqlite] Any database unique ID across multiple connections ?

2015-09-24 Thread ALBERT Aurélien
Hi, I'm using SQLite C API and my application use multiple databases, each database having multiple connections. I need to identify which connection use the same database as another connection. For the moment, I use the absolute database filename as an "unique database identifier", and I

[sqlite] Feature Suggestions

2015-09-24 Thread Allen
Suggestions for SQLite features: 1. It would be nice to have read-only transactions for use with WAL databases. When a read-only transaction was started, it would take a "lock" on the WAL and then not advance further into the WAL until the transaction ended. Thus, all select statements issued

[sqlite] Any database unique ID across multiple connections ?

2015-09-24 Thread Simon Slavin
On 24 Sep 2015, at 10:42am, ALBERT Aur?lien wrote: > I need to identify which connection use the same database as another > connection. > > For the moment, I use the absolute database filename as an "unique database > identifier", and I store this information with my "sqlite3*" connection

[sqlite] Fwd: Outdated section of docs?

2015-09-24 Thread Dave McKee
Hmmm... actually, looks like Windows 10 has regressed back to only having one set of DST rules... Manually changed timezone to Pacific US. Results are from before reboot but don't seem to have changed after. David. Windows 10 Dates from https://www.timeanddate.com/time/dst/1985.html Using

[sqlite] Trigger, fetch matching rows and process/insert each row into multiple tables?

2015-09-24 Thread Marco
Excerpts from Daniel Polski's message of 2015-09-24 09:50:36 -0300: > > Hello again, > I think I can simplify the actual question: > > Can I use a SELECT returning multiple rows as input to some INSERT > logic, and in that logic INSERT into multiple tables? That was exactly what I showed you

[sqlite] Feature Suggestions

2015-09-24 Thread Keith Medcalf
On Thursday, 24 September, 2015 08:53, Allen said: > Suggestions for SQLite features: > 1. It would be nice to have read-only transactions for use with WAL > databases. When a read-only transaction was started, it would take a > "lock" on the WAL and then not advance further into the WAL

[sqlite] safety of WAL with SQLITE_THREADSAFE=0 on SMP system with multiple processes

2015-09-24 Thread Richard Hipp
On 9/24/15, T?r?k Edwin wrote: > Hi, > > When -DSQLITE_THREADSAFE=0 is used then unixShmBarrier becomes a noop > because unixEnterMutex/unixLeaveMutex are empty functions. Good observation. This problem is addressed by

[sqlite] Trigger, fetch matching rows and process/insert each row into multiple tables?

2015-09-24 Thread Marco
Excerpts from Daniel Polski's message of 2015-09-24 07:38:24 -0300: > Hello! > > --Table t1 contains some "base" data > CREATE TABLE t1 ( > idINTEGER PRIMARY KEY, > name VARCHAR(10), > value INT NOT NULL > ); > > INSERT INTO t1 VALUES(1, 't1 1', 0); > INSERT INTO t1 VALUES(2,

[sqlite] Fwd: Outdated section of docs?

2015-09-24 Thread Keith Medcalf
On Thursday, 24 September, 2015 03:36, Dave McKee said: > Hmmm... actually, looks like Windows 10 has regressed back to only having > one set of DST rules... Windows at Vista and later can have an (unlimited) set of DST rules for each Microsoft Time Zone (Microsoft Time Zone's can only be