Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Simon Slavin
On 6 Apr 2017, at 12:11pm, Tim Streater wrote: > When my app starts, I check that the file in question actually *is* a > database by doing some simple steps like open, selects from important tables, > and a read/write to a globals table in the database that contains,

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Simon Slavin
On 6 Apr 2017, at 2:44pm, Tim Streater wrote: > That would appear not to be the case. Under OS X 10.9.5, I touched a > non-existent file and then using sqlite3.app did: > > .schema<--- gave nothing > select version from globals; <--- gave

[sqlite] Another Inconsistency in .lint fkeys-index

2017-04-06 Thread Keith Medcalf
Note the report first line. Interval is the primary key of both tables so there is an internal index. Table Forecast does the same but is not reported (because of the extra unique constraints perhaps?) The later two reported missing indexes are correct. sqlite> .lint fkey-indexes CREATE INDEX

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Tim Streater
On 06 Apr 2017 at 13:19, Simon Slavin wrote: > On 6 Apr 2017, at 12:11pm, Tim Streater wrote: > >> When my app starts, I check that the file in question actually *is* a >> database by doing some simple steps like open, selects from important tables,

Re: [sqlite] Another Inconsistency in .lint fkeys-index

2017-04-06 Thread Dan Kennedy
On 04/06/2017 08:26 PM, Keith Medcalf wrote: Note the report first line. Interval is the primary key of both tables so there is an internal index. Thanks for this. Should be fixed here: http://www.sqlite.org/src/info/48826b222c110a90 Dan. Table Forecast does the same but is not

Re: [sqlite] Continuous recovery of journal

2017-04-06 Thread Bob Friesenhahn
On Sat, 1 Apr 2017, Richard Hipp wrote: On 4/1/17, J Decker wrote: I get this ... from sqlite error log callback Sqlite3 Err: (283) recovered 6942 frames from WAL file C:\eQube-Tools\flashboard\server\option.db-wal pretty much every time I restart the program now

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread James K. Lowden
On Thu, 6 Apr 2017 13:19:38 +0100 Simon Slavin wrote: > Instead use PHP functions to check that the file exists using PHP > function "file_exists()" and then using fread() to read the first 16 > bytes from it. Those 16 bytes should be "SQLite format 3" followed > by a 0x00

Re: [sqlite] Continuous recovery of journal

2017-04-06 Thread Simon Slavin
On 6 Apr 2017, at 2:38pm, Bob Friesenhahn wrote: > Is calling sqlite3_close() prior to exiting a requirement in general for > sqlite? I was not aware of this requirement. Do you explicitly call sqlite3_shutdown() ? If not, when are you expecting SQLite to close

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Tim Streater
On 06 Apr 2017 at 16:10, Simon Slavin wrote: > On 6 Apr 2017, at 4:04pm, Tim Streater wrote: > >> On 06 Apr 2017 at 15:33, Simon Slavin wrote: >> >>> After touching, try opening the file and issuing a CREATE TABLE command.

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Simon Slavin
On 6 Apr 2017, at 4:04pm, Tim Streater wrote: > On 06 Apr 2017 at 15:33, Simon Slavin wrote: > >> After touching, try opening the file and issuing a CREATE TABLE command. See >> whether it works or gives an error. > > The command works and the

Re: [sqlite] Does SQLite do any file editing when you close a database ?

2017-04-06 Thread Olivier Mascia
> Le 6 avr. 2017 à 17:44, Simon Slavin a écrit : > > Can anyone point out anything that’s done to files when you close a database ? For one thing, when the last database connection on a database file closes SQLite does checkpoint whatever remains in the wal. Which in that

[sqlite] Does SQLite do any file editing when you close a database ?

2017-04-06 Thread Simon Slavin
I know that the SQLite "_open()" calls are fakes. The file is not really opened until the first operation which needs to access it. However, triggered by another post to this forum I’m not curious about "_close()" calls. I used to think that SQLite did clear-up work when you closed a file.

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Tim Streater
On 06 Apr 2017 at 15:33, Simon Slavin wrote: > On 6 Apr 2017, at 2:44pm, Tim Streater wrote: > >> That would appear not to be the case. Under OS X 10.9.5, I touched a >> non-existent file and then using sqlite3.app did: >> >> .schema

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread dave boland
"unconfigured means no tables, no fields, no nothing. With SQLite, it is possible to have an empty file, a database with a table but no fields, etc. The reason this concerns me is that I want to know what I have before connecting to a file and creating a new database when I did not intend to do

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Simon Slavin
On 6 Apr 2017, at 7:38pm, dave boland wrote: > "unconfigured means no tables, no fields, no nothing. With SQLite, it > is possible to have an empty file, a database with a table but no > fields, etc. The reason this concerns me is that I want to know what I > have before

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread dave boland
I assume this will work in a similar fashion for Python? On Thu, Apr 6, 2017, at 03:24 PM, Simon Slavin wrote: > > On 6 Apr 2017, at 7:38pm, dave boland wrote: > > > "unconfigured means no tables, no fields, no nothing. With SQLite, it > > is possible to have an empty

