tursodatabase/turso

Feature Request: Support multiple SQL statements in single Exec() call

Open

#1.440 geöffnet am 3. Mai 2025

Auf GitHub ansehen
 (2 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)Rust (1.001 Forks)github user discovery
enhancementhelp wanted

Repository-Metriken

Stars
 (19.103 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Currently, when executing multiple SQL statements (particularly CREATE TABLE statements) in a single Exec() call, Limbo only executes the first statement and ignores the rest.

// This code only creates table1, ignoring table2 and table3
schema := `
CREATE TABLE table1 (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE table2 (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE table3 (id INTEGER PRIMARY KEY, name TEXT);
`
_, err = db.Exec(schema)

The same CREATE TABLE sequence works fine with each statement executed separately.

statements := []string{
    "CREATE TABLE table1 (id INTEGER PRIMARY KEY, name TEXT);",
    "CREATE TABLE table2 (id INTEGER PRIMARY KEY, name TEXT);",
    "CREATE TABLE table3 (id INTEGER PRIMARY KEY, name TEXT);",
}

for _, stmt := range statements {
    _, err = db.Exec(stmt)
    // handle error
}

If this is by design (possibly for security reasons), it's fine to close this of course. Supporting multiple statements would improve compatibility with existing SQLite-based applications migrating to Limbo.

main_go.txt

Contributor Guide