MCPcopy
hub / github.com/dosco/graphjin / createSQLiteDBFile

Function createSQLiteDBFile

serv/mcp_config_transaction_test.go:847–869  ·  view source on GitHub ↗
(t *testing.T, name string, withSchema bool)

Source from the content-addressed store, hash-verified

845}
846
847func createSQLiteDBFile(t *testing.T, name string, withSchema bool) string {
848 t.Helper()
849
850 dbPath := filepath.Join(t.TempDir(), name)
851 db, err := sql.Open("sqlite", dbPath)
852 if err != nil {
853 t.Fatalf("open sqlite: %v", err)
854 }
855 defer db.Close()
856
857 if withSchema {
858 for _, stmt := range []string{
859 `CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)`,
860 `INSERT INTO users (id, name) VALUES (1, 'Ada')`,
861 } {
862 if _, err := db.Exec(stmt); err != nil {
863 t.Fatalf("exec %q: %v", stmt, err)
864 }
865 }
866 }
867
868 return dbPath
869}
870
871func newMetadataReloadMCPServer(t *testing.T, autoCodeRelations bool, codeDatabases []string, inferA, inferB bool) *mcpServer {
872 t.Helper()

Calls 3

CloseMethod · 0.65
ExecMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected