1 /* 2 * Copyright (C) 2019, HuntLabs 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 */ 17 18 module hunt.database.driver.postgresql.impl.codec.Response; 19 20 /** 21 * 22 * <p> 23 * A common response message for PostgreSQL 24 * <a href="https://www.postgresql.org/docs/9.5/static/protocol-error-fields.html">Error and Notice Message Fields</a> 25 * 26 * @author <a href="mailto:emad.albloushi@gmail.com">Emad Alblueshi</a> 27 */ 28 29 abstract class Response { 30 31 private string severity; 32 private string code; 33 private string message; 34 private string detail; 35 private string hint; 36 private string position; 37 private string internalPosition; 38 private string internalQuery; 39 private string where; 40 private string file; 41 private string line; 42 private string routine; 43 private string schema; 44 private string table; 45 private string column; 46 private string dataType; 47 private string constraint; 48 49 string getSeverity() { 50 return severity; 51 } 52 53 void setSeverity(string severity) { 54 this.severity = severity; 55 } 56 57 string getCode() { 58 return code; 59 } 60 61 void setCode(string code) { 62 this.code = code; 63 } 64 65 string getMessage() { 66 return message; 67 } 68 69 void setMessage(string message) { 70 this.message = message; 71 } 72 73 string getDetail() { 74 return detail; 75 } 76 77 void setDetail(string detail) { 78 this.detail = detail; 79 } 80 81 string getHint() { 82 return hint; 83 } 84 85 void setHint(string hint) { 86 this.hint = hint; 87 } 88 89 string getPosition() { 90 return position; 91 } 92 93 void setPosition(string position) { 94 this.position = position; 95 } 96 97 string getWhere() { 98 return where; 99 } 100 101 void setWhere(string where) { 102 this.where = where; 103 } 104 105 string getFile() { 106 return file; 107 } 108 109 void setFile(string file) { 110 this.file = file; 111 } 112 113 string getLine() { 114 return line; 115 } 116 117 void setLine(string line) { 118 this.line = line; 119 } 120 121 string getRoutine() { 122 return routine; 123 } 124 125 void setRoutine(string routine) { 126 this.routine = routine; 127 } 128 129 string getSchema() { 130 return schema; 131 } 132 133 void setSchema(string schema) { 134 this.schema = schema; 135 } 136 137 string getTable() { 138 return table; 139 } 140 141 void setTable(string table) { 142 this.table = table; 143 } 144 145 string getColumn() { 146 return column; 147 } 148 149 void setColumn(string column) { 150 this.column = column; 151 } 152 153 string getDataType() { 154 return dataType; 155 } 156 157 void setDataType(string dataType) { 158 this.dataType = dataType; 159 } 160 161 string getConstraint() { 162 return constraint; 163 } 164 165 void setConstraint(string constraint) { 166 this.constraint = constraint; 167 } 168 169 170 string getInternalPosition() { 171 return internalPosition; 172 } 173 174 void setInternalPosition(string internalPosition) { 175 this.internalPosition = internalPosition; 176 } 177 178 string getInternalQuery() { 179 return internalQuery; 180 } 181 182 void setInternalQuery(string internalQuery) { 183 this.internalQuery = internalQuery; 184 } 185 186 187 override 188 string toString() { 189 return "Response{" ~ 190 "severity='" ~ severity ~ "\'" ~ 191 ", code='" ~ code ~ "\'" ~ 192 ", message='" ~ message ~ "\'" ~ 193 ", detail='" ~ detail ~ "\'" ~ 194 ", hint='" ~ hint ~ "\'" ~ 195 ", position='" ~ position ~ "\'" ~ 196 ", internalPosition='" ~ internalPosition ~ "\'" ~ 197 ", internalQuery='" ~ internalQuery ~ "\'" ~ 198 ", where='" ~ where ~ "\'" ~ 199 ", file='" ~ file ~ "\'" ~ 200 ", line='" ~ line ~ "\'" ~ 201 ", routine='" ~ routine ~ "\'" ~ 202 ", schema='" ~ schema ~ "\'" ~ 203 ", table='" ~ table ~ "\'" ~ 204 ", column='" ~ column ~ "\'" ~ 205 ", dataType='" ~ dataType ~ "\'" ~ 206 ", constraint='" ~ constraint ~ "\'" ~ 207 '}'; 208 } 209 }