mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 17:06:57 -06:00
SQL Expressions: Simplify where code is being stubbed out (#96227)
* Rename from DuckDB * Remove unused function
This commit is contained in:
parent
30bbcf8200
commit
1915efbc95
@ -9,10 +9,6 @@ import (
|
||||
type DB struct {
|
||||
}
|
||||
|
||||
func (db *DB) TablesList(rawSQL string) ([]string, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (db *DB) RunCommands(commands []string) (string, error) {
|
||||
return "", errors.New("not implemented")
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ var logger = log.New("sql_expr")
|
||||
|
||||
// TablesList returns a list of tables for the sql statement
|
||||
func TablesList(rawSQL string) ([]string, error) {
|
||||
duckDB := NewInMemoryDB()
|
||||
db := NewInMemoryDB()
|
||||
rawSQL = strings.Replace(rawSQL, "'", "''", -1)
|
||||
cmd := fmt.Sprintf("SELECT json_serialize_sql('%s')", rawSQL)
|
||||
ret, err := duckDB.RunCommands([]string{cmd})
|
||||
ret, err := db.RunCommands([]string{cmd})
|
||||
if err != nil {
|
||||
logger.Error("error serializing sql", "error", err.Error(), "sql", rawSQL, "cmd", cmd)
|
||||
return nil, fmt.Errorf("error serializing sql: %s", err.Error())
|
||||
|
Loading…
Reference in New Issue
Block a user