Add INSTR ql ref for all drivers
This commit is contained in:
@@ -149,6 +149,12 @@ var (
|
||||
},
|
||||
OutType: &TypeText{},
|
||||
},
|
||||
"instr": {
|
||||
Handler: func(args ...string) string {
|
||||
return fmt.Sprintf("instr(%s, %s)", args[0], args[1])
|
||||
},
|
||||
OutType: &TypeNumber{},
|
||||
},
|
||||
|
||||
// @todo implement; the commented versions are not good enough
|
||||
// "like": {
|
||||
|
||||
@@ -21,6 +21,17 @@ var (
|
||||
return exp.NewSQLFunctionExpression("CONCAT", aa...)
|
||||
},
|
||||
},
|
||||
"instr": {
|
||||
Handler: func(args ...exp.Expression) exp.Expression {
|
||||
// need to force text type on all arguments
|
||||
aa := make([]any, len(args))
|
||||
for a := range args {
|
||||
aa[a] = exp.NewCastExpression(exp.NewLiteralExpression("?", args[a]), "TEXT")
|
||||
}
|
||||
|
||||
return exp.NewSQLFunctionExpression("INSTR", args[0], args[1])
|
||||
},
|
||||
},
|
||||
|
||||
// filtering
|
||||
"now": {
|
||||
|
||||
Reference in New Issue
Block a user