1 /*
2  * Copyright 2015-2018 HuntLabs.cn
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 module hunt.sql.visitor.SQLEvalVisitor;
17 
18 import hunt.collection;
19 
20 import hunt.sql.visitor.functions.Function;
21 import hunt.sql.visitor.SQLASTVisitor;
22 
23 import std.concurrency : initOnce;
24 
25 interface SQLEvalVisitor : SQLASTVisitor {
26 
27     enum  string EVAL_VALUE       = "eval.value";
28     enum  string EVAL_EXPR        = "eval.expr";
29 
30     static Object EVAL_ERROR() {
31         __gshared Object inst;
32         return initOnce!inst(new Object());
33     }
34     
35     static Object EVAL_VALUE_COUNT() {
36         __gshared Object inst;
37         return initOnce!inst(new Object());
38     }
39     
40     static Object EVAL_VALUE_NULL() {
41         __gshared Object inst;
42         return initOnce!inst(new Object());
43     }
44 
45     Function getFunction(string funcName);
46 
47     void registerFunction(string funcName, Function function_p);
48 
49     void unregisterFunction(string funcName);
50 
51     List!(Object) getParameters();
52 
53     void setParameters(List!(Object) parameters);
54 
55     int incrementAndGetVariantIndex();
56 
57     bool isMarkVariantIndex();
58 
59     void setMarkVariantIndex(bool markVariantIndex);
60 }