使用goframe出现了unable to open database file: out of memory (14),不知道如何解决

SRyeB · · 1190 次点击 · 开始浏览    置顶
这是一个创建于 的主题,其中的信息可能已经有所发展或是发生改变。

初学者,使用goframe框架的orm查询sqlite数据库,发生了以下错误 === RUN TestORM --- FAIL: TestORM (0.01s) panic: unable to open database file: out of memory (14), SELECT * FROM `t_project` LIMIT 1 [recovered] panic: unable to open database file: out of memory (14), SELECT * FROM `t_project` LIMIT 1 路径和数据库文件本身没有问题,使用"database/sql"这个包就可以正常查询到 gf v2.3.2 go1.17.11 windows/amd64 下面是代码 package utils import ( "database/sql" "fmt" _ "github.com/gogf/gf/contrib/drivers/sqlite/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gosnmp/gosnmp" _ "github.com/mattn/go-sqlite3" "golang.org/x/net/context" "myapp/ZxtTool" "strconv" "testing" "time" ) func TestORM(*testing.T) { ctx := context.Background() one, err := g.DB("main").Model("t_project").One() if err != nil { panic(err) } defer g.DB("main").Close(ctx) fmt.Println(one) } 下面是config.yaml内的数据库配置 database: main: link: "sqlite::@file(E:/GoProject/myapp/flowData.db)" Schema: "main"

有疑问加站长微信联系(非本文作者)

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1190 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传