Re: [sqlite] [EXTERNAL] Distinguish type of statements

2019-03-19 Thread Hick Gunter
Apart from the already mentioned authorizer callbakc , there is the sqlite3_stmt_readonly() function. see https://sqlite.org/c3ref/stmt_readonly.html -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von siscia Gesendet: Diensta

Re: [sqlite] .import fails CHECK constraint on valid data

2019-03-19 Thread D Burgess
> > For good or bad, check constraints appear to be evaluated before this > conversion. I call that very bad. On Wed, Mar 20, 2019 at 7:58 AM Shawn Wagner wrote: > A manual INSERT demonstrates the same behavior, actually. Using your Tc > table: > > sqlite> insert into Tc values ('12'); > Error:

Re: [sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Keith Medcalf
See also: https://sqlite.org/unlock_notify.html --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Med

Re: [sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Keith Medcalf
SQLITE_LOCKED is an immediate return (that is, it returns immediately, it is not subject to automatic retries or timeouts or the busy/wait handler -- it is an error indication, not necessarily a transient condition). You may use the sqlite3_unlock_notify API (assuming that you have compiled y

[sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Simon Slavin
(For those playing along at home, SQLITE_LOCKED is a special-case version of SQLITE_BUSY. You get it only when the competing access attempts come from the same connection (multi-tasking) or different connections sharing the same cache.) Suppose I'm in a situation where I would get SQLITE_LOCKE

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Simon Davies
On Tue, 19 Mar 2019 at 15:07, Tim Streater wrote: > > My use case is a mixture of these. My need is to copy a row from a table in > one db (db1) to a table with identical schema in another db (db2). The > complication is that there is an id column, so the row needs to get a new id > in db2. > >

Re: [sqlite] Distinguish type of statements

2019-03-19 Thread Simon Slavin
On 19 Mar 2019, at 8:53pm, siscia wrote: > Do you think it would be possible to add a function that does what I need? No. I've not part of the development team but I think it's quite complicated. Also, the fact that there's already a function which does what you want makes it unlikely there'

Re: [sqlite] .import fails CHECK constraint on valid data

2019-03-19 Thread Shawn Wagner
A manual INSERT demonstrates the same behavior, actually. Using your Tc table: sqlite> insert into Tc values ('12'); Error: CHECK constraint failed: Tc The thing about .import is that, instead of guessing what type each value it reads is, they're all just bound to an insert statement as strings.

Re: [sqlite] Distinguish type of statements

2019-03-19 Thread siscia
Hi Simon, Thanks! Indeed I thought about a similar solution but it seems a little contrived. Do you think it would be possible to add a function that does what I need? How is the design coordinated? Where should I post my RFC? Cheers, Simone -- Sent from: http://sqlite.1065341.n5.nabble.com/

Re: [sqlite] .import fails CHECK constraint on valid data

2019-03-19 Thread James K. Lowden
On Sun, 10 Mar 2019 17:04:46 -0400 "James K. Lowden" wrote: > Why does the .import command cause the CHECK constraint to fail, when > an ordinary INSERT does not? On Sun, 10 Mar 2019 14:12:33 -0700 Shawn Wagner wrote: > The check constraint is probably being evaluated (with t as a string) >

Re: [sqlite] Distinguish type of statements

2019-03-19 Thread Simon Slavin
On 19 Mar 2019, at 6:40pm, siscia wrote: > Given a statement, is there any way to know if it is an UPDATE, DELETE, > INSERT, SELECT or something else? It's not simple but if you are actually trying to execute that statement, you can register an authorizer function.

[sqlite] Distinguish type of statements

2019-03-19 Thread siscia
Hi All, I am already afraid that the answer to the question will be "no", but it will save a lot of development effort on my side, so is worth to ask. Given a statement, is there any way to know if it is an UPDATE, DELETE, INSERT, SELECT or something else? Thanks, Simone -- Sent from: http://

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Tim Streater
On 19 Mar 2019, at 13:46, R Smith wrote: > Three ways in SQL to create and fill a table with data from another: > > 1. CREATE ... AS > Example: > CREATE TABLE newTable AS SELECT a,b,c FROM oldTable; > 2. CREATE TABLE + INSERT > Example: > CREATE TABLE newTable(a INT, b REAL, c TEXT); > INSERT IN

Re: [sqlite] Recursive CTE on tree with doubly linked items

2019-03-19 Thread Joshua Wise
> On Mar 18, 2019, at 5:21 AM, Keith Medcalf wrote: > > UPDATE tree > SET position = (SELECT position FROM _children WHERE id = tree.id) -- > Multiply by x to number by x > WHERE id IN (SELECT id FROM _children); > DELETE FROM _children; > END; I don’t see the window function causing a

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Wow! Thanks. I did not know these choices. Now I do. ;-) From: sqlite-users on behalf of R Smith Sent: Tuesday, March 19, 2019 09:46 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] INSERTing from another table data I see the "ignore this" retraction, but I thought to mentio

Re: [sqlite] FTS5 Transaction Leads to OOB Read

2019-03-19 Thread Chu
YES. AFL with ASAN. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread R Smith
I see the "ignore this" retraction, but I thought to mention the following any way, for future reference: Three ways in SQL to create and fill a table with data from another: 1. CREATE ... AS Example: CREATE TABLE newTable AS SELECT a,b,c FROM oldTable; (This method has the advantage of being f

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Ignore this. Sorry. I should always count to 10 before sending things. Apologies. From: sqlite-users on behalf of Jose Isaias Cabrera Sent: Tuesday, March 19, 2019 09:15 AM To: sqlite-users@mailinglists.sqlite.org Subject: [sqlite] INSERTing from another t

[sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Greetings. I have this table, create table a (a, b, c); insert into a values (1, 2, 3); insert into a values (2, 3, 4); insert into a values (3, 4, 5); insert into a values (4, 5, 6); insert into a values (5, 6, 7); insert into a values (6, 7, 8); and I also have this table, create tab