[sqlite] MemoryBarrier compile error on WIndows MinGW gcc 4.8.1

2015-09-05 Thread Scott Robison
On Sat, Sep 5, 2015 at 9:58 PM, Keith Medcalf wrote: > > Trunk does not compile with MinGW [gcc version 4.8.1 (GCC)] on Windows. > > sqlite3x.c: In function 'sqlite3MemoryBarrier': > sqlite3x.c:20410:17: error: expected expression before ')' token >MemoryBarrier(); > > /* > ** Try to provide

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! Sorry about that ! I confused your email with other person that was so negative and defensive about any critic to sqlite even constructive ones. I apologize again ! Cheers ! > Sat Sep 05 2015 10:19:55 pm CEST CEST from "R.Smith" >Subject: Re: [sqlite] Third test of json and

[sqlite] Thread safety problem encountered by people working on WebKit

2015-09-05 Thread Richard Hipp
On 9/5/15, Darin Adler wrote: > Hi folks. > > I?m sending this on behalf of Michael Catanzaro, a contributor to the WebKit > open source project, who is working on a WebKit bug report, "Crash when > WebCore::SQLiteFileSystem::openDatabase is called from multiple threads" >

[sqlite] BEGINNER - Transactions in shell script

2015-09-05 Thread R.Smith
On 2015-09-05 10:18 PM, Petr L?z?ovsk? wrote: > Have some shell scripts working with sqlite. Receiving incoming payments from > bank via HTTP API and pushing it into database. This script will start > periodically, every single hour. > > Want to prevent situation only few payments are written a

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread R.Smith
On 2015-09-05 08:58 PM, Domingo Alvarez Duarte wrote: > Hello ! > > Again your proposition doesn't stand up ! Again? That was my first post on the subject and it was in reply to Darko whom asked for a specific reason, so I supplied one. (Which by the way isn't to say I am 100% convinced by the

[sqlite] BEGINNER - Transactions in shell script

2015-09-05 Thread Petr Lázňovský
Have some shell scripts working with sqlite. Receiving incoming payments from bank via HTTP API and pushing it into database. This script will start periodically, every single hour. Want to prevent situation only few payments are written and script failed for some reason. Have read about sqlit

[sqlite] MemoryBarrier compile error on WIndows MinGW gcc 4.8.1

2015-09-05 Thread Keith Medcalf
Trunk does not compile with MinGW [gcc version 4.8.1 (GCC)] on Windows. sqlite3x.c: In function 'sqlite3MemoryBarrier': sqlite3x.c:20410:17: error: expected expression before ')' token MemoryBarrier(); /* ** Try to provide a memory barrier operation, needed for initialization only. */ SQLITE_

[sqlite] BEGINNER - Transactions in shell script

2015-09-05 Thread Simon Slavin
On 5 Sep 2015, at 9:18pm, Petr L?z?ovsk? wrote: > Have some shell scripts working with sqlite. Receiving incoming payments from > bank via HTTP API and pushing it into database. This script will start > periodically, every single hour. > > Want to prevent situation only few payments are writ

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! It seems that you mix apples to oranges and try to compare then. One thing is formal grammar/syntax and the other is implementation/optimization/execution. The fact that sqlite does things in one way now do not mean it's the best/definitive way of implement things and that can be c

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! Again your proposition doesn't stand up ! There is no "waste of cpu cycles" for work that is not done, I mean for the ones that write queries for the machine instead to the humans, they will continue to have the same results (less parsing steps, besides the parsing normally accounts t

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread R.Smith
On 2015-09-05 08:07 PM, Darko Volaric wrote: > So my question remains: why not have this user friendly feature? What are > the motivations for not having it? Waste of CPU cycles punishing those users who stick to valid SQL for the sins of those who like shortcuts.

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Simon Slavin
On 5 Sep 2015, at 7:07pm, Darko Volaric wrote: > That's not a valid reason since it's trivial for SQLite to transform > aliases by substituting their names with their definitions. It could be > handled in the parser code. And by doing that you would not get optimization, since SQLite would have

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Scott Robison
On Sep 5, 2015 4:10 PM, "Darko Volaric" wrote: > > That's not true. SQLite doesn't have to discard that information after > performing the substitutions. It can use it later for optimizations. > > I know that SQLite allows it. I'm not complaining about anything. Have a > look at my original questi

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! Although your explanation is interesting it doesn't seems to be correct: First of all there is no point to to do anything if the whole sql statement is no correct. I mean: - If there is any reference to inexistent columns/functions/tables/views - If any expression is not vali