[sqlite] SQLite Visual 2017

2017-04-06 Thread Tim Bateson
Hi, Does anyone know when the SQLite for Visual Studio 2017 Design Time Components will be released? https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki Thanks, Tim ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Jens Alfke
> On Apr 6, 2017, at 5:19 AM, Simon Slavin wrote: > > Don’t do this. Because if the file isn’t there, or if the file is there but > has zero length, SQLite will turn it into a SQLite file and then return > results which don’t let you tell whether the file was already

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread David Raymond
Before opening the connection you could do something along the lines of if not os.path.isfile(fi) or not os.access(fi, os.W_OK): print "File isn't there or isn't writable" return 1 with open(fi, "r") as f: if f.read(16) != "SQLite format 3\x00": print "Magic header isn't

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Tim Streater
On 06 Apr 2017 at 19:54, Jens Alfke wrote: > PS: Tim, for some reason your mail client (iLetter) is sending replies without > an In-Reply-To header, which breaks up the threading (at least in my mail > client) making it very hard to follow. There’s probably not a way for you

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Simon Slavin
On 6 Apr 2017, at 10:07pm, David Raymond wrote: > with open(fi, "r") as f: In Python, once you fall outside the scope of "with open()" does it automatically close the file for you ? If so, that’s pretty neat. Simon. ___

[sqlite] Regression 3.18.0 cannot import Lightroom dump - Expression tree is too large (maximum depth 1000)

2017-04-06 Thread Axel Reinhold
Dear sqlite-team, after update to 3.18.0 from 3.17.0 i can no more import a dump of my Adobe Lightroom database. The command: echo .dump | /opt/sqlite/bin/sqlite3 "/save/axel/alr3lb/2017-03-26 2040/lr5.lrcat" | /opt/sqlite/bin/sqlite3 t.sq3 which works fine with 3.17.0 produces hundreds of

[sqlite] sqlite db file descriptor access/manipulation

2017-04-06 Thread Valery Reznic
Hello. I am trying to find a way to get access to sqlite db file descriptor, after sqlite3_open. I want to be able set O_CLOEXEC flag to this fd, andr make sqlite use highest possible fd. Any ideas how can I achieve it? Valery ___ sqlite-users mailing

Re: [sqlite] Regression 3.18.0 cannot import Lightroom dump - Expression tree is too large (maximum depth 1000)

2017-04-06 Thread Rowan Worth
This was already reported recently - if you need a workaround in the short term (before sqlite itself is fixed) see CL's answer here: http://stackoverflow.com/q/43145117/11654 -Rowan 2017-04-05 14:10 GMT+08:00 Axel Reinhold : > Dear sqlite-team, > > after update to 3.18.0

Re: [sqlite] sqlite db file descriptor access/manipulation

2017-04-06 Thread Clemens Ladisch
Valery Reznic wrote: > I am trying to find a way to get access to sqlite db file descriptor, after > sqlite3_open. > I want to be able set O_CLOEXEC flag to this fd, andr make sqlite use highest > possible fd. There is sqlite3_file_control(), but it does not give you access to the file handle.

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Tim Streater
On 06 Apr 2017 at 11:28, Clemens Ladisch wrote: > dave boland wrote: >> Being a little paranoid, I like to insure that the db file exists > > SQLite automatically creates an empty DB if you try to open > a nonexistent file, so you do not actually need to do anything. > >>

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Richard Hipp
On Thu, 06 Apr 2017 12:11 +0100, Tim Streater wrote: > > I keep reading that the continued > existence of any particular PRAGMA is completely un-guaranteed. > We say that. But in practice, if we were to remove a pragma it would break thousands, perhaps millions, of

[sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread dave boland
Being a little paranoid, I like to insure that the db file exists, which is easy, and what state it is in (unconfigured, so needs to be made ready; or ready to accept data (or be read)). How do I do that? Using Python, but would like a generalized approach. Feel free to point me to

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Clemens Ladisch
dave boland wrote: > Being a little paranoid, I like to insure that the db file exists SQLite automatically creates an empty DB if you try to open a nonexistent file, so you do not actually need to do anything. > and what state it is in (unconfigured, so needs to be made > ready; or ready to

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Simon Slavin
On 6 Apr 2017, at 11:55pm, David Raymond wrote: > For the sqlite3 module connection object: on a bad exit from an exception it > will do a rollback, on a clean exit it will do a commit, and run .close() > either way. Thanks for the answer about open() scope. Your

Re: [sqlite] Fossil error: Table plink has no column named baseid

2017-04-06 Thread Warren Young
On Apr 6, 2017, at 6:28 PM, Domingo Alvarez Duarte wrote: > > How could we clone/sync a fossil repository with "n" depth commits ? That’s called a shallow clone, and it comes up on the Fossil Users’ mailing list from time to time:

Re: [sqlite] Fossil error: Table plink has no column named baseid

2017-04-06 Thread Domingo Alvarez Duarte
Hello Warren ! Thanks for reply ! I only did it here because I need to create/recover an account on fossil mailing lists (at times is a pain isolated silos). And yes I was thinking on something like what is described on the link you've passed, on mobile devices only the tip of the

Re: [sqlite] Continuous recovery of journal

2017-04-06 Thread Richard Hipp
On 4/6/17, Bob Friesenhahn wrote: > > Is calling sqlite3_close() prior to exiting a requirement in general > for sqlite? I was not aware of this requirement. > Not a requirement. SQLite works fine without this. It will just leave -wal and -shm files sitting

Re: [sqlite] Fossil error: Table plink has no column named baseid

2017-04-06 Thread Richard Hipp
Normally it does, but your repository might be too old. Try running "fossil rebuild" first and that will likely fix it. On 4/6/17, Domingo Alvarez Duarte wrote: > Hello Richard ! > > I have done a port/adaptation of fossil for android but haven't updated > it for some time,

Re: [sqlite] Fossil error: Table plink has no column named baseid

2017-04-06 Thread Domingo Alvarez Duarte
Hello Richard ! Thanks for the reply, after issuing a rebuild it's now syncing (not finished yet). Doing this port to android one of it's usage case is to have a portable offline repository on the go, and for some big repositories probably having the full repository is not needed, git has

Re: [sqlite] Fossil error: Table plink has no column named baseid

2017-04-06 Thread Richard Hipp
On 4/6/17, Domingo Alvarez Duarte wrote: > > How could we clone/sync a fossil repository with "n" depth commits ? > Can't be done right now. And because of the way propagating tags are handled, doing so would be tricky. But we have thought about it. -- D. Richard Hipp

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread David Raymond
Yeah, with the Look Before You Leap style there's that chance, but since the default behavior is to create the file if it's not there, then connecting to some file name is never gonna fail (unless the absolute path directory doesn't exist) With the CLI for example I know I've created tons of

[sqlite] Fossil error: Table plink has no column named baseid

2017-04-06 Thread Domingo Alvarez Duarte
Hello Richard ! I have done a port/adaptation of fossil for android but haven't updated it for some time, today I updated it to the latest fossil and when trying to sync the original fossil clone on android I'm getting this error: Table plink has no column named baseid: INSERT OR IGNORE

Re: [sqlite] CLI .lint question

2017-04-06 Thread Dan Kennedy
On 04/06/2017 02:58 AM, David Raymond wrote: Looks like the .lint command has been in since 3.16.0, but this is my first time noticing it and trying it out. I ran the .lint fkey-indexes on one of my larger databases where I had thought I had indexed all the foreign keys ok, and it spat out a

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Marco Bambini
Seems like a good reason to introduce a way to query the existence of a particular pragma command, something like: PRAGMA exists('user_version'); or PRAGMA exists='user_version'; -- Marco Bambini http://www.sqlabs.com http://twitter.com/sqlabs http://instagram.com/sqlabs > On 6 Apr 2017, at

Re: [sqlite] BUG: CLI generates invalid SQL for strings with many newlines

2017-04-06 Thread Charles Leifer
Is it conceivable that this change could be rolled back? On Tue, Apr 4, 2017 at 9:45 AM, Charles Leifer wrote: > I hate to be critical of Dr Hipp, but this commit stinks. Even if using > the sqlite3 shell isn't the blessed way of producing a backup, I'm sure a > lot of folks

Re: [sqlite] Another Inconsistency in .lint fkeys-index

2017-04-06 Thread David Raymond
That fixed the issue I was seeing the first time around, thanks. Still getting some weirdness where it looks like the results are highly dependent on the contents of sqlite_stat1. I've been trying to construct a simplified version to share but am having trouble reproducing it on a smaller

Re: [sqlite] Another Inconsistency in .lint fkeys-index

2017-04-06 Thread Keith Medcalf
On Thursday, 6 April, 2017 08:58, Dan Kennedy wrote: > On 04/06/2017 08:26 PM, Keith Medcalf wrote: > > Note the report first line. Interval is the primary key of both tables > > so there is an internal index. > Thanks for this. Should be fixed here: >

Re: [sqlite] VT table behavior change between 3.10 and 3.17

2017-04-06 Thread Bob Friesenhahn
I got the virtual table module which obviously breaks with 3.17 to work again. Is there particular cursor behavior which must be provided although an update is currently or has just been made to the underlying store? With my new implementation, the existing cursor uses prior data until it

Re: [sqlite] Continuous recovery of journal

2017-04-06 Thread J Decker
On Thu, Apr 6, 2017 at 8:26 AM, Simon Slavin wrote: > > On 6 Apr 2017, at 2:38pm, Bob Friesenhahn > wrote: > > > Is calling sqlite3_close() prior to exiting a requirement in general for > sqlite? I was not aware of this requirement. > > Do you

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread Clemens Ladisch
David Raymond: >https://docs.python.org/2/reference/datamodel.html#with-statement-context-managers > >For the sqlite3 module connection object: on a bad exit from an >exception it will do a rollback, on a clean exit it will do a commit, >and run .close() either way. It does not run .close().