This does not result in an error but returns the fields (no records of course):

SELECT * FROM sqlite_master where [type]='table'


----- Original Message ----- From: "D. Richard Hipp" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Saturday, August 20, 2005 6:21 PM
Subject: Re: [sqlite] Why can i open a textfile?


On Sat, 2005-08-20 at 09:06 -0700, Will Leshner wrote:
On Aug 20, 2005, at 1:25 AM, Edwin Knoppert wrote:

> v3.2.1, i opened a textfile containing a simple list not related to
> sqlite.
> Was testing my error handler but it still opens it.
>

Do you mean you called sqlite3_open? I believe sqlite3_open does not
yet test to see if the database is truly a SQLite 3 database. And I
can't remember the exact details, but I think it is possible that if
you open a non-database and then start trying to use it, SQLite blows
away whatever is in it and turns it into a SQLite 3 database. So you
might want to be kinda careful about opening non-databases with SQLite.


Not quite correct.

sqlite3_open just sets up the database handle.  It does not
actually open the database file or check to see if the file
really contains a database.  The file is not actually opened
until you try to do something with it.

SQLite never "blows away" a file that is not a database.

--
D. Richard Hipp <[EMAIL PROTECTED]>



Reply via email to