[sqlite] Thread safety problem encountered by people working on WebKit

2015-09-05 Thread Darin Adler
Hi folks. I?m sending this on behalf of Michael Catanzaro, a contributor to the WebKit open source project, who is working on a WebKit bug report, "Crash when WebCore::SQLiteFileSystem::openDatabase is called from multiple threads"

[sqlite] Thread safety problem encountered by people working on WebKit

2015-09-05 Thread Darin Adler
Hi folks. I?m sending this on behalf of Michael Catanzaro, a contributor to the WebKit open source project, who is working on a WebKit bug report, "Crash when WebCore::SQLiteFileSystem::openDatabase is called from multiple threads" , which seems t

[sqlite] Second test of json and index expressions, not so good

2015-09-05 Thread Richard Hipp
On 9/4/15, Domingo Alvarez Duarte wrote: > select json_extract(json, '$.value') AS val > from json_tbl where val = 'the_value_1'; The latest trunk check-in now uses an index for this query -- D. Richard Hipp drh at sqlite.org

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Simon Slavin
On 5 Sep 2015, at 5:07pm, Darko Volaric wrote: > That's not what I said, why don't you read/quote the whole sentence: > > "Besides being part of the standard (I assume), what's the rationale for > this restriction?" > > I'm asking why the SQL standard restricts the use of aliases in this way >

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Simon Slavin
On 5 Sep 2015, at 3:19pm, Darko Volaric wrote: > Besides being part of the standard (I assume) You assume incorrectly. In the classic SQL model, aliases to column names are assigned after the results have been returned. In other words, aliases cannot be used in the WHERE clause. Simon.

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! I also prefer a "DRY" approach than be repeating things. Repetition is the mother of several errors ! Cheers ! > Sat Sep 05 2015 4:19:00 pm CEST CEST from "Darko Volaric" > Subject: Re: [sqlite] Third test of json and index >expressions, now it works > > Besides being part of

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Darko Volaric
That's not true. SQLite doesn't have to discard that information after performing the substitutions. It can use it later for optimizations. I know that SQLite allows it. I'm not complaining about anything. Have a look at my original question, which is, restated: What is the rationale behind disal

[sqlite] UNQL as an extension to sqlite3 and now could use index expressions

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! And here is the database dump for the example: ___ PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT, json_misc TEXT); INSERT INTO "users" VALUES(1,'Domingo','{"color":"cyan", "has_eyes": true}'); CREATE TABLE "unql_users"(x);

[sqlite] First test of json and index expressions, not so good

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! Yes it is but I discover later some flaws on my assumptions look at further on this thread to see the end result. Cheers ! > Sat Sep 05 2015 2:03:40 pm CEST CEST from "Luiz Am?rico" > Subject: Re: [sqlite] First test of json and index >expressions, not so good > > Em 04/09/2015 1

