Ensure maps are initialised before parsing sql
This commit is contained in:
parent
4452339bd1
commit
85fcdccab5
1 changed files with 8 additions and 8 deletions
16
db/db.go
16
db/db.go
|
@ -86,6 +86,14 @@ func Exit() {
|
||||||
// Execute parses the query and executes it against the data layer
|
// Execute parses the query and executes it against the data layer
|
||||||
func Execute(ctx *fibre.Context, txt interface{}, vars map[string]interface{}) (out []*Response, err error) {
|
func Execute(ctx *fibre.Context, txt interface{}, vars map[string]interface{}) (out []*Response, err error) {
|
||||||
|
|
||||||
|
// If no preset variables have been defined
|
||||||
|
// then ensure that the variables is
|
||||||
|
// instantiated for future use.
|
||||||
|
|
||||||
|
if vars == nil {
|
||||||
|
vars = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the received SQL batch query strings
|
// Parse the received SQL batch query strings
|
||||||
// into SQL ASTs, using any immutable preset
|
// into SQL ASTs, using any immutable preset
|
||||||
// variables if set.
|
// variables if set.
|
||||||
|
@ -95,14 +103,6 @@ func Execute(ctx *fibre.Context, txt interface{}, vars map[string]interface{}) (
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no preset variables have been defined
|
|
||||||
// then ensure that the variables is
|
|
||||||
// instantiated for future use.
|
|
||||||
|
|
||||||
if vars == nil {
|
|
||||||
vars = make(map[string]interface{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create 2 channels, one for force quitting
|
// Create 2 channels, one for force quitting
|
||||||
// the query processor, and the other for
|
// the query processor, and the other for
|
||||||
// receiving and buffering any query results.
|
// receiving and buffering any query results.
|
||||||
|
|
Loading…
Reference in a new issue