1
0
mirror of https://github.com/docker/cli.git synced 2026-01-18 08:21:31 +03:00

Merge pull request #3275 from crosbymichael/sqlite-import

Move sqlite conn to graph db for cross compile support
Upstream-commit: e829d5b6d2865417d3161370782176b19550d9d7
Component: engine
This commit is contained in:
Victor Vieux
2013-12-19 10:18:30 -08:00
3 changed files with 29 additions and 15 deletions

View File

@@ -0,0 +1,5 @@
package graphdb
func NewSqliteConn(root string) (*Database, error) {
panic("Not implemented")
}

View File

@@ -0,0 +1,23 @@
package graphdb
import (
_ "code.google.com/p/gosqlite/sqlite3" // registers sqlite
"database/sql"
"os"
)
func NewSqliteConn(root string) (*Database, error) {
initDatabase := false
if _, err := os.Stat(root); err != nil {
if os.IsNotExist(err) {
initDatabase = true
} else {
return nil, err
}
}
conn, err := sql.Open("sqlite3", root)
if err != nil {
return nil, err
}
return NewDatabase(conn, initDatabase)
}

View File

@@ -1,9 +1,7 @@
package docker
import (
_ "code.google.com/p/gosqlite/sqlite3" // registers sqlite
"container/list"
"database/sql"
"fmt"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/graphdb"
@@ -718,19 +716,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
}
graphdbPath := path.Join(config.Root, "linkgraph.db")
initDatabase := false
if _, err := os.Stat(graphdbPath); err != nil {
if os.IsNotExist(err) {
initDatabase = true
} else {
return nil, err
}
}
conn, err := sql.Open("sqlite3", graphdbPath)
if err != nil {
return nil, err
}
graph, err := graphdb.NewDatabase(conn, initDatabase)
graph, err := graphdb.NewSqliteConn(graphdbPath)
if err != nil {
return nil, err
}