[sqlite] UNQL as an extension to sqlite3 and now could use index expressions

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! I did for one project a kind of sqlite3 extension using UNQL (http://unql.sqlite.org/index.html/wiki?name=UnQL) it has some flaws (and I did some bug fixes) like only performing linear scan on collections, but now with index expressions support on sqlite3 it could be revived back with in

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello again ! There is still some opportunities for constant folding that sqlite is not using, I'm not saying that is easy to implement. The same principle could be applied to deterministic functions where all of it's parameters end up been constants. _output of "sqlite3 < test.sql

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! Thanks for reply ! I still think that is worth having warnings for the already known quirks on sqlite, probably even show it to stderr when building in debug mode because I believe at some point people will do some debugging. Or maybe even better having a pragma "PRAGMA check_valid

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! Thanks to point out that plain sql is better to demonstrate a point when possible ! And after your answer I did another tests and could see that by using views then we can achieve the use of aliases in a clean way. This is supposed to be valid, doesn't it ? __Output of "

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Darko Volaric
That's not a valid reason since it's trivial for SQLite to transform aliases by substituting their names with their definitions. It could be handled in the parser code. Meanwhile it's much harder for a human to do the opposite. So my question remains: why not have this user friendly feature? What

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! > I really wish there was a way for me to fix this historical > permissiveness in SQLite without breaking millions of (miscoded) > iPhone/Android apps. I'd do so if I could. > -- > > ? > > What about the warning messages to stderr through sqlite3 when opening databases with invalid

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Simon Slavin
On 5 Sep 2015, at 10:07am, Domingo Alvarez Duarte wrote: > What about the warning messages to stderr through sqlite3 when opening > databases with invalid sql constructions, this way we can gradually have less > and less code written in a non compliant way. It might be acceptable to put warning

[sqlite] First test of json and index expressions, not so good

2015-09-05 Thread Richard Hipp
On 9/5/15, Luiz Am?rico wrote: > > Just for information > > Is json_extract from https://github.com/groner/sqlite-json ? > No. The json_extract() function at https://www.sqlite.org/src/artifact/bd51e8c1?ln=1155-1191 is a completely original implementation written by me. I did not reference or u

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Keith Medcalf
> > Besides being part of the standard (I assume) > You assume incorrectly. In the classic SQL model, aliases to column names > are assigned after the results have been returned. In other words, > aliases cannot be used in the WHERE clause. Or group by clause ... > Simon. > __

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Simon Slavin
On 5 Sep 2015, at 5:35am, Richard Hipp wrote: > I really wish there was a way for me to fix this historical > permissiveness in SQLite without breaking millions of (miscoded) > iPhone/Android apps. I'd do so if I could. That's what SQLite4 is for. I hope. Simon.

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Darko Volaric
That's not what I said, why don't you read/quote the whole sentence: "Besides being part of the standard (I assume), what's the rationale for this restriction?" I'm asking why the SQL standard restricts the use of aliases in this way and what the benefit of this restriction is. On Sat, Sep 5, 20

[sqlite] First test of json and index expressions, not so good

2015-09-05 Thread Luiz Américo
Em 04/09/2015 17:09, "Domingo Alvarez Duarte" escreveu: > > Hello ! > > This is my first test with json and index expressions ! > > How to make usage of the expression index on queries ? > > Why is json_extract so slow ? Just for information Is json_extract from https://github.com/groner/sqlite-

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Darko Volaric
Besides being part of the standard (I assume), what's the rationale for this restriction? It would seem that standard SQL is being willfully less efficient and more error prone by making the user rewrite expressions. Isn't this in the same category as manifest typing, where a more liberal approac

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Richard Hipp
On 9/4/15, Domingo Alvarez Duarte wrote: > > Would be nice to sqlite be able to recognize aliases and also do not call > column expressions multiple times. > > print("json=", db.exec_get_one("select json_extract(json, '$.value') AS val > from json_tbl where val = 'the_value_1';")); > This is not

[sqlite] Third test of json and index expressions, now it works

2015-09-05 Thread Domingo Alvarez Duarte
Hello again ! I was trying to use the alias in the where clause hopping sqlite would be smart enough to recognize it and use the index but that doesn't happen. So I tried again repeating the expression instead of using the alias and now sqlite recognize the index and run very fast. Would b

[sqlite] Second test of json and index expressions, not so good

2015-09-05 Thread Domingo Alvarez Duarte
Hello ! I was not been fair with my raw select against json_extract now I'm doing it one by one and the difference with json_extract is basically none. But I still could not manage to use the index expression to speedup the query. __Output Time to insert??? 5000??? 0.03179??? re