Re: [sqlite] json() number value parsing

2017-04-10 Thread Jens Alfke
> On Apr 10, 2017, at 6:37 AM, Dominique Devienne wrote: > > I ran into http://json5.org/ which is an interesting > "for-humans" extension to JSON. I love JSON5. It’s an extension of JSON that adds extra syntax from JavaScript, like single quotes,

[sqlite] sqlite3_step and ORDER BY random() question.

2017-04-10 Thread Reid Thompson
hi, and thanks. my questions are, if I prepare and utilize a statement for a result set in the tens of thousands (or more) using a where clause along the lines of    "ORDER BY batch_id, due_datetime, random()" 1) As I sqlite3_step through the result set, am I guaranteed to get each row only

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-10 Thread Simon Slavin
On 10 Apr 2017, at 9:28pm, Reid Thompson wrote: > my questions are, if I prepare and utilize a statement for a result set > in the tens of thousands (or more) using a where clause along the lines > of >"ORDER BY batch_id, due_datetime, random()" > > 1) As I

Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-10 Thread Daniel Anderson
ok, but then namespace ns1 { extern "C" int ert(void) { return 9; } }; namespace ns2 { extern "C" int ert(void); }; are both the same function ! it would be simpler in the sqlite case to define Mem to something else before include, and then undef it instead of playing with namespace

Re: [sqlite] Errors opening WAL-based databases with SQLITE_OPEN_READONLY

2017-04-10 Thread Jens Alfke
> On Apr 10, 2017, at 2:21 PM, J. King wrote: > > It is not possible to open read-only WAL databases. The opening process must > have write privileges for "-shm" wal-index shared memory file associated with > the database, if that file exists, or else write access on the

Re: [sqlite] Errors opening WAL-based databases with SQLITE_OPEN_READONLY

2017-04-10 Thread Simon Slavin
On 11 Apr 2017, at 12:22am, Jens Alfke wrote: > It only states that the process must be able to create/write the -shm file. > It doesn't say anything about opening the database with SQLITE_OPEN_READONLY The problem here is not whether you’re allowing SQLite to make changes

Re: [sqlite] Errors opening WAL-based databases with SQLITE_OPEN_READONLY

2017-04-10 Thread J. King
On April 10, 2017 5:14:23 PM EDT, Jens Alfke wrote: >I'm aware that a database in WAL mode can't be opened read-only if its >directory isn't writeable[1]. However, I'm unexpectedly getting errors >opening a database when the directory _is_ writeable, but the database >is

Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-10 Thread dip
I am mixing C and C++ code. My code is in C++, SQLite is in C. Just create memory.h: namespace Mem { // some functions } And create code.cpp: #include "memory.h" #include "sqlite3.h" void Func() { Mem::SomeFunc(); // gives the compilation error } Sent with [ProtonMail](https://protonmail.com)

Re: [sqlite] json() number value parsing

2017-04-10 Thread Dominique Devienne
On Sun, Apr 9, 2017 at 10:34 AM, Olivier Mascia wrote: > > Le 9 avr. 2017 à 03:08, Jens Alfke a écrit : > > > >> On Apr 7, 2017, at 5:26 PM, Rolf Ade wrote: > >> ./sqlite3 > >> SQLite version 3.19.0 2017-04-07 20:20:08 > >> [...] > >>

Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-10 Thread Olivier Mascia
> Le 10 avr. 2017 à 11:11, dip a écrit : > > I am mixing C and C++ code. My code is in C++, SQLite is in C. > Just create memory.h: > > namespace Mem { > // some functions > } > > And create code.cpp: > > #include "memory.h" > #include "sqlite3.h" > > void Func() > { >

Re: [sqlite] json() number value parsing

2017-04-10 Thread Richard Hipp
On 4/10/17, Dominique Pellé wrote: > > SQLite json could be added to https://github.com/nst/JSONTestSuite > (in the parsers/ directory). > Thanks for the pointer. I did not know about that project. SQLite returns true from json_valid() for the following cases which

Re: [sqlite] json() number value parsing

2017-04-10 Thread Richard Hipp
On 4/10/17, Richard Hipp wrote: > SQLite returns true from json_valid() for the following cases which > should allegedly be false: > > n_multidigit_number_then_00.json > n_string_unescaped_newline.json > n_string_unescaped_tab.json > The second and third are now fixed on

Re: [sqlite] json() number value parsing

2017-04-10 Thread Dominique Pellé
Dominique Devienne wrote: > On Sun, Apr 9, 2017 at 10:34 AM, Olivier Mascia wrote: > >> > Le 9 avr. 2017 à 03:08, Jens Alfke a écrit : >> > >> >> On Apr 7, 2017, at 5:26 PM, Rolf Ade wrote: >> >> ./sqlite3 >> >>

Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-10 Thread Bob Friesenhahn
On Mon, 10 Apr 2017, Olivier Mascia wrote: This is where I do: #include "memory.h" namespace sqlite { #include "sqlite3.h" } And the conflict with your Mem goes away for the price of qualifying your references to SQLite symbols with 'sqlite::'. It fits me easily because we have our own slim

Re: [sqlite] json() number value parsing

2017-04-10 Thread Dominique Devienne
On Mon, Apr 10, 2017 at 2:27 PM, Richard Hipp wrote: > On 4/10/17, Richard Hipp wrote: > > SQLite returns true from json_valid() for the following cases which > > should allegedly be false: > > > > n_multidigit_number_then_00.json > >

Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-10 Thread Daniel Anderson
as Sqlite is already within extern "C" I'm wondering how your namespace trick can work ? 2017-04-10 9:41 GMT-04:00 Bob Friesenhahn : > On Mon, 10 Apr 2017, Olivier Mascia wrote: > >> >> This is where I do: >> >> #include "memory.h" >> namespace sqlite >> { >>

Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-10 Thread Daniel Anderson
Ah, understood. I thought you had a struct or a class named Mem. then short term solution is to rename Mem in sqlite.h using the #define directive + include file should do the trick. as they say solve it by using a level of indirection! It will be a bit ugly, but until a) sqlite change the

[sqlite] Errors opening WAL-based databases with SQLITE_OPEN_READONLY

2017-04-10 Thread Jens Alfke
I'm aware that a database in WAL mode can't be opened read-only if its directory isn't writeable[1]. However, I'm unexpectedly getting errors opening a database when the directory _is_ writeable, but the database is opened read-only. Specifically: * The database file is in WAL mode. * The -wal

Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-10 Thread Olivier Mascia
> Le 10 avr. 2017 à 16:21, Daniel Anderson a écrit : > > as Sqlite is already within extern "C" > > I'm wondering how your namespace trick can work ? Both are simply unrelated. extern "C" is a linkage specification. Not a namespace declaration. -- Best Regards, Meilleures