improve sqlite.Open

This commit is contained in:
John
2020-11-19 20:37:27 +08:00
parent 24a377d3a8
commit bfcf133c91

View File

@ -36,15 +36,14 @@ func (d *DriverSqlite) New(core *Core, node *ConfigNode) (DB, error) {
// Open creates and returns a underlying sql.DB object for sqlite.
func (d *DriverSqlite) Open(config *ConfigNode) (*sql.DB, error) {
var source string
var err error
if config.LinkInfo != "" {
source = config.LinkInfo
} else {
source = config.Name
}
source, err = gfile.Search(source)
if err != nil {
return nil, err
// It searches the source file to locate its absolute path..
if absolutePath, _ := gfile.Search(source); absolutePath != "" {
source = absolutePath
}
intlog.Printf("Open: %s", source)
if db, err := sql.Open("sqlite3", source); err == nil {