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

[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 documentation

[sqlite] Testing sqlite wal performance OS X memory/disk

2016-03-25 Thread Domingo Alvarez Duarte
Hello ! Comparing the three systems tested: raspibian raspberry pi3: 53us linux celeron: 12us os x i5: 7.7us One thing that I was expecting is that when using all core/threads (and because basically all data in in memory/cache) that I'll have around 100% cpu load but I don't, so ther

[sqlite] Testing sqlite wal performance OS X memory/disk

2016-03-25 Thread Domingo Alvarez Duarte
Hello ! Here is the same tests on a raspberry pi3: raspberry pi3 memory database 1 thread: Update rate: total=214229, last_total=194712, rate=19517, avg1=19517, avg2=19475 Update busy rate: total=0, last_total=0, rate=0, avg1=0, avg2=0 Update failed rate: total=0, last_total=0, rate=0, avg

[sqlite] Testing sqlite wal performance OS X memory/disk

2016-03-25 Thread Simon Slavin
On 25 Mar 2016, at 6:21pm, Domingo Alvarez Duarte wrote: > One thing that I was expecting is that when using all core/threads (and > because basically all data in in memory/cache) that I'll have around 100% cpu > load but I don't, so there is something that is preventing usage of all > system re

[sqlite] Testing sqlite wal performance OS X memory/disk

2016-03-25 Thread Domingo Alvarez Duarte
Hello ! I modified a bit the program to somehow test sqlite/system performance at https://gist.github.com/mingodad/79225c88f8dce0f174f5 , now we can also specify a memory database and doing so on a mac mini i5 2/4 cores surprisingly memory database when shared with 4 threads is slower than di

[sqlite] Testing sqlite wal performance, and surfacing a problem

2016-03-25 Thread Domingo Alvarez Duarte
Hello ! Again the problem was my fault, I was not checking the return code of setting "PRAGMA synchronous=0" and for some threads it was SQLITE_BUSY so they started in synchronous mode and that slowdown everything ! Sorry by the noise ! The updated program to test somehow sqlite performanc

[sqlite] Testing sqlite wal performance, and surfacing a problem

2016-03-25 Thread Domingo Alvarez Duarte
Hello ! After fight a bit with sqlite3 "wal" mode I wrote a small multi thread program to test it's performance https://gist.github.com/mingodad/79225c88f8dce0f174f5 , doing so and testing on linux and os x I dicovered that os x threads are around 50% slower than linux. Sqlite3 seems to have

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 > > > >

[sqlite] Testing SQLite in C++

2011-10-20 Thread Arbol One
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 D:\dev\sqlitetest\main.cpp:14:10: error: 'sqlite3_api' was not declared in this scope Code ~ #include #include "sqlite/sqlite

[sqlite] testing sqlite on target

2009-01-28 Thread Zaphod
Hi All, I am running Linux 2.6 on PPC based target. Also have application using SQLite 3.6.10 How can i run the tests comming with SQLite package? There is Tcl 8.5.6 on my target also. Thanks for the help. ___ sqlite-users mailing list sqlite-users@sq

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

[sqlite] Testing SQLite on embedded platform with no Tcl

2009-01-12 Thread John Efstathiades
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 environment does not have Tcl. The host

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

[sqlite] Testing sqlite

2008-04-30 Thread Lloyd
Hi, In the test folder of sqlite3 source distribution I saw so many test scripts. How can I run these tests? I am curious to know the various testing methods used in sqlite. Thanks, Lloyd __ Scanned and protected by Email scanner ___

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

[sqlite] Testing SQLite

2007-12-13 Thread Brown, Daniel
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 tests would be great) for SQLite? I'd like to be able to