Re: [sqlite] counting tables

2008-07-04 Thread Tim Streater
At 18:02 03/07/2008, Simon Davies wrote: >Hi Tim, > >select count(*) from sqlite_master; > >will return 0 on a brand new db > >Rgds, >Simon Thanks - that's a handy pointer. At 18:04 03/07/2008, Igor Tandetnik wrote: >Tim Streater <[EMAIL PROTECTED]> >wrote: > > As a work around I thought I

Re: [sqlite] counting tables

2008-07-03 Thread Dennis Cote
Tim Streater wrote: > > I have a PHP script that I run in Terminal under OS X, which opens an > sqlite db and works on it. Trouble is, if the db doesn't exist then > the PHP library silently creates an empty db with the given name. > Given this, I need to detect that the empty db has been

Re: [sqlite] counting tables

2008-07-03 Thread Igor Tandetnik
Tim Streater <[EMAIL PROTECTED]> wrote: > As a work around I thought I might check that the newly opened db has > no tables, and clean up if so. My question is, what query can I make > of the db to determine that it has no tables? select exists (select * from sqlite_master where type='table');

Re: [sqlite] counting tables

2008-07-03 Thread Stephen Woodbridge
Tim Streater wrote: > Hi, > > I have a PHP script that I run in Terminal under OS X, which opens an sqlite > db and works on it. Trouble is, if the db doesn't exist then the PHP library > silently creates an empty db with the given name. Given this, I need to > detect that the empty db has >

Re: [sqlite] counting tables

2008-07-03 Thread Simon Davies
Hi Tim, select count(*) from sqlite_master; will return 0 on a brand new db Rgds, Simon 2008/7/3 Tim Streater <[EMAIL PROTECTED]>: > Hi, > > I have a PHP script that I run in Terminal under OS X, which opens an sqlite > db and works on it. Trouble is, if the db doesn't exist then the PHP

[sqlite] counting tables

2008-07-03 Thread Tim Streater
Hi, I have a PHP script that I run in Terminal under OS X, which opens an sqlite db and works on it. Trouble is, if the db doesn't exist then the PHP library silently creates an empty db with the given name. Given this, I need to detect that the empty db has been created, delete it, and exit.