7 Star 5 Fork 0

Gitee 极速下载/go-sqlite3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/mattn/go-sqlite3
克隆/下载
sqlite3_opt_column_metadata_test.go 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
Yasuhiro Matsumoto 提交于 2024-01-25 22:36 . go fmt ./...
//go:build sqlite_column_metadata
// +build sqlite_column_metadata
package sqlite3
import "testing"
func TestColumnTableName(t *testing.T) {
d := SQLiteDriver{}
conn, err := d.Open(":memory:")
if err != nil {
t.Fatal("failed to get database connection:", err)
}
defer conn.Close()
sqlite3conn := conn.(*SQLiteConn)
_, err = sqlite3conn.Exec(`CREATE TABLE foo (name string)`, nil)
if err != nil {
t.Fatal("Failed to create table:", err)
}
_, err = sqlite3conn.Exec(`CREATE TABLE bar (name string)`, nil)
if err != nil {
t.Fatal("Failed to create table:", err)
}
stmt, err := sqlite3conn.Prepare(`SELECT * FROM foo JOIN bar ON foo.name = bar.name`)
if err != nil {
t.Fatal(err)
}
if exp, got := "foo", stmt.(*SQLiteStmt).ColumnTableName(0); exp != got {
t.Fatalf("Incorrect table name returned expected: %s, got: %s", exp, got)
}
if exp, got := "bar", stmt.(*SQLiteStmt).ColumnTableName(1); exp != got {
t.Fatalf("Incorrect table name returned expected: %s, got: %s", exp, got)
}
if exp, got := "", stmt.(*SQLiteStmt).ColumnTableName(2); exp != got {
t.Fatalf("Incorrect table name returned expected: %s, got: %s", exp, got)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/go-sqlite3.git
[email protected]:mirrors/go-sqlite3.git
mirrors
go-sqlite3
go-sqlite3
master

搜索帮助