aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Gramana <z.gramana@me.com>2018-05-11 17:48:25 -0700
committerGert-Jan Timmer <gjr.timmer@gmail.com>2018-06-12 10:33:32 +0200
commitf268891078ea39463d1263e9f8036cf1adef08c4 (patch)
treec32834647c64ee89656f721eb33fe9315997eaaa
parentMerge pull request #586 from mattn/feature/userauth (diff)
downloadgolite-f268891078ea39463d1263e9f8036cf1adef08c4.tar.gz
golite-f268891078ea39463d1263e9f8036cf1adef08c4.tar.xz
Adds GetFilename (sqlite3_db_filename) to SqliteConn
-rw-r--r--sqlite3.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/sqlite3.go b/sqlite3.go
index c63a5b1..17291dc 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -1612,6 +1612,17 @@ const (
SQLITE_LIMIT_WORKER_THREADS = C.SQLITE_LIMIT_WORKER_THREADS
)
+// GetFilename returns the absolute path to the file containing
+// the requested schema. When passed an empty string, it will
+// instead use the database's default schema: "main".
+// See: sqlite3_db_filename, https://www.sqlite.org/c3ref/db_filename.html
+func (c *SQLiteConn) GetFilename(schemaName string) string {
+ if schemaName == "" {
+ schemaName = "main"
+ }
+ return C.GoString(C.sqlite3_db_filename(c.db, C.CString(schemaName)))
+}
+
// GetLimit returns the current value of a run-time limit.
// See: sqlite3_limit, http://www.sqlite.org/c3ref/limit.html
func (c *SQLiteConn) GetLimit(id int) int {