Re: [sqlite] [sqlite-dev] having problems with "select where not exists"

2018-11-30 Thread Keith Medcalf
Forwarded to the sqlite-users mailing list ... Probably the spelling error ... (mf2 does not exist cuz you typed my2 as the alias) >1) One problem is that there is no column name when I include the >"as" phrase in the select statment as in >select * from myfile as mf1... >where not exists >(

[sqlite] Monitoring SQLite Web Site

2018-11-30 Thread Stephen Chrzanowski
This email is more to Dr Hipp, but, there are other members of this list that might also benefit from this site I'm about to mention. I know there are many out there, but monitoring 50 sites for free for their up-time is kind of nice. Right up front, I have exactly ZERO affiliation with the

[sqlite] Misleading error message on missing function

2018-11-30 Thread Dominique Devienne
sqlite> select json_each('[1, 3, 5]'); Error: no such function: json_each sqlite> select * from json_each('[1,2]'); 0|1|integer|1|1||$[0]|$ 1|2|integer|2|2||$[1]|$ Misusing the json_each() table-values function as a regular function yields a misleading (IMHO) "no such function" message, despite

[sqlite] Support function_list in pre-built binaries from SQLite download page

2018-11-30 Thread Dominique Devienne
sqlite> pragma function_list; sqlite> Nothing returned, so obviously the -DSQLITE_INTROSPECTION_PRAGMAS compile-time option is not used [1]. Could it be ON by default please? TIA, --DD [1] https://www.sqlite.org/pragma.html#pragma_function_list ___

Re: [sqlite] Updating Folder_Path in Windows 10 Photos App

2018-11-30 Thread Simon Slavin
On 29 Nov 2018, at 7:32pm, Carlo capaldo wrote: > select folder.Folder_Path, > replace(Folder_Path,'C:\Users\carlo\Pictures','E:\Photos') > from Folder > where folder.Folder_Id = 1 > > Could someone kindly educate me on how to update the folder references? My guess is that you actually want

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Dominique Devienne
On Fri, Nov 30, 2018 at 3:26 PM Simon Walter wrote: > On 11/30/2018 11:20 PM, Dominique Devienne wrote: > To be honest, I am using apr_dbd as I would like to support more than > just SQLite. So I will need to play around with MySQL and PostgreSQL at > least and maybe branch if SQLite is in use.

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Simon Walter
On 11/30/2018 11:20 PM, Dominique Devienne wrote: > On Fri, Nov 30, 2018 at 3:03 PM Dominique Devienne > wrote: > >> On Fri, Nov 30, 2018 at 2:44 PM Richard Hipp wrote: >> >>> On 11/30/18, Simon Walter wrote: Thanks Dominique, Much appreciated. I can now stop pulling out my

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread R Smith
On 2018/11/30 2:52 PM, Simon Walter wrote: I am trying to make a prepared statement that has a parameter such as "1, 893, 121212". obviously it is text (a string) but it cannot be quoted or the result will be: SELECT id, data FROM val WHERE id IN ("1, 893, 121212"); I understand normally I

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Dominique Devienne
On Fri, Nov 30, 2018 at 3:03 PM Dominique Devienne wrote: > On Fri, Nov 30, 2018 at 2:44 PM Richard Hipp wrote: > >> On 11/30/18, Simon Walter wrote: >> > Thanks Dominique, >> > >> > Much appreciated. I can now stop pulling out my hair. I will do >> > something with sprintf. >> >> See

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Dominique Devienne
On Fri, Nov 30, 2018 at 2:44 PM Richard Hipp wrote: > On 11/30/18, Simon Walter wrote: > > Thanks Dominique, > > > > Much appreciated. I can now stop pulling out my hair. I will do > > something with sprintf. > > See https://www.sqlite.org/carray.html Right. Any table-valued function would do

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Richard Hipp
On 11/30/18, Simon Walter wrote: > Thanks Dominique, > > Much appreciated. I can now stop pulling out my hair. I will do > something with sprintf. See https://www.sqlite.org/carray.html Or, failing that, at least use sqlite3_mprintf() rather than sprintf(). https://www.sqlite.org/printf.html

Re: [sqlite] Updating Folder_Path in Windows 10 Photos App

2018-11-30 Thread R Smith
Hi Carlo, Attachments are stripped on this forum - could you use a file service or upload it somewhere? Also be clear about the which paths all changed and to what - AND make a backup of the file before fixing it - but there most certainly is some SQL that will fix what you described.

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Simon Walter
Thanks Dominique, Much appreciated. I can now stop pulling out my hair. I will do something with sprintf. Best regards, Simon On 11/30/2018 10:37 PM, Dominique Devienne wrote: > On Fri, Nov 30, 2018 at 2:10 PM Simon Walter wrote: > >> How does one use WHERE x IN (?) with a prepared

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Dominique Devienne
On Fri, Nov 30, 2018 at 2:10 PM Simon Walter wrote: > How does one use WHERE x IN (?) with a prepared statement? What is the > correct way to do this? > You cannot do it. Must use WHERE x IN (?, ?, ?), i.e. an explicit and known in advance number of bind placeholders. Or not use binding at

[sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-11-30 Thread Simon Walter
I am trying to make a prepared statement that has a parameter such as "1, 893, 121212". obviously it is text (a string) but it cannot be quoted or the result will be: SELECT id, data FROM val WHERE id IN ("1, 893, 121212"); I understand normally I would need the quotes, such as: SELECT id, name,

Re: [sqlite] upsert from select

2018-11-30 Thread R Smith
On 2018/11/30 12:50 PM, Eric Grange wrote: Apparently adding just a "WHERE 1" clause is enough... Indeed, glad it works. PS: I used "wcount" rather because "count" is an internal SQL function. Indeed, though it seems to be accepted here, I am not using a field with my name in may actual

[sqlite] Updating Folder_Path in Windows 10 Photos App

2018-11-30 Thread Carlo capaldo
Dear Users, Windows 10 Photos App is no longer able to find my files when opening the app. I discovered that the App uses Sqlite and using DB Browser for SQLite I was able to display the Table folder which shows the many different folder paths I believe the App is referencing (see attached).

Re: [sqlite] upsert from select

2018-11-30 Thread Eric Grange
Thanks! Apparently adding just a "WHERE 1" clause is enough, ie. this passes INSERT INTO vocabulary(word, count) SELECT * FROM (SELECT 'jovial', 1) WHERE 1 ON CONFLICT(word) DO UPDATE SET count=count+1 and the "WHERE 1" also makes the query with a json_each pass (not just in the snippet I

Re: [sqlite] Detecting erroneous multi-row subqueries

2018-11-30 Thread Dominique Devienne
On Fri, Nov 30, 2018 at 3:00 AM J. King wrote: > On 2018-11-29 20:56:13, "Richard Hipp" wrote: > >On 11/29/18, J. King wrote: > >> Is it possible to make SQLite fail like PostgreSQL does? > > > >That is possible in theory, but how many of the millions of existing > >applications would that

Re: [sqlite] upsert from select

2018-11-30 Thread R Smith
This does seem like a small bug. While the SQLite devs are having a look, this Zero-cost work-around might suit your needs: Simply add a WHERE clause, for example: CREATE TABLE vocabulary (   word TEXT NOT NULL PRIMARY KEY,   wcount INT DEFAULT 1 ); WITH A(w) AS (   SELECT 'jovial' UNION ALL

[sqlite] upsert from select

2018-11-30 Thread Eric Grange
Hi, I am running into a little trouble when trying to use and "upsert" from a select clause. Starting from the "vocabulary" exemple at https://sqlite.org/lang_UPSERT.html this works INSERT INTO vocabulary(word, count) SELECT 'jovial', 1 ON CONFLICT(word) DO UPDATE SET count=count+1 but as