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

2017-04-07 Thread Clemens Ladisch
Simon Slavin wrote: > On 7 Apr 2017, at 6:58am, Clemens Ladisch wrote: >> 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 ex

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

2017-04-06 Thread Simon Slavin
On 7 Apr 2017, at 6:58am, Clemens Ladisch wrote: > 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,

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

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

2017-04-06 Thread David Raymond
notice it until I run a query and see "Error: no such table: feb.theTableYouWereLookingFor" -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Random Coder Sent: Thursday, April 06, 2017 6:07 PM To: SQLite mailing list Subj

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 addition is interesting. S

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

2017-04-06 Thread David Raymond
ps://docs.python.org/2/library/sqlite3.html#using-the-connection-as-a-context-manager -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin Sent: Thursday, April 06, 2017 5:27 PM To: SQLite mailing list Subject: Re: [sqlite] Test

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

2017-04-06 Thread J. King
On April 6, 2017 11:26:11 AM EDT, "James K. Lowden" wrote: >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 shou

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

2017-04-06 Thread Random Coder
On Thu, Apr 6, 2017 at 2:07 PM, David Raymond wrote: > 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)

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-users mailing list sq

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 to > change that, bu

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

2017-04-06 Thread David Raymond
quot;: print "Magic header isn't correct" return 1 -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of dave boland Sent: Thursday, April 06, 2017 3:58 PM To: Simon Slavin; SQLite mailing list Subject: Re:

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 file, a database with a t

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 connecting to a file a

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 there or just > created.

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 t

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. >>> See whether it works or gives an error. >> >> The command works a

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 byte for a string term

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 file goes from 0 to 8k bytes. Right. So you c

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<--- gave nothing >> select version fr

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 "Error: no such table" > > M

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, >> and a read/write to a globals table in the

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, for > instance, the versi

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 13:4

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 applications, so they are all

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. > >> and what state it is in

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 acce

Re: [sqlite] Testing SQLite in C++

2011-10-20 Thread Arbol One
Excellent! Thanks dude! -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Thursday, October 20, 2011 11:06 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Testing SQLite in C++ Do not

Re: [sqlite] Testing SQLite in C++

2011-10-20 Thread Pavel Ivanov
Do not include sqlite3ext.h. Applications need only sqlite3.h. Pavel On Thu, Oct 20, 2011 at 11:02 AM, Arbol One wrote: > Hey kids, I am testing SQLite in the hope that I can use it in my program, > but I get this confusing error msg, Can anybody help? > > > > Error message > > > >

Re: [sqlite] Testing SQLite on embedded platform with no Tcl

2009-01-12 Thread D. Richard Hipp
On Jan 12, 2009, at 10:53 AM, John Efstathiades wrote: > Hello, > > I am looking into porting the latest SQLite to an embedded platform > running > a commercial real-time operating system. I'd like to use as much of > the > existing regression test code as possible to ensure the port is > c

Re: [sqlite] Testing SQLite on embedded platform with no Tcl

2009-01-12 Thread Michael Schlenker
John Efstathiades schrieb: > Hello, > > I am looking into porting the latest SQLite to an embedded platform running > a commercial real-time operating system. I'd like to use as much of the > existing regression test code as possible to ensure the port is correct but > unfortunately the target env

Re: [sqlite] Testing sqlite

2008-04-30 Thread Shane Harrelson
If you have TCL installed, you can build the 'testfixture' which is used to run the tests. ;# Unpack the source tree into "sqlite" mkdir sqlite cd sqlite tar xzf sqlite.tar.gz ;# Build will occur in a sibling directory cd .. mkdir bld ;# Change to the build directory cd bld ;# Run the configure

RE: [sqlite] Testing SQLite

2007-12-13 Thread Brown, Daniel
ead of using the pre-processed source? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 13 December 2007 10:14 To: sqlite-users@sqlite.org Subject: Re: [sqlite] Testing SQLite "Brown, Daniel" <[EMAIL PROTECTED]> wrote: > Morning List, > > I

Re: [sqlite] Testing SQLite

2007-12-13 Thread drh
"Brown, Daniel" <[EMAIL PROTECTED]> wrote: > Morning List, > > I've just started experimenting with SQLite to see if I can replace our > current custom embedded database solution with it and trying to port > SQLite to some of our embedded platforms. Are there are any testing > frameworks (unit tes