Re: [sqlite] sqlite3_prepare16_v3 and prepFlags

2017-08-02 Thread Nico Williams
On Wed, Aug 02, 2017 at 11:01:07PM +0100, Bart Smissaert wrote: > Using 3.20.0 now on Windows and wonder when exactly I should use the > SQLITE_PREPARE_PERSISTENT > > flag > instead of a zero. I have tried both

[sqlite] sqlite3_prepare16_v3 and prepFlags

2017-08-02 Thread Bart Smissaert
Using 3.20.0 now on Windows and wonder when exactly I should use the SQLITE_PREPARE_PERSISTENT flag instead of a zero. I have tried both options with a plain select statement producing some 10 rows. Both worked

Re: [sqlite] Pointers in 3.20.0 are great! Dreaming of better

2017-08-02 Thread Nico Williams
Another thing is that with serializers the shell could automatically serialize on output if desired. Also, the callbacks could be attached to a "type", and perhaps that way you could preserve the APIs you already added for pointer values. ___

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
ok thank you for the confirmation, I will try implementing it in a dll using UD functions and put it on github. Le mer. 2 août 2017 à 20:56, Richard Hipp a écrit : > On 8/2/17, Sylvain Pointeau wrote: > > > > is it really possible to make an update

Re: [sqlite] sequencer

2017-08-02 Thread Richard Hipp
On 8/2/17, Sylvain Pointeau wrote: > > is it really possible to make an update into that nextval function? I don't > think so since only one statement can be run at the same time if sqlite is > in serialized mode. "serialized" means that multiple threads cannot be

Re: [sqlite] sequencer

2017-08-02 Thread Nico Williams
On Wed, Aug 02, 2017 at 06:46:55PM +, Sylvain Pointeau wrote: > if I do > > insert into mytable(f) > select nextval("myseq") from T > > is it really possible to make an update into that nextval function? I don't > think so since only one statement can be run at the same time if sqlite is >

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
if I do insert into mytable(f) select nextval("myseq") from T is it really possible to make an update into that nextval function? I don't think so since only one statement can be run at the same time if sqlite is in serialized mode. Le mer. 2 août 2017 à 20:25, Nico Williams

Re: [sqlite] sequencer

