Allowable characters in sqlite3 database file names
Posted: Wednesday 23rd November 2022 4:17am
I'm running into a bit of quirky behavior and am wondering if anybody else has experienced it or can confirm it.
My program has an edit field to enter a database name, which in my rough draft I don't edit check, then the program either creates or loads the file depending upon whether the file exists.
Before I code a workaround, e.g. create a plain named file and rename it, I'd like to know if there is something going on that I am not aware of. I haven't done that much DB programming in Gambas.
Thanks,
Ced
My program has an edit field to enter a database name, which in my rough draft I don't edit check, then the program either creates or loads the file depending upon whether the file exists.
'=============================================================================
Public Sub CreateDatabaseFile(ArgDirName As String, ArgFileName As String)
Dim theDB As Connection = New Connection
With theDB
.Type = "sqlite3"
.Host = ArgDirName
.Name = ""
.Open()
.Databases.Add(ArgFileName)
.Close
End With
End
'=============================================================================
Public Sub OpenDatabase(ArgDirName As String, ArgFileName As String)
With MyDB
.Type = "sqlite3"
.Host = ArgDirName
.Name = ArgFileName
.Open()
End With
End
'=============================================================================
Here is the weird part, trying to add a filename in the create routine with any special character, except underscore, doesn't work. However, if you give it a plain name, rename the file externally, the open routine works just fine.Before I code a workaround, e.g. create a plain named file and rename it, I'd like to know if there is something going on that I am not aware of. I haven't done that much DB programming in Gambas.
Thanks,
Ced