I haven't test on exactly 1kb file but larger and indeed an error is shown.
May i stress again that the test should be during open() imo?
And rather not using a 2nd function to examine the db.
Frankly, creating a db if there is none is not really preferred, of course i
do a check myself to prevent that in certain circumstances but you ever
might reconsider that as well.
Or optional or so.
No big deal, simply a logic i follow.
----- Original Message -----
From: "D. Richard Hipp" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Saturday, August 20, 2005 10:38 PM
Subject: Re: [sqlite] Why can i open a textfile?
On Sat, 2005-08-20 at 13:36 -0700, Will Leshner wrote:
On Aug 20, 2005, at 9:21 AM, D. Richard Hipp wrote:
> SQLite never "blows away" a file that is not a database.
Sorry to use such crude language :) But I believe I have run into an
issue with SQLite reformatting a non-sqlite file as a SQLite
database. I will try to reconstruct the problem and report back if I
can.
There might be a bug. If SQLite sees a file that is less
than 1024 bytes in length, it might assume (mistakenly) that
it is empty and then overwrite it. I'll have to check on
that. If it does, this should be considered a bug.
Certainly if the file is 1024 bytes or larger SQLite
should never overwrite it. If you find a case where
it does, please fill out a bug report.
--
D. Richard Hipp <[EMAIL PROTECTED]>