2017-08-02 Thread Nico Williams
On Wed, Aug 02, 2017 at 06:10:52PM +, Sylvain Pointeau wrote: > for a general case, I would need to persist the counter into a table (for a > specified sequencer) and doing the nextval inside a mutex lock > > Is it possible to insert/ select from a UDF if the statements are > serialized? or

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
Thank you Nico! for a general case, I would need to persist the counter into a table (for a specified sequencer) and doing the nextval inside a mutex lock Is it possible to insert/ select from a UDF if the statements are serialized? or should I use the virtual tables? (should we store the

Re: [sqlite] sequencer

2017-08-02 Thread Nico Williams
On Wed, Aug 02, 2017 at 05:41:38PM +0100, Simon Slavin wrote: > On 2 Aug 2017, at 5:35pm, Nico Williams wrote: > > On Wed, Aug 02, 2017 at 04:56:34PM +0100, Simon Slavin wrote: > >> Can someone explain ? > > > > They make it easy to have N tables with the same rowid

Re: [sqlite] sequencer

2017-08-02 Thread Nico Williams
On Wed, Aug 02, 2017 at 07:48:52PM +0300, Alek Paunov wrote: > On 2017-08-02 18:23, Sylvain Pointeau wrote: > ... > > > >CREATE SEQUENCE IF NOT EXISTS SEQ_1 START WITH 12123; > > > >insert into MYTABLE(SPECIFIED_NUMBER, OTHERINFO) values (seq_1.nextval, > >'other info') > > > > BTW, your request

Re: [sqlite] sequencer

2017-08-02 Thread Alek Paunov
On 2017-08-02 18:23, Sylvain Pointeau wrote: ... CREATE SEQUENCE IF NOT EXISTS SEQ_1 START WITH 12123; insert into MYTABLE(SPECIFIED_NUMBER, OTHERINFO) values (seq_1.nextval, 'other info') BTW, your request is somewhat related with the brand new union-vtab SQLite extension [1] (for

Re: [sqlite] sequencer

2017-08-02 Thread Simon Slavin
On 2 Aug 2017, at 5:35pm, Nico Williams wrote: > On Wed, Aug 02, 2017 at 04:56:34PM +0100, Simon Slavin wrote: >> Can someone explain ? > > Think of sequences as non-deterministic functions. (They are actually > deterministic, but using hidden state, so from the

Re: [sqlite] sequencer

2017-08-02 Thread Nico Williams
On Wed, Aug 02, 2017 at 04:56:34PM +0100, Simon Slavin wrote: > On 2 Aug 2017, at 4:54pm, Peter Da Silva > wrote: > > Can’t you do the same basic logic then use (SELECT value FROM > > super_sequences WHERE id=’SEQ_1’) instead of SEQ_1.nextval? > > Actually, I

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
your solution is only for one row as opposed to my example creating many rows On Wed, 2 Aug 2017 at 18:27, Peter Da Silva wrote: > By “the same thing” I mean: > > BEGIN; > something like the stuff I had in my original post where it’s incrementing > the sequence; >

Re: [sqlite] sequencer

2017-08-02 Thread Peter Da Silva
By “the same thing” I mean: BEGIN; something like the stuff I had in my original post where it’s incrementing the sequence; your statement where you’re using the sequence, except using something like (SELECT value FROM super_sequences WHERE id=’SEQ_1’); COMMIT; On 8/2/17, 11:20 AM,

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
On Wed, Aug 2, 2017 at 5:54 PM, Peter Da Silva < peter.dasi...@flightaware.com> wrote: > Can’t you do the same basic logic then use (SELECT value FROM > super_sequences WHERE id=’SEQ_1’) instead of SEQ_1.nextval? > > > insert into mytable (MY_NO, MY_INFO) > SELECT SEQ_1.nextval, a.INFO

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
On Wed, Aug 2, 2017 at 5:56 PM, Simon Slavin wrote: > > > On 2 Aug 2017, at 4:54pm, Peter Da Silva > wrote: > > > Can’t you do the same basic logic then use (SELECT value FROM > super_sequences WHERE id=’SEQ_1’) instead of SEQ_1.nextval? > >

Re: [sqlite] sequencer

2017-08-02 Thread Simon Slavin
On 2 Aug 2017, at 4:54pm, Peter Da Silva wrote: > Can’t you do the same basic logic then use (SELECT value FROM super_sequences > WHERE id=’SEQ_1’) instead of SEQ_1.nextval? Actually, I don’t understand how sequences are superior to normal use of an AUTOINC

Re: [sqlite] sequencer

2017-08-02 Thread Peter Da Silva
Can’t you do the same basic logic then use (SELECT value FROM super_sequences WHERE id=’SEQ_1’) instead of SEQ_1.nextval? On 8/2/17, 10:48 AM, "sqlite-users on behalf of Sylvain Pointeau" wrote: On Wed,

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
On Wed, Aug 2, 2017 at 5:43 PM, Peter Da Silva < peter.dasi...@flightaware.com> wrote: > Hence the suggestion to script a transaction. For example, in pseudocode: > > BEGIN; > SELECT value, increment from super_sequences where table = :table and > column = :column; > INSERT INTO :table (id,

Re: [sqlite] sequencer

2017-08-02 Thread Simon Slavin
On 2 Aug 2017, at 4:37pm, Sylvain Pointeau wrote: > Yes I am aware of autoinc but this is not what I can use, because I need to > specify exactly the sequence (as start number and increment). Additionally > I can have tables having 2 or 3 fields needing a specified

Re: [sqlite] sequencer

2017-08-02 Thread Peter Da Silva
Hence the suggestion to script a transaction. For example, in pseudocode: BEGIN; SELECT value, increment from super_sequences where table = :table and column = :column; INSERT INTO :table (id, other, fields) VALUES :(value+increment,other,values); UPDATE super_sequences set value = :(value +

Re: [sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
On Wed, Aug 2, 2017 at 5:27 PM, Peter Da Silva < peter.dasi...@flightaware.com> wrote: > Have a look at https://sqlite.org/autoinc.html > Yes I am aware of autoinc but this is not what I can use, because I need to specify exactly the sequence (as start number and increment). Additionally I can

Re: [sqlite] sequencer

2017-08-02 Thread Peter Da Silva
Have a look at https://sqlite.org/autoinc.html Also keep in mind that latency for SQLITE is low, since it’s not client-server, so you can script a transaction that has any sequence behavior you want with similar overhead to having SQLITE implement the sequence for you. On 8/2/17, 10:23 AM,

[sqlite] sequencer

2017-08-02 Thread Sylvain Pointeau
Dear all, I am currently using H2 and I use sequencers like: CREATE SEQUENCE IF NOT EXISTS SEQ_1 START WITH 12123; insert into MYTABLE(SPECIFIED_NUMBER, OTHERINFO) values (seq_1.nextval, 'other info') I would like to move to sqlite, but what would be your advice for the sequencer values? Is it

[sqlite] Feature request: check for 'lib' prefix for load_extension()

2017-08-02 Thread Matt Chambers
load_extension() has the very sensible behavior of: > So for example, if "samplelib" cannot be loaded, then names like > "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might be tried > also. I would like to see that extended to include "libsamplelib.so" since that is the default naming