Skip to content

Commit f268891

Browse files
zgramanagjrtimmer
authored andcommitted
Adds GetFilename (sqlite3_db_filename) to SqliteConn
1 parent 4218441 commit f268891

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sqlite3.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,17 @@ const (
16121612
SQLITE_LIMIT_WORKER_THREADS = C.SQLITE_LIMIT_WORKER_THREADS
16131613
)
16141614

1615+
// GetFilename returns the absolute path to the file containing
1616+
// the requested schema. When passed an empty string, it will
1617+
// instead use the database's default schema: "main".
1618+
// See: sqlite3_db_filename, https://www.sqlite.org/c3ref/db_filename.html
1619+
func (c *SQLiteConn) GetFilename(schemaName string) string {
1620+
if schemaName == "" {
1621+
schemaName = "main"
1622+
}
1623+
return C.GoString(C.sqlite3_db_filename(c.db, C.CString(schemaName)))
1624+
}
1625+
16151626
// GetLimit returns the current value of a run-time limit.
16161627
// See: sqlite3_limit, http://www.sqlite.org/c3ref/limit.html
16171628
func (c *SQLiteConn) GetLimit(id int) int {

0 commit comments

Comments
 (0)