Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gosqlite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gosqlite
Commits
aa28066a
Commit
aa28066a
authored
Aug 11, 2012
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add bindings to sqlite3_column_database|table|origin_name.
parent
28b88271
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
meta.go
meta.go
+18
-0
meta_test.go
meta_test.go
+15
-0
No files found.
meta.go
View file @
aa28066a
...
...
@@ -147,6 +147,24 @@ func (c *Conn) Column(dbName, tableName, columnName string) (*Column, error) {
autoinc
==
1
,
C
.
GoString
(
zCollSeq
)},
nil
}
// The left-most column is column 0
// (See http://www.sqlite.org/c3ref/column_database_name.html)
func
(
s
*
Stmt
)
ColumnDatabaseName
(
index
int
)
string
{
return
C
.
GoString
(
C
.
sqlite3_column_database_name
(
s
.
stmt
,
C
.
int
(
index
)))
}
// The left-most column is column 0
// (See http://www.sqlite.org/c3ref/column_database_name.html)
func
(
s
*
Stmt
)
ColumnTableName
(
index
int
)
string
{
return
C
.
GoString
(
C
.
sqlite3_column_table_name
(
s
.
stmt
,
C
.
int
(
index
)))
}
// The left-most column is column 0
// (See http://www.sqlite.org/c3ref/column_database_name.html)
func
(
s
*
Stmt
)
ColumnOriginName
(
index
int
)
string
{
return
C
.
GoString
(
C
.
sqlite3_column_origin_name
(
s
.
stmt
,
C
.
int
(
index
)))
}
// See Conn.ForeignKeys
type
ForeignKey
struct
{
Table
string
...
...
meta_test.go
View file @
aa28066a
...
...
@@ -111,3 +111,18 @@ func TestIndexes(t *testing.T) {
column
:=
columns
[
0
]
assertEquals
(
t
,
"Wrong column name: %q <> %q"
,
"a_string"
,
column
.
Name
)
}
func
TestColumnMetadata
(
t
*
testing
.
T
)
{
db
:=
open
(
t
)
defer
db
.
Close
()
s
,
err
:=
db
.
Prepare
(
"SELECT name AS table_name FROM sqlite_master"
)
check
(
err
)
defer
s
.
Finalize
()
databaseName
:=
s
.
ColumnDatabaseName
(
0
)
assertEquals
(
t
,
"wrong database name: %q <> %q"
,
"main"
,
databaseName
)
tableName
:=
s
.
ColumnTableName
(
0
)
assertEquals
(
t
,
"wrong table name: %q <> %q"
,
"sqlite_master"
,
tableName
)
originName
:=
s
.
ColumnOriginName
(
0
)
assertEquals
(
t
,
"wrong origin name: %q <> %q"
,
"name"
,
originName
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment