[sqlite] SQLite custom function for regular expression using c/c++

2016-05-05 Thread Acer Yang
Hi Bhagwat, I try to accomplish that with sqlite3cpp ( https://github.com/yangacer/sqlite3cpp), a light wrapper of sqlite3 for C++. Hope it help :-) // Require sqlite3cpp to be installed from source. // Compile with: clang++-3.6 -g sqlite_re.cpp -lsqlite3cpp -lsqlite3 -std=c++11 //

[sqlite] .DUMP output compatibility

2016-05-05 Thread Richard Hipp
On 5/5/16, Tony Papadimitriou wrote: > Is it possible for .DUMP to produce table/field names quoted with ` > (backquote) instead of ? (double quote) for compatibility with MySQL? > Or is this already adjustable by some setting I missed? Pipe the output through sed

[sqlite] Version of the database

2016-05-05 Thread Cecil Westerhof
2016-05-05 18:19 GMT+02:00 Simon Slavin : > > On 5 May 2016, at 5:15pm, Cecil Westerhof wrote: > > > I know how to get the version of the running version of SQLite, but is > > there a way to get the version with which the database was created? > > Unfortunately I do not think this information is

[sqlite] SQLite custom function for regular expression using c/c++

2016-05-05 Thread Bhagwat Balshetwar
Hello Richard, Thanks for your help. https://www.sqlite.org/src/artifact/a68d25c659bd2d89 I copy the content of above URL As C code in newfunction.c and perform the following action, 1) gcc -shared -Isqlite3 -o newfunction.sqlext newfunction.c (using MinGW for compilation) 2) .load

[sqlite] Version of the database

2016-05-05 Thread Simon Slavin
On 5 May 2016, at 5:38pm, Richard Hipp wrote: > There is no PRAGMA to retrieve this, but you can see it by > running the ".dbinfo" command in the shell. I was wrong. Believe Richard, not me. Simon.

[sqlite] Version of the database

2016-05-05 Thread Cecil Westerhof
2016-05-05 18:15 GMT+02:00 Cecil Westerhof : > > I know how to get the version of the running version of SQLite, but is > there a way to get the version with which the database was created? > ?With the command line program I can get it with: .dbinfo one of the things it gives is:

[sqlite] Version of the database

2016-05-05 Thread Cecil Westerhof
I know how to get the version of the running version of SQLite, but is there a way to get the version with which the database was created? -- Cecil Westerhof

[sqlite] Is it faster with descending index

2016-05-05 Thread Richard Hipp
On 5/5/16, Ertan K???ko?lu wrote: > > Table create SQL: > CREATE TABLE URUN( > Barkod Char(30) NOT NULL PRIMARY KEY, > ... > ); > > My question is, if I add following index, will it make my searches faster? > > CREATE UNIQUE INDEX IDX_BARKOD_DESC ON URUN(BARKOD); No. But if you change your

[sqlite] Fastest way to backup/copy database?

2016-05-05 Thread Rob Willett
Yes, realised after I sent the e-mail that I hadn?t said we had created the destination file in which to run the command. You cannot actually run rsync ?inlace if the destination file doesn?t exist, we found that out earlier ;) So it was a reasonable test though only one test. We need to do

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Cecil Westerhof
2016-05-05 17:09 GMT+02:00 Cecil Westerhof : > 2016-05-05 15:36 GMT+02:00 Adam Devita : > >> What would be the 'correct' behaviour for an out of bounds day in a >> month? If you look at dates as an index + natural number offset then Jan >> 32 == Feb 1.What is January 0 or January -1? >> >

[sqlite] Fastest way to backup/copy database?

2016-05-05 Thread Rob Willett
Mmmm?. Initial tests are not conclusive, it does look as if using rsync ?-inplace does speed things up but nowhere near as much as we anticipated. Testing consisted of a 6GB test database which is a backup copy from a few months ago. We timed copying the database over using cp # time cp

[sqlite] Version of the database

2016-05-05 Thread Simon Slavin
On 5 May 2016, at 5:22pm, Cecil Westerhof wrote: > ?With the command line program I can get it with: >.dbinfo > one of the things it gives is: >software version:3008010 I don't know if this is from something stored in the file. My guess is that it's more likely to be the version

[sqlite] Version of the database

2016-05-05 Thread Simon Slavin
On 5 May 2016, at 5:15pm, Cecil Westerhof wrote: > I know how to get the version of the running version of SQLite, but is > there a way to get the version with which the database was created? Unfortunately I do not think this information is stored anywhere. One often finds three version

[sqlite] SQLite workshop

2016-05-05 Thread Cecil Westerhof
Last year I gave a presentation at T-DOSE about SQLite. It was received enthusiastic, so I am thinking about giving a set of workshops about SQLite this year. What are good subjects to treat? And what are the pitfalls to expect? I am thinking to do it on several levels. At least people that have

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Cecil Westerhof
2016-05-05 15:36 GMT+02:00 Adam Devita : > What would be the 'correct' behaviour for an out of bounds day in a > month? If you look at dates as an index + natural number offset then Jan > 32 == Feb 1.What is January 0 or January -1? > ?Well, if my memory is correct, that is the way MySQL

[sqlite] .DUMP output compatibility

2016-05-05 Thread Warren Young
On May 5, 2016, at 4:56 PM, Tony Papadimitriou wrote: > > Windows! So install Cygwin. There may be more to it than the quoting style. I?ve used the following script for moving data the other direction (MySQL to SQLite): https://gist.github.com/esperlu/943776 You might have to create the

[sqlite] Fastest way to backup/copy database?

2016-05-05 Thread Rob Willett
Hi, We did look at this before, and discarded the idea but I can?t remember why. I?ve just looked again and seen the ?in-place option which I wasn?t aware of. That *might* help and be an interesting solution. We know we can make cp wrk, though with a little downtime. We?ll investigate rsync

[sqlite] Fw: new message

2016-05-05 Thread james.an...@tiscali.co.uk
Hello! You have a new message, please read james.ander at tiscali.co.uk

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Cecil Westerhof
2016-05-05 12:39 GMT+02:00 Simon Slavin : > > On 5 May 2016, at 11:25am, Cecil Westerhof wrote: > > > At > > the moment valid times can be marked as invalid and invalid times as > valid. > > Probably imposable to completely circumvent, but it can be done a lot > > better. > > I don't know what

[sqlite] Configure check of SQLite

2016-05-05 Thread Igor Korot
Hi, ALL, Is it possible to do a configure check/runtime check for the SQLite presence? Thank you.

[sqlite] Version of the database

2016-05-05 Thread Richard Hipp
On 5/5/16, Simon Slavin wrote: > > On 5 May 2016, at 5:15pm, Cecil Westerhof wrote: > >> I know how to get the version of the running version of SQLite, but is >> there a way to get the version with which the database was created? > > One often finds three version numbers stored: > > A) The

[sqlite] Fastest way to backup/copy database?

2016-05-05 Thread Adam Devita
I use rsync to backup a 400MB sqlite db to a remote server. This is not fast (which is a don't care problem in my context). You may want to test changes to a 'log of sql commands at database' to get a replay-backup remotely as it handles text better than binary files (at least the version I use

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Cecil Westerhof
2016-05-05 10:08 GMT+02:00 R Smith : > > > On 2016/05/05 4:26 AM, Cecil Westerhof wrote: > >> The statement: >> SELECT strftime('%Y-%m-%d %H:%M:%f', '2016-04-31 17:19:59.670') >> gives: >> 2016-04-31 17:19:59.670 >> >> Should that not be NULL? >> >> It does with: >> SELECT

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Simon Slavin
On 5 May 2016, at 11:25am, Cecil Westerhof wrote: > At > the moment valid times can be marked as invalid and invalid times as valid. > Probably imposable to completely circumvent, but it can be done a lot > better. I don't know what TimeZone you're in (your surname looks German) but at this

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Stephan Beal
On Thu, May 5, 2016 at 10:08 AM, R Smith wrote: > seconds. Leap years themselves also have problems - the easiest check is > to see if the year is divisible by 4 and then allow a 29th on Feb, but of > course for the year 1900 this would have been wrong, but for 2000 this is > right again, etc

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread R Smith
On 2016/05/05 4:26 AM, Cecil Westerhof wrote: > The statement: > SELECT strftime('%Y-%m-%d %H:%M:%f', '2016-04-31 17:19:59.670') > gives: > 2016-04-31 17:19:59.670 > > Should that not be NULL? > > It does with: > SELECT strftime('%Y-%m-%d %H:%M:%f', '2016-04-32 17:19:59.670') > >

[sqlite] Fastest way to backup/copy database?

2016-05-05 Thread J Decker
On Thu, May 5, 2016 at 9:38 AM, Rob Willett wrote: > Mmmm?. Initial tests are not conclusive, it does look as if using rsync > ?-inplace does speed things up but nowhere near as much as we anticipated. > > Testing consisted of a 6GB test database which is a backup copy from a few > months ago. >

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Adam Devita
What would be the 'correct' behaviour for an out of bounds day in a month? If you look at dates as an index + natural number offset then Jan 32 == Feb 1.What is January 0 or January -1? If expressing dates this way (and not as an int from an epoch) I think that it is up to the application

[sqlite] SQLite custom function for regular expression using c/c++

2016-05-05 Thread Richard Hipp
On 5/5/16, Bhagwat Balshetwar wrote: > Hello Richard, > > Thanks for your help. > > https://www.sqlite.org/src/artifact/a68d25c659bd2d89 > I copy the content of above URL As C code in newfunction.c and perform the > following action, > > 1) gcc -shared -Isqlite3 -o newfunction.sqlext

[sqlite] Fastest way to backup/copy database?

2016-05-05 Thread J Decker
Instead of cp, rsync might help it is able to send delta changes. On Wed, May 4, 2016 at 10:55 AM, Rob Willett wrote: > Scott, > > OK, We can see how to do this (I think). Our app is written in Perl and we?d > just need to capture the command we write down. The only issue I can think > of is the

[sqlite] strftime accepts an illegal time string

2016-05-05 Thread Cecil Westerhof
The statement: SELECT strftime('%Y-%m-%d %H:%M:%f', '2016-04-31 17:19:59.670') gives: 2016-04-31 17:19:59.670 Should that not be NULL? It does with: SELECT strftime('%Y-%m-%d %H:%M:%f', '2016-04-32 17:19:59.670') It looks like a value of 31 is always allowed for day: SELECT

[sqlite] datetime in CHECK

2016-05-05 Thread Cecil Westerhof
2016-05-05 2:48 GMT+02:00 Keith Medcalf : > > fails. However, datetime(timestring) where timestring is an invalid ISO > timestring returns NULL, so yout check constraint might likely be: CHECK > (datetime(col) is not null) > ?I am afraid that is no true. The statement: SELECT

[sqlite] Fastest way to backup/copy database?

2016-05-05 Thread Dan Kennedy
On 05/05/2016 12:45 AM, Rob Willett wrote: > Ryan, > > Ah! The penny drops, we didn?t realise that with the backup API. > That explains a great deal. We must have missed that in the docs. Blast. There is one exception to this: If the database is written to via the same database handle that

[sqlite] datetime in CHECK

2016-05-05 Thread Cecil Westerhof
2016-05-04 22:43 GMT+02:00 Roman Fleysher : > Dear SQLiters, > > I am trying to use CHECK constraint is column of a table to enforce > datetime format and this works: > > AcquisitionDateTEXT > ?? > CHECK (AcquisitionDate IS date(AcquisitionDate)) > > when I insert '2015-08-10'. But this >