Quote table name before interpolating into DeclareVTab
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/mattn/go-sqlite3"
|
"github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
@@ -26,13 +27,14 @@ func (m *githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTa
|
|||||||
if len(args) < 3 {
|
if len(args) < 3 {
|
||||||
return nil, fmt.Errorf("githubModule: unexpected arguments: %v", args)
|
return nil, fmt.Errorf("githubModule: unexpected arguments: %v", args)
|
||||||
}
|
}
|
||||||
|
tableName := `"` + strings.ReplaceAll(args[2], `"`, `""`) + `"`
|
||||||
err := c.DeclareVTab(fmt.Sprintf(`
|
err := c.DeclareVTab(fmt.Sprintf(`
|
||||||
CREATE TABLE %s (
|
CREATE TABLE %s (
|
||||||
id INT,
|
id INT,
|
||||||
full_name TEXT,
|
full_name TEXT,
|
||||||
description TEXT,
|
description TEXT,
|
||||||
html_url TEXT
|
html_url TEXT
|
||||||
)`, args[2]))
|
)`, tableName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user