I have discovered, that Database.Connect ( ) As Boolean
always returns true after a new data base has been created.
I was using dbConnect to see if a DB was connected (See code below.)
dbConnect returns true even if the file selected is an RTF!
Is this a bug? If not how do I get around this feature to ensure that I have a legit Data Base connected?
Under what circumstances does dbConnect() return False?
dim dd as new SQLiteDatabase
Dim f as FolderItem
Dim rs as RecordSet
Dim s as string
stx1.Text=Str(dd.Connect)
f=GetOpenFolderItem("")
if f=nil then
stx2.Text=“Cancelled”
stx3.Text=Str(dd.Connect)
Return // if cancel pressed, no file opened. and we allow further handler processing. We also leave the opened file open.
end if
REM if we drop through, than have a FolderItem.
stx2.Text=f.DisplayName
If the database file value is nil then an in memory database is created on the connect (SQLite). Check that your folder item “exists” before connecting.
Can’t speak for Mac, but on Windows it wouldn’t really matter what the file extension is. I can take a database file and make the extension .docx and it will still connect. It will confuse Word if I double click it, but that’s not the point I’m making. If you can connect to the file then it’s a non-encrypted SQLite file regardless of the extension.
SQLite cares about the contents of the file, not the extension.
You can take an SQLite database and change the extension to RTF and it will work
but you can’t take an RTF file and change it to DB and expect it to work
[quote]
SQLite does not impose any naming requirements on database files. SQLite will happily work with a database file that has any filename extension or with no extension at all[/quote]