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.sqlite.org]
> > On Behalf Of Daniel Anderson
> > Sent: Friday, 14 April, 2017 21:11
> > To: SQLite mailing list
> > Subject: Re: [sqlite] Create database
> >
> > 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 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) will only close the last
> one,
> > > and the first two are still open, you just discarded your reference to
> > them
> > > and they are inaccessible to you.
> > > >
> > > > If you do this sort of thing a lot then you program will eventually
> > > crash when it fills up with unreferenced (leaked) memory objects that
> > you
> > > forgot (and have overwritten the handle) to close.
> > >
> > > 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().
> > >
> > > I was just couldn't find it anywhere in the docs. Probably missed it.
> > >
> > > >
> > > > --
> > > > ˙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 Keith Medcalf
> > > >> Sent: Friday, 14 April, 2017 08:32
> > > >> To: SQLite mailing list
> > > >> Subject: Re: [sqlite] Create database
> > > >>
> > > >>
> > > >> 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.
> > > >>
> > > >> --
> > > >> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> > > >>
> > > >>
> > > >> > -Original Message-
> > > >> > From: sqlite-users [mailto:sqlite-users-bounces@
> > > mailinglists.sqlite.org]
> > > >> > On Behalf Of Igor Korot
> > > >> > Sent: Friday, 14 April, 2017 08:26
> > > >> > To: Discussion of SQLite Database; General Discussion of SQLite
> > > Database
> > > >> > Subject: [sqlite] Create database
> > > >> >
> > > >> >  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-users@mailinglists.sqlite.org
> > > >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
> > users
> > > >>
> > > >>
> > > >>
> > > >> ___
> > > >> sqlite-users mailing list
> > > >> sqlite-users@mailinglists.sqlite.org
> > > >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/
> sqlite-users
> > > >
> > > >
> > > >
> > > > ___
> > > > sqlite-users mailing list
> > > > sqlite-users@mailinglists.sqlite.org
> > > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@mailinglists.sqlite.org
> > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > >
> >
> >
> >
> > --
> > Daniel
> > *L'action accède à la perfection quand, bien que vivant, vous êtes déjà
> > mort*
> > *Bunan*
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Daniel
*L'action accède à la perfection quand, bien que vivant, vous êtes déjà
mort*
*Bunan*
___
sqlite-users mailing 

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 list
> Subject: Re: [sqlite] Create database
> 
> 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 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) will only close the last one,
> > and the first two are still open, you just discarded your reference to
> them
> > and they are inaccessible to you.
> > >
> > > If you do this sort of thing a lot then you program will eventually
> > crash when it fills up with unreferenced (leaked) memory objects that
> you
> > forgot (and have overwritten the handle) to close.
> >
> > 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().
> >
> > I was just couldn't find it anywhere in the docs. Probably missed it.
> >
> > >
> > > --
> > > ˙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 Keith Medcalf
> > >> Sent: Friday, 14 April, 2017 08:32
> > >> To: SQLite mailing list
> > >> Subject: Re: [sqlite] Create database
> > >>
> > >>
> > >> 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.
> > >>
> > >> --
> > >> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> > >>
> > >>
> > >> > -Original Message-
> > >> > From: sqlite-users [mailto:sqlite-users-bounces@
> > mailinglists.sqlite.org]
> > >> > On Behalf Of Igor Korot
> > >> > Sent: Friday, 14 April, 2017 08:26
> > >> > To: Discussion of SQLite Database; General Discussion of SQLite
> > Database
> > >> > Subject: [sqlite] Create database
> > >> >
> > >> >  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-users@mailinglists.sqlite.org
> > >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
> users
> > >>
> > >>
> > >>
> > >> ___
> > >> sqlite-users mailing list
> > >> sqlite-users@mailinglists.sqlite.org
> > >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > >
> > >
> > >
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@mailinglists.sqlite.org
> > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> 
> 
> 
> --
> Daniel
> *L'action accède à la perfection quand, bien que vivant, vous êtes déjà
> mort*
> *Bunan*
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 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) will only close the last one,
> and the first two are still open, you just discarded your reference to them
> and they are inaccessible to you.
> >
> > If you do this sort of thing a lot then you program will eventually
> crash when it fills up with unreferenced (leaked) memory objects that you
> forgot (and have overwritten the handle) to close.
>
> 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().
>
> I was just couldn't find it anywhere in the docs. Probably missed it.
>
> >
> > --
> > ˙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 Keith Medcalf
> >> Sent: Friday, 14 April, 2017 08:32
> >> To: SQLite mailing list
> >> Subject: Re: [sqlite] Create database
> >>
> >>
> >> 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.
> >>
> >> --
> >> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> >>
> >>
> >> > -Original Message-
> >> > From: sqlite-users [mailto:sqlite-users-bounces@
> mailinglists.sqlite.org]
> >> > On Behalf Of Igor Korot
> >> > Sent: Friday, 14 April, 2017 08:26
> >> > To: Discussion of SQLite Database; General Discussion of SQLite
> Database
> >> > Subject: [sqlite] Create database
> >> >
> >> >  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-users@mailinglists.sqlite.org
> >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >>
> >>
> >>
> >> ___
> >> sqlite-users mailing list
> >> sqlite-users@mailinglists.sqlite.org
> >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Daniel
*L'action accède à la perfection quand, bien que vivant, vous êtes déjà
mort*
*Bunan*
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 threads at the same time could
> either (a) corrupt the database, or (b) lead to a false reports of
> corruption?

