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.dialect.mysql.ast.statement.MySqlLoadXmlStatement; 17 18 19 import hunt.collection; 20 21 import hunt.sql.ast.SQLExpr; 22 import hunt.sql.ast.SQLName; 23 import hunt.sql.ast.SQLObject; 24 import hunt.sql.ast.expr.SQLLiteralExpr; 25 import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor; 26 import hunt.sql.dialect.mysql.ast.statement.MySqlStatementImpl; 27 28 public class MySqlLoadXmlStatement : MySqlStatementImpl { 29 30 alias accept0 = MySqlStatementImpl.accept0; 31 32 private bool lowPriority = false; 33 private bool concurrent = false; 34 private bool local = false; 35 36 private SQLLiteralExpr fileName; 37 38 private bool replicate = false; 39 private bool ignore = false; 40 41 private SQLName tableName; 42 43 private string charset; 44 45 private SQLExpr rowsIdentifiedBy; 46 47 private SQLExpr ignoreLinesNumber; 48 49 private List!(SQLExpr) setList; 50 51 this() 52 { 53 setList = new ArrayList!(SQLExpr)(); 54 } 55 56 public SQLExpr getRowsIdentifiedBy() { 57 return rowsIdentifiedBy; 58 } 59 60 public void setRowsIdentifiedBy(SQLExpr rowsIdentifiedBy) { 61 this.rowsIdentifiedBy = rowsIdentifiedBy; 62 } 63 64 public bool isLowPriority() { 65 return lowPriority; 66 } 67 68 public void setLowPriority(bool lowPriority) { 69 this.lowPriority = lowPriority; 70 } 71 72 public bool isConcurrent() { 73 return concurrent; 74 } 75 76 public void setConcurrent(bool concurrent) { 77 this.concurrent = concurrent; 78 } 79 80 public bool isLocal() { 81 return local; 82 } 83 84 public void setLocal(bool local) { 85 this.local = local; 86 } 87 88 public SQLLiteralExpr getFileName() { 89 return fileName; 90 } 91 92 public void setFileName(SQLLiteralExpr fileName) { 93 this.fileName = fileName; 94 } 95 96 public bool isReplicate() { 97 return replicate; 98 } 99 100 public void setReplicate(bool replicate) { 101 this.replicate = replicate; 102 } 103 104 public bool isIgnore() { 105 return ignore; 106 } 107 108 public void setIgnore(bool ignore) { 109 this.ignore = ignore; 110 } 111 112 public SQLName getTableName() { 113 return tableName; 114 } 115 116 public void setTableName(SQLName tableName) { 117 this.tableName = tableName; 118 } 119 120 public string getCharset() { 121 return charset; 122 } 123 124 public void setCharset(string charset) { 125 this.charset = charset; 126 } 127 128 public SQLExpr getIgnoreLinesNumber() { 129 return ignoreLinesNumber; 130 } 131 132 public void setIgnoreLinesNumber(SQLExpr ignoreLinesNumber) { 133 this.ignoreLinesNumber = ignoreLinesNumber; 134 } 135 136 public List!(SQLExpr) getSetList() { 137 return setList; 138 } 139 140 override public void accept0(MySqlASTVisitor visitor) { 141 if (visitor.visit(this)) { 142 acceptChild(visitor, fileName); 143 acceptChild(visitor, tableName); 144 acceptChild(visitor, rowsIdentifiedBy); 145 // acceptChild(visitor, columnsTerminatedBy); 146 // acceptChild(visitor, columnsEnclosedBy); 147 // acceptChild(visitor, columnsEscaped); 148 // acceptChild(visitor, linesStartingBy); 149 // acceptChild(visitor, linesTerminatedBy); 150 acceptChild(visitor, ignoreLinesNumber); 151 acceptChild(visitor, cast(List!(SQLObject))setList); 152 } 153 visitor.endVisit(this); 154 } 155 156 override 157 public List!(SQLObject) getChildren() { 158 List!(SQLObject) children = new ArrayList!(SQLObject)(); 159 if (fileName !is null) { 160 children.add(fileName); 161 } 162 if (tableName !is null) { 163 children.add(tableName); 164 } 165 if (rowsIdentifiedBy !is null) { 166 children.add(rowsIdentifiedBy); 167 } 168 if (ignoreLinesNumber !is null) { 169 children.add(ignoreLinesNumber); 170 } 171 children.addAll(cast(List!SQLObject)(this.setList)); 172 return children; 173 } 174 }