Пример #1
0
// Path returns the full file path of an attached database. An empty string is
// returned for temporary databases.
// [http://www.sqlite.org/c3ref/db_filename.html]
func (c *Conn) Path(db string) string {
	if c.db != nil {
		db += "\x00"
		if path := C.sqlite3_db_filename(c.db, cStr(db)); path != nil {
			return C.GoString(path)
		}
	}
	return ""
}
Пример #2
0
// Filename returns the filename for a database connection.
// (See http://sqlite.org/c3ref/db_filename.html)
func (c *Conn) Filename(dbName string) string {
	cname := C.CString(dbName)
	defer C.free(unsafe.Pointer(cname))
	return C.GoString(C.sqlite3_db_filename(c.db, cname))
}