This commit is contained in:
wxkj
2018-08-08 13:37:08 +08:00
parent 8ad1112797
commit d5058894de
2 changed files with 8 additions and 10 deletions

View File

@ -11,8 +11,6 @@ import (
"database/sql"
"errors"
"fmt"
"time"
"gitee.com/johng/gf/g/container/gmap"
"gitee.com/johng/gf/g/container/gring"
"gitee.com/johng/gf/g/container/gtype"
@ -20,6 +18,7 @@ import (
"gitee.com/johng/gf/g/util/grand"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
"time"
)
const (
@ -128,8 +127,8 @@ var linkMysql = &dbmysql{}
// PostgreSQL接口对象
var linkPgsql = &dbpgsql{}
//Sqlite接口对象
//@author wxkj
// Sqlite接口对象
//@author wxkj<wxscz@qq.com>
var linkSqlite = &dbsqlite{}
// 数据库查询缓存对象map使用数据库连接名称作为键名键值为查询缓存对象

View File

@ -9,7 +9,6 @@ package gdb
import (
"database/sql"
"os"
)
// 数据库链接对象
@ -22,12 +21,12 @@ func (db *dbsqlite) Open(c *ConfigNode) (*sql.DB, error) {
if c.Linkinfo != "" {
source = c.Linkinfo
} else {
path, err := os.Getwd()
if err != nil {
return nil, err
}
//path, err := os.Getwd()
//if err != nil {
// return nil, err
//}
//先这样吧
source = path + c.Host + c.Name
source = c.Name
}
if db, err := sql.Open("sqlite3", source); err == nil {
return db, nil