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.ExportParameterizedOutputVisitor;
17 
18 import hunt.sql.visitor.SQLASTOutputVisitor;
19 import hunt.sql.visitor.ExportParameterVisitor;
20 import hunt.String;
21 import hunt.collection;
22 import hunt.util.Appendable;
23 import hunt.util.Common;
24 import hunt.text;
25 
26 public class ExportParameterizedOutputVisitor : SQLASTOutputVisitor , ExportParameterVisitor {
27 
28     /**
29      * true= if require parameterized sql output
30      */
31     private  bool requireParameterizedOutput;
32 
33     override public bool isParameterizedMergeInList()
34     {
35         return super.isParameterizedMergeInList();
36     }
37     override public void setParameterizedMergeInList(bool flag)
38     {
39         return super.setParameterizedMergeInList(flag);
40     }
41 
42     public this( List!(Object) parameters, Appendable appender, bool wantParameterizedOutput){
43         super(appender, true);
44         this.parameters = parameters;
45         this.requireParameterizedOutput = wantParameterizedOutput;
46     }
47 
48     public this() {
49         this(new ArrayList!(Object)());
50     }
51 
52     public this( List!(Object) parameters){
53         this(parameters,new StringBuilder(),false);
54     }
55 
56     public this( Appendable appender) {
57         this(new ArrayList!(Object)(), appender, true);
58     }
59 
60     
61     override public List!(Object) getParameters() {
62         return parameters;
63     }
64 }