-
Notifications
You must be signed in to change notification settings - Fork 0
/
xq_inf_sql_compile_context.go
49 lines (47 loc) · 1.36 KB
/
xq_inf_sql_compile_context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package xqi
import "github.com/go-xe2/x/xf/ef/xdriveri"
// sql参数化查询、预处理参数收集器
type SqlCompileContext interface {
// 添加参数到当前上下文
Add(val ...xdriveri.SqlParam) SqlCompileContext
// 添加参数到编译上下文件
AddParam(name string, val interface{}) xdriveri.SqlParam
// 所有已被收到的实参
Params() []xdriveri.SqlParam
// 获取指定序号的参数
ParamByIndex(index int) xdriveri.SqlParam
// 删除指定序号的参数
DeleteParam(index int) xdriveri.SqlParam
// 根据参数名删除参数
DeleteParamByName(name string) xdriveri.SqlParam
// 清空实参
ClearParams() SqlCompileContext
// 清空参数、表及状态
Clear() SqlCompileContext
// 拷贝实参
Copy(src SqlCompileContext) SqlCompileContext
// 参数个数
ParamCount() int
// 编译状态入栈
PushState(state SCPState) SqlCompileContext
// 编辑状态出栈
PopState() SCPState
// 获取最后状态
State() SCPState
// 条件表达式左则表达式入规模
PushLExp(exp SqlCompiler) SqlCompileContext
// 左则表达式出栈
PopLExp() SqlCompiler
// 最后出栈的表达式
LExp() SqlCompiler
// 生成参数名称
MakeParamId() string
// 生成标识Id
MakeIndentId() string
AssignTables(src SqlTables)
UseTable(table SqlTable)
Tables() SqlTables
SetDatabase(db Database)
Database() Database
TablePrefix() string
}