[sqlite] Fwd: PRAGMA writable_schema and schema_version: changes are ignored on the same connection

2018-06-20 Thread Barry
Trying again since this didn't go through the first time... This started off as a bug report about the writable schema method recommended in https://www.sqlite.org/lang_altertable.html, but I realised the problem is a bit broader. It seems SQLite is ignoring manual changes to sqlite_master when

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread Igor Korot
David, On Wed, Jun 20, 2018 at 9:12 PM, David Empson wrote: > Apart from the SQLITE_OK vs SQLITE_ROW/DONE check on the sqlite3_step() call > mentioned already, you also have the third parameter to sqlite_prepare_v2() > wrong: nByte = NULL will translate to nByte = 0 which is documented as “no

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread David Empson
Apart from the SQLITE_OK vs SQLITE_ROW/DONE check on the sqlite3_step() call mentioned already, you also have the third parameter to sqlite_prepare_v2() wrong: nByte = NULL will translate to nByte = 0 which is documented as “no prepared statement is generated”. Therefore stmt is not valid and s

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread David Burgess
; On Thu, Jun 21, 2018 at 12:03 PM, Igor Korot wrote: > Richard, > > On Wed, Jun 20, 2018 at 8:17 PM, Richard Hipp wrote: >> On 6/20/18, Igor Korot wrote: >>> if( ( res = sqlite3_step( stmt ) ) == SQLITE_OK ) >> >> sqlite3_step() returns SQLITE_ROW when it has data, not

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread Igor Korot
Richard, On Wed, Jun 20, 2018 at 8:17 PM, Richard Hipp wrote: > On 6/20/18, Igor Korot wrote: >> if( ( res = sqlite3_step( stmt ) ) == SQLITE_OK ) > > sqlite3_step() returns SQLITE_ROW when it has data, not SQLITE_OK. But SQLITE_ROW value is not 21 - its 101. Thank you.

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread Richard Hipp
On 6/20/18, Igor Korot wrote: > if( ( res = sqlite3_step( stmt ) ) == SQLITE_OK ) sqlite3_step() returns SQLITE_ROW when it has data, not SQLITE_OK. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread Igor Korot
Hi, guys, I put in this code: if( sqlite3_prepare_v2( m_db, "PRAGMA schema_version", NULL, &stmt, NULL ) == SQLITE_OK ) { if( ( res = sqlite3_step( stmt ) ) == SQLITE_OK ) { m_schema

Re: [sqlite] How to use WHERE clause in UPSERT's conflict target

2018-06-20 Thread Richard Hipp
On 6/20/18, Jonathan Koren wrote: > > The grammar & documentation > shows > a WHERE clause can be given in the "conflict target" of the UPSERT, but the > documentation does not explain how the result of this clause impacts the > statement. As a test,

[sqlite] How to use WHERE clause in UPSERT's conflict target

2018-06-20 Thread Jonathan Koren
Hello sqlite-users, I am trying out the new UPSERT feature introduced in 3.24.0 and ran into something I don't quite understand. First some setup: CREATE TABLE notes( guid TEXT UNIQUE NOT NULL, content TEXT ); INSERT INTO notes (guid, content) VALUES ('a1', 'foo'), ('b2', 'bar')

Re: [sqlite] System.Data.SQLite version 1.0.108 - .NET 2.0 no service pack compatibility

2018-06-20 Thread Joe Mistachkin
It may work without Service Pack 2; however, it has not been tested in that configuration. Sent from my iPhone > On Jun 20, 2018, at 7:45 AM, Bianchi Lorenzo > wrote: > > Hi everybody, > > We are currently using the SQlite.dll version 1.0.98 x86 for .NET 2.0, and it > seems to be working a

[sqlite] System.Data.SQLite version 1.0.108 - .NET 2.0 no service pack compatibility

2018-06-20 Thread Bianchi Lorenzo
Hi everybody, We are currently using the SQlite.dll version 1.0.98 x86 for .NET 2.0, and it seems to be working also on old PCs with .NET 2.0 basic, without Service Pack. We are thinking to upgrade to version 1.0.108 since it has support for both x86 and x64, but I don't know if Service Pack 2

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread Simon Slavin
On 20 Jun 2018, at 12:29pm, Simon Slavin wrote: > On 20 Jun 2018, at 7:24am, Peter Johnson wrote: > >> Is it possible to create a trigger on sqlite_master which calls a >> user-defined function AFTER INSERT? > > No. sqlite_master is modified using internal methods, not using an INSERT > comm

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread Simon Slavin
On 20 Jun 2018, at 7:24am, Peter Johnson wrote: > Is it possible to create a trigger on sqlite_master which calls a > user-defined function AFTER INSERT? No. sqlite_master is modified using internal methods, not using an INSERT command. TRIGGERs on it won't work. Simon. _

[sqlite] 'Best' way to create calculated field

2018-06-20 Thread Cecil Westerhof
At the moment I have the following query: SELECT Minimum , Maximum , Maximum - Minimum AS Range FROM ( SELECT MIN(totalUsed) AS Minimum , MAX(totalUsed) AS Maximum FROM quotes ) I like this better as: SELECT MIN(totalUsed) AS Minimum , MAX(total

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread R Smith
On 2018/06/20 7:05 AM, Igor Korot wrote: One more question: I presume I should call PRAGMA schema_version right after connection has been made, cache the value returned and then create a secondary thread which will call this query continuously. Am I right? That is up to you, but what you nee

Re: [sqlite] Check if the new table has been created

2018-06-20 Thread R Smith
--Re-posted from correct address - apologies if this comes through twice-- On 2018/06/20 7:05 AM, Igor Korot wrote: One more question: I presume I should call PRAGMA schema_version right after connection has been made, cache the value returned and then create a secondary thread which will call

[sqlite] https://www.sqlite.org/cgi/src/info/7fa8f16e586a52ac

2018-06-20 Thread Cezary H. Noweta
Hello, ** ieee754(4503599627370496,972) -> +Inf ** ieee754(4503599627370496,972) -> -Inf Missing - in the second mantissa, and a next missing -: }else if( m==0 && e>1000 && e<1000 ){ sqlite3_result_double(context, 0.0); return; } gives: ieee754(0,0) == 4