SQL Expressions: Simplify where code is being stubbed out (#96227)

* Rename from DuckDB

* Remove unused function
This commit is contained in:
Sam Jewell 2024-11-18 12:05:08 +00:00 committed by GitHub
parent 30bbcf8200
commit 1915efbc95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View File

@ -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")
}

View File

@ -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())