Not unless you’re also violating one of the other things mentioned on that 
page.  SQLite implements mutex locking internally.  It is meant to prevent 
itself from messing up in the way you describe.

Please have their program execute

PRAGMA compile_options;

and tell us any lines which include "THREAD" especially "SQLITE_THREADSAFE".  
If this is set to zero you can have problems, because that copy of SQLite was 
compiled to omit thread safety code.  But this is not a default option and you 
should not be seeing it unless you did it on purpose.

You should probably read .

> […]
> 
> They also routinely see "cannot start a transaction within a
> transaction" even though there is no obvious place where or reason why
> that would happen in their code. This leads us to believe they may be
> using the same connection on multiple threads.

I agree with your analysis, on what I know so far.  Have each program using 
SQLite execute

sqlite3_config(SQLITE_CONFIG_MULTITHREAD)

/before it does any other SQLite call including sqlite3_initialize()/.  See 
whether that makes the problem go away.

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[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 could
either (a) corrupt the database, or (b) lead to a false reports of
corruption?

(Even if such a misuse of SQLite falls under one of the categories
already listed on the page, perhaps said category could be updated to
explicitly tell about the risk of misusing SQLite in this way...
perhaps a "Section 2.6"... or 5.1 or 7.1).

Thoughts?

-P



P.S./Appendix: Further background info (probably TMI)...
-

We are trying to help a client debug some issues in a Xamarin-based
app that is deployed to both Android and iOS. Some of the errors they
are seeing are "malformed database".

They are still building in a way that uses the platform-provided
SQLite on both platforms (no, this will not work on Android N) and no
additional SQLite library is linked in, so they should not be having
the "Multiple copies of SQLite linked into the same application"
problem.

They also routinely see "cannot start a transaction within a
transaction" even though there is no obvious place where or reason why
that would happen in their code. This leads us to believe they may be
using the same connection on multiple threads.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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.  After some additional testing,
> this optimization will likely be merge to trunk and appear in the next
> release.  Your beta-testing is important - Thanks.

Sadly my C skills are just good enough to compile the amalgamation. But as
soon as the beta amalgamation will be available, I'll test it intensely,
promised.

Thanks again & happy Easter! :-)

Wolfgang

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 as an ‘out’ parameter to sqlite3_open, so the function 
simply ignores any value it has on input (it’s probably uninitialized garbage 
anyway.) All it does is store the new handle there.

—Jens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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.  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.  After some additional testing,
this optimization will likely be merge to trunk and appear in the next
release.  Your beta-testing is important - Thanks.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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:
> 
> CREATE VIEW z AS SELECT
>fk,
>   coalesce(flags&1,0) AS odd,  -- Added coalesce()
>   (flags&2)>>1 AS even,
>   (flags&4)>>2 AS prime
>   FROM y;
> 
> The addition of the coalesce() function on one of the result columns
> of the view means that a transformation such as you suggest will give
> a different (and incorrect) answer.  This is just one of many examples
> of the subtle pitfalls involved in trying to convert a LEFT JOIN into
> a form that can make better use of indexes.

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!

Wolfgang

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 support 
for legacy C, but, for now, if you want to say "this function takes no 
arguments", you have no choice but to declare it as noargs(void) - and I think 
explicitly declaring that is a Very Good Thing, as it means that the compiler 
will reject calls to the function that pass it arguments, as it should.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 
for each one.  If you want it to close one, you have to tell it which one you 
want it to close.

So don’t do this:

sqlite3 *m_db;
int res = sqlite3_open( name1, _db );
//some database operations
res = sqlite3_open( name2, _db );
// stuff goes here
res = sqlite3_close(m_db);

do this:

sqlite3 *m_db;
int res = sqlite3_open( name1, _db );
//some database operations
res = sqlite3_close(m_db);
res = sqlite3_open( name2, _db );
// stuff goes here
res = sqlite3_close(m_db);

or this:

sqlite3 *m_db1;
sqlite3 *m_db2;
int res = sqlite3_open( name1, _db1 );
//some database operations
res = sqlite3_open( name2, _db2 );
// now they’re both open
// stuff goes here
res = sqlite3_close(m_db2);
// check result to see it closed okay
res = sqlite3_close(m_db1);
// check result to see it closed okay

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 QUERY PLAN SELECT x.pk,z.odd,z.even,z.prime
> FROM x LEFT JOIN z ON x.pk=z.fk WHERE x.pk=2;
>
> Bypassing the VIEW however uses INDEX yy:
>
> EXPLAIN QUERY PLAN
> SELECT x.pk,(y.flags&1) AS odd,(y.flags&2)>>1 AS even,(y.flags&4)>>2 AS
> prime FROM x LEFT JOIN y ON x.pk=y.fk WHERE x.pk=2;
>

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:

CREATE VIEW z AS SELECT
   fk,
  coalesce(flags&1,0) AS odd,  -- Added coalesce()
  (flags&2)>>1 AS even,
  (flags&4)>>2 AS prime
  FROM y;

The addition of the coalesce() function on one of the result columns
of the view means that a transformation such as you suggest will give
a different (and incorrect) answer.  This is just one of many examples
of the subtle pitfalls involved in trying to convert a LEFT JOIN into
a form that can make better use of indexes.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 are only keeping track of 1.  So although 
> three files are opened fclose(fh) will only close the last one, and the first 
> two are still open, you just discarded your reference to them and they are 
> inaccessible to you.
>
> If you do this sort of thing a lot then you program will eventually crash 
> when it fills up with unreferenced (leaked) memory objects that you forgot 
> (and have overwritten the handle) to close.

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().

I was just couldn't find it anywhere in the docs. Probably missed it.

>
> --
> ˙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 Keith Medcalf
>> Sent: Friday, 14 April, 2017 08:32
>> To: SQLite mailing list
>> Subject: Re: [sqlite] Create database
>>
>>
>> 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.
>>
>> --
>> ˙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 Igor Korot
>> > Sent: Friday, 14 April, 2017 08:26
>> > To: Discussion of SQLite Database; General Discussion of SQLite Database
>> > Subject: [sqlite] Create database
>> >
>> >  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-users@mailinglists.sqlite.org
>> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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) will only close the last one, and the first 
two are still open, you just discarded your reference to them and they are 
inaccessible to you.

If you do this sort of thing a lot then you program will eventually crash when 
it fills up with unreferenced (leaked) memory objects that you forgot (and have 
overwritten the handle) to close.

-- 
˙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 Keith Medcalf
> Sent: Friday, 14 April, 2017 08:32
> To: SQLite mailing list
> Subject: Re: [sqlite] Create database
> 
> 
> 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.
> 
> --
> ˙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 Igor Korot
> > Sent: Friday, 14 April, 2017 08:26
> > To: Discussion of SQLite Database; General Discussion of SQLite Database
> > Subject: [sqlite] Create database
> >
> >  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-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 is to 
> use sqlite3_close specifying the database you want to close.

I'm talking about using same database handle for both calls.

Something like this:

[pseudo-code]
sqlite3 *m_db;
int res = sqlite3_open( name1, _db );
//some database operations
res = sqlite3_open( name2, _db );
[/pseudo-code]

Thank you.

>
> --
> ˙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 Igor Korot
>> Sent: Friday, 14 April, 2017 08:26
>> To: Discussion of SQLite Database; General Discussion of SQLite Database
>> Subject: [sqlite] Create database
>>
>>  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-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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.

-- 
˙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 Igor Korot
> Sent: Friday, 14 April, 2017 08:26
> To: Discussion of SQLite Database; General Discussion of SQLite Database
> Subject: [sqlite] Create database
> 
>  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-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[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-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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 Month' 
WHEN C.days < 366 THEN 'Under 1 Year' 
WHEN C.days < 731 THEN 'Under 2 Years'
WHEN C.days < 1826 THEN 'Under 5 Years' 
WHEN C.days < 3651 THEN 'Under 10 Years'
 ELSE 'Over 10 Years' END AS cat
 FROM(SELECT   julianday('now') - 
julianday([REPLACE](substr(VI_Creation_Date, 1, 10), '/', '-')) AS days
  FROMVolume_Information) C) G
GROUP BY cat
ORDER BY cat

Works great BTW

-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Kam YiJie
Sent: Friday, April 14, 2017 6:37 AM
To: SQLite mailing list 
Subject: Re: [sqlite] SQLite - Interrogate Date/Time field Statement question



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',7,4) || '-'
  || substr('02/13/2016',1,2) || '-'
  || substr('02/13/2016',4,2) ) ;

yields

2016-02-13

The above code, is dependent on fixed length strings (the leading zero) in 
other words '02/13/2016' and not '2/13/2016'.

If you do not have fixed length date strings,  you would probably have to use 
globs or regular expressions.

*glob(X,Y)*

The glob(X,Y) function is equivalent to the expression "*Y GLOB X*". Note that 
the X and Y arguments are reversed in the glob() function relative to the infix 
GLOB  operator.
[https://sqlite.org/images/syntax/expr.gif]

SQLite Query Language: expression
sqlite.org
If a numeric literal has a decimal point or an exponentiation clause or if its 
magnitude is less than -9223372036854775808 or greater than 
9223372036854775807, then ...




https://sqlite.org/lang_corefunc.html#glob
SQLite Query Language: Core 
Functions
sqlite.org
The core functions shown below are available by default. Date & Time functions, 
aggregate functions, and JSON functions are documented separately.





The REGEXP operator is a special syntax for the regexp() user function. No
regexp() user function is defined by default and so use of the REGEXP operator 
will normally result in an error message. If an application-defined SQL 
function  named "regexp"
is added at run-time, then the "*X* REGEXP *Y*" operator will be implemented as 
a call to "regexp(*Y*,*X*)".

https://sqlite.org/lang_expr.html


Type of regular expression needed:
https://social.msdn.microsoft.com/Forums/en-US/7f38ee7b-15e2-4e2c-8389-1266f496e4b2/regular-expression-to-get-date-format-from-string?forum=csharplanguage

Jim Callahan

On Tue, Apr 11, 2017 at 10:00 PM, Ron Barnes  wrote:

> Hi Jim,
>
> I could alter the program that populates the Date/Time Column to the 
> format you specify.  I'm trying real hard not to as that program has 
> been in use for many years and it would be a significant undertaking 
> to convert the program then convert the existing data.  Not saying I 
> won't do it as I'm at that point, just wondering if it's possible to avoid 
> that route.
>
> If I converted the date/time field, would it be easier to create counts?
>
> If you could, would you be able to offer a sample Select statement I 
> can alter to fit my needs?
>
> Thank you very much for the reply!
>
> Side note, I'll be visiting Disney in July!
>
> Regards,
>
> -Ron
>
> -Original Message-
> From: sqlite-users 
> [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Jim Callahan
> Sent: Tuesday, April 11, 2017 9:15 PM
> To: SQLite mailing list 
> Subject: Re: [sqlite] SQLite - Interrogate Date/Time field Statement 
> question
>
> Can you convert the dates to ISO 8601 date time format?
> https://en.wikipedia.org/wiki/ISO_8601
>
> -MM-DD hh:mm:ss
>
> ISO date strings (when zero filled) are sortable which necessarily 
> includes comparable (Java speak).
> By "zero filled" I mean for March you have "03" and not just "3".
>
> Then if you could generate/populate the boundary values in ISO format; 
> the comparisons would be straightforward and you could avoid the 
> julian date conversion.
>
> Another disadvantage of Julian dates are the different base years used 
> by applications including Unix, MS Access, MS Excel for Windows and MS 
> Excel for MacIntosh. Each application is 

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(
   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)>>2 AS prime
   FROM y;

INSERT INTO x(pk,description) VALUES
   (1,'one'),(2,'two'),(3,'three'),(4,'four');

INSERT INTO y(fk,flags) VALUES (1,1|0|0),(2,0|2|4),(3,1|0|4),(4,0|2|0);



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 QUERY PLAN SELECT x.pk,z.odd,z.even,z.prime
FROM x LEFT JOIN z ON x.pk=z.fk WHERE x.pk=2;
1|0|0|SCAN TABLE y
0|0|0|SEARCH TABLE x USING INTEGER PRIMARY KEY (rowid=?)
0|1|1|SCAN SUBQUERY 1

Bypassing the VIEW however uses INDEX yy:

EXPLAIN QUERY PLAN
SELECT x.pk,(y.flags&1) AS odd,(y.flags&2)>>1 AS even,(y.flags&4)>>2 AS
prime FROM x LEFT JOIN y ON x.pk=y.fk WHERE x.pk=2;
0|0|0|SEARCH TABLE x USING INTEGER PRIMARY KEY (rowid=?)
0|1|1|SEARCH TABLE y USING INDEX yy (fk=?)

Unless I'm missing something, I think there is a potential optimization
opportunity.

Identical results with SQLite versions 3.13, 3.17 and 3.18.

Cheers, Wolfgang

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[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)>>2 AS prime
  FROM y;

INSERT INTO x(pk,description) VALUES 
  (1,'one'),(2,'two'),(3,'three'),(4,'four');

INSERT INTO y(fk,flags) VALUES (1,1|0|0),(2,0|2|4),(3,1|0|4),(4,0|2|0);



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 QUERY PLAN SELECT x.pk,z.odd,z.even,z.prime
FROM x LEFT JOIN z ON x.pk=z.fk WHERE x.pk=2;
1|0|0|SCAN TABLE y
0|0|0|SEARCH TABLE x USING INTEGER PRIMARY KEY (rowid=?)
0|1|1|SCAN SUBQUERY 1

Bypassing the VIEW however uses INDEX yy:

EXPLAIN QUERY PLAN
SELECT x.pk,(y.flags&1) AS odd,(y.flags&2)>>1 AS even,(y.flags&4)>>2 AS
prime FROM x LEFT JOIN y ON x.pk=y.fk WHERE x.pk=2;
0|0|0|SEARCH TABLE x USING INTEGER PRIMARY KEY (rowid=?)
0|1|1|SEARCH TABLE y USING INDEX yy (fk=?)

Unless I'm missing something, I think there is a potential optimization
opportunity.

Identical results with SQLite versions 3.13, 3.17 and 3.18.

Cheers, Wolfgang

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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" arg-less
functions. FWIW.
But I do see others (in the patch's unchanged text), so why not.
Let's now see if DRH applies your patch or not. --DD

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.


--
Richard Damon

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


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',7,4) || '-'
  || substr('02/13/2016',1,2) || '-'
  || substr('02/13/2016',4,2) ) ;

yields

2016-02-13

The above code, is dependent on fixed length strings (the leading zero) in
other words '02/13/2016' and not '2/13/2016'.

If you do not have fixed length date strings,  you would probably have to
use
globs or regular expressions.

*glob(X,Y)*

The glob(X,Y) function is equivalent to the expression "*Y GLOB X*". Note
that the X and Y arguments are reversed in the glob() function relative to
the infix GLOB  operator.
[https://sqlite.org/images/syntax/expr.gif]

SQLite Query Language: expression
sqlite.org
If a numeric literal has a decimal point or an exponentiation clause or if its 
magnitude is less than -9223372036854775808 or greater than 
9223372036854775807, then ...




https://sqlite.org/lang_corefunc.html#glob
SQLite Query Language: Core 
Functions
sqlite.org
The core functions shown below are available by default. Date & Time functions, 
aggregate functions, and JSON functions are documented separately.





The REGEXP operator is a special syntax for the regexp() user function. No
regexp() user function is defined by default and so use of the REGEXP
operator will normally result in an error message. If an application-defined
SQL function  named "regexp"
is added at run-time, then the "*X* REGEXP *Y*" operator will be
implemented as a call to "regexp(*Y*,*X*)".

https://sqlite.org/lang_expr.html


Type of regular expression needed:
https://social.msdn.microsoft.com/Forums/en-US/7f38ee7b-15e2-4e2c-8389-1266f496e4b2/regular-expression-to-get-date-format-from-string?forum=csharplanguage

Jim Callahan

On Tue, Apr 11, 2017 at 10:00 PM, Ron Barnes  wrote:

> Hi Jim,
>
> I could alter the program that populates the Date/Time Column to the
> format you specify.  I'm trying real hard not to as that program has been
> in use for many years and it would be a significant undertaking to convert
> the program then convert the existing data.  Not saying I won't do it as
> I'm at that point, just wondering if it's possible to avoid that route.
>
> If I converted the date/time field, would it be easier to create counts?
>
> If you could, would you be able to offer a sample Select statement I can
> alter to fit my needs?
>
> Thank you very much for the reply!
>
> Side note, I'll be visiting Disney in July!
>
> Regards,
>
> -Ron
>
> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Jim Callahan
> Sent: Tuesday, April 11, 2017 9:15 PM
> To: SQLite mailing list 
> Subject: Re: [sqlite] SQLite - Interrogate Date/Time field Statement
> question
>
> Can you convert the dates to ISO 8601 date time format?
> https://en.wikipedia.org/wiki/ISO_8601
>
> -MM-DD hh:mm:ss
>
> ISO date strings (when zero filled) are sortable which necessarily
> includes comparable (Java speak).
> By "zero filled" I mean for March you have "03" and not just "3".
>
> Then if you could generate/populate the boundary values in ISO format; the
> comparisons would be straightforward and you could avoid the julian date
> conversion.
>
> Another disadvantage of Julian dates are the different base years used by
> applications including Unix, MS Access, MS Excel for Windows and MS Excel
> for MacIntosh. Each application is internally consistent, but the minute
> you exchange data between applications...
> https://support.microsoft.com/en-us/help/214330/differences-
> between-the-1900-and-the-1904-date-system-in-excel
>
> Your specification actually requires day counts; so you may need Julian
> dates after all.
>
> Jim Callahan
> Orlando, FL
>
>
>
> On Tue, Apr 11, 2017 at 7:24 PM, Ron Barnes  wrote:
>
> > Hello all,
> >
> > To everyone who helped me before - thank you very much!
> >
> > I'm coding in Visual Basic .NET (Visual Studio 2015) Community.
> >
> > I have to count a Date/Time field and the problem is, this field
> > contains data in a format I'm not sure can be counted.
> >
> > I need to count all the dates in the field but the dates are a
> > combined Date and time in the format examples below.
> > My goal is to use the current Date/time ('NOW') and calculate the time
> > difference in days, from my DB Sourced field.
> >
> > I need to capture...
> > Less than 1 month old
> > 1 month old
> > 2 months old
> > 

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 others (in the patch's unchanged text), so why not.
Let's now see if DRH applies your patch or not. --DD
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users