Re: [sqlite] Create database

2017-04-14 Thread Daniel Anderson
http://lmgtfy.com/?q=sqlite+c%2B%2B+wrapper 2017-04-15 0:05 GMT-04:00 Keith Medcalf : > > What existing one? SQLite3 is written in C ... > > -- > ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı > > > -Original Message- > > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.s

Re: [sqlite] Create database

2017-04-14 Thread Keith Medcalf
What existing one? SQLite3 is written in C ... -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı > -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Daniel Anderson > Sent: Friday, 14 April, 2017 21:11 > To: SQLite mailing

Re: [sqlite] Create database

2017-04-14 Thread Daniel Anderson
you would probably be better off using C++ to handle everything, less chances of forgetting to close something. do not build your own classes, use existing one! 2017-04-14 10:44 GMT-04:00 Igor Korot : > Keith, > > On Fri, Apr 14, 2017 at 10:37 AM, Keith Medcalf > wrote: > > > > To further clari

Re: [sqlite] Malformed databases and multithreading

2017-04-14 Thread Simon Slavin
On 14 Apr 2017, at 10:53pm, Paul Egli wrote: > On the "how to corrupt" page ( http://sqlite.org/howtocorrupt.html ) i > do not see any mention of using SQLite in an incorrect way with > respect to thread safety. Is there really no way that, for example, > using the same connection on multiple th

[sqlite] Malformed databases and multithreading

2017-04-14 Thread Paul Egli
Main question/comment: - On the "how to corrupt" page ( http://sqlite.org/howtocorrupt.html ) i do not see any mention of using SQLite in an incorrect way with respect to thread safety. Is there really no way that, for example, using the same connection on multiple threads at the same time cou

Re: [sqlite] Optimization opportunity

2017-04-14 Thread Wolfgang Enzinger
Am Fri, 14 Apr 2017 15:14:12 -0400 schrieb Richard Hipp: > But I've spent Good Friday working around it. A thousand thanks! :-) > Please try using the tip of the left-join-view branch > (https://www.sqlite.org/src/timeline?c=left-join-view) and let me know > if that version works better for you.

Re: [sqlite] Create database

2017-04-14 Thread Jens Alfke
> On Apr 14, 2017, at 7:44 AM, Igor Korot wrote: > > It means that the call to sqlite3_open() does not close previously > opened database and I have to explicitly close it > with sqlite3_close(). > > I was just couldn't find it anywhere in the docs. Probably missed it. The handle is documented

Re: [sqlite] Optimization opportunity

2017-04-14 Thread Richard Hipp
On 4/14/17, Wolfgang Enzinger wrote: > > Thank you Richard. I have to admit that it took me quite a while and also > reading the comment for check-in [1838a59c] several times to really > understand your explanation. Duh, that's tricky indeed! > But I've spent Good Friday working around it. Pleas

Re: [sqlite] Optimization opportunity

2017-04-14 Thread Wolfgang Enzinger
Am Fri, 14 Apr 2017 10:59:25 -0400 schrieb Richard Hipp: > Performing this rewrite of a view into a simple LEFT JOIN is trickier > than it seems at first glance. The rewrite works for the example you > provide. But subtle changes to the view can make the rewrite invalid. > For example: > > CREA

Re: [sqlite] Get rid of old-style function declarations/definitions in lemon.c

2017-04-14 Thread Guy Harris
On Apr 14, 2017, at 3:59 AM, Richard Damon wrote: > In C (as opposed to C++), it is the only way to provide a real prototype for > such a function. The empty parameter list means with an unspecified parameter > list in C. Exactly. Perhaps some future C standard will finally get rid of that su

Re: [sqlite] Create database

2017-04-14 Thread Simon Slavin
On 14 Apr 2017, at 3:44pm, Igor Korot wrote: > Thank you for clarifying. > It means that the call to sqlite3_open() does not close previously > opened database and I have to explicitly close it > with sqlite3_close(). SQLite can open as many connections as you want. It hands you back a handle

Re: [sqlite] Optimization opportunity

2017-04-14 Thread Richard Hipp
On 4/14/17, Wolfgang Enzinger wrote: > > CREATE VIEW z AS SELECT > fk, > (flags&1) AS odd, > (flags&2)>>1 AS even, > (flags&4)>>2 AS prime > FROM y; > > Now using the VIEW z in a JOIN results in a full table scan on TABLE y > despite a WHERE clause and an appropriate INDEX: > > EXPLAIN Q

Re: [sqlite] Create database

2017-04-14 Thread Igor Korot
Keith, On Fri, Apr 14, 2017 at 10:37 AM, Keith Medcalf wrote: > > To further clarify, the result of doing multiple sqlite3_open calls and > saving the results to the save db handle is the same as doing > > fh = fopen(...) > fh = fopen(...) > fh = fopen(...) > > You have opened multiple files but

Re: [sqlite] Create database

2017-04-14 Thread Keith Medcalf
To further clarify, the result of doing multiple sqlite3_open calls and saving the results to the save db handle is the same as doing fh = fopen(...) fh = fopen(...) fh = fopen(...) You have opened multiple files but are only keeping track of 1. So although three files are opened fclose(fh) w

Re: [sqlite] Create database

2017-04-14 Thread Igor Korot
Keith, On Fri, Apr 14, 2017 at 10:32 AM, Keith Medcalf wrote: > > No, a new database will be opened and you will be given an sqlite3* to it. > > Just like the fopen() call can be used to open multiple files, sqlite3_open* > opens a database. The way to close an sqlite3* (handle to a) database i

Re: [sqlite] Create database

2017-04-14 Thread Keith Medcalf
No, a new database will be opened and you will be given an sqlite3* to it. Just like the fopen() call can be used to open multiple files, sqlite3_open* opens a database. The way to close an sqlite3* (handle to a) database is to use sqlite3_close specifying the database you want to close. --

[sqlite] Create database

2017-04-14 Thread Igor Korot
Hi, If I have a database open with sqlite3_open() and then want to issue another sqlite3_open(), the old database will be closed and the new one will open? Or I have to explicitly call sqlite3_close()? Thank you. ___ sqlite-users mailing list sqlite-use

Re: [sqlite] SQLite - Interrogate Date/Time field Statement question

2017-04-14 Thread Ron Barnes
Hi Jim, I was able to get the SQL Working with this code From Ryan via the Mailing List. Thank you for all your help! SELECTcat, COUNT(*) AS qty FROM(SELECT days, CASE WHEN C.days < 1 THEN 'Under 1 Day' WHEN C.days < 7 THEN 'Under 1 Week' WHEN C.days < 31 THEN 'Under 1 M

Re: [sqlite] Optimization opportunity

2017-04-14 Thread Domingo Alvarez Duarte
Hello ! Maybe this problem would be the reason of getting bad query plans when joining views too. Cheers ! On 14/04/17 08:03, Wolfgang Enzinger wrote: Hello, given the following: CREATE TABLE x( pk INTEGER PRIMARY KEY, description TEXT ); CREATE TABLE y(

[sqlite] Optimization opportunity

2017-04-14 Thread Wolfgang Enzinger
Hello, given the following: CREATE TABLE x( pk INTEGER PRIMARY KEY, description TEXT ); CREATE TABLE y( fk INTEGER REFERENCES x(pk), flags INTEGER ); CREATE INDEX yy ON y(fk); CREATE VIEW z AS SELECT fk, (flags&1) AS odd, (flags&2)>>1 AS even, (flags&4

Re: [sqlite] Get rid of old-style function declarations/definitions in lemon.c

2017-04-14 Thread Richard Damon
On 4/14/17 4:47 AM, Dominique Devienne wrote: On Fri, Apr 14, 2017 at 4:54 AM, Guy Harris wrote: On Apr 13, 2017, at 2:36 AM, Dominique Devienne wrote: -PRIVATE struct config *newconfig(){ +PRIVATE struct config *newconfig(void){ Personally I've never been a fan of explicitly "void'ing"

Re: [sqlite] SQLite - Interrogate Date/Time field Statement question

2017-04-14 Thread Kam YiJie
STOP SPAMM ING ING ME ASS FACE From: sqlite-users on behalf of Jim Callahan Sent: Wednesday, April 12, 2017 11:21 AM To: SQLite mailing list Subject: Re: [sqlite] SQLite - Interrogate Date/Time field Statement question This code: SELECT ( substr('02/13/2016'

Re: [sqlite] Get rid of old-style function declarations/definitions in lemon.c

2017-04-14 Thread Dominique Devienne
On Fri, Apr 14, 2017 at 4:54 AM, Guy Harris wrote: > On Apr 13, 2017, at 2:36 AM, Dominique Devienne > wrote: > > -PRIVATE struct config *newconfig(){ > +PRIVATE struct config *newconfig(void){ > Personally I've never been a fan of explicitly "void'ing" arg-less functions. FWIW. But I do see