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.NoticeResponse;
19 
20 import hunt.database.driver.postgresql.impl.codec.Response;
21 import hunt.database.base.impl.Notice;
22 
23 import hunt.logging;
24 
25 import std.conv;
26 
27 /**
28  * @author <a href="mailto:emad.albloushi@gmail.com">Emad Alblueshi</a>
29  */
30 
31 class NoticeResponse : Response, Notice {
32 
33     override void log() {
34         warning("Backend notice: " ~
35             "severity='" ~ getSeverity() ~ "'" ~
36             ", code='" ~ getCode() ~ "'" ~
37             ", message='" ~ getMessage() ~ "'" ~
38             ", detail='" ~ getDetail() ~ "'" ~
39             ", hint='" ~ getHint() ~ "'" ~
40             ", position='" ~ getPosition() ~ "'" ~
41             ", internalPosition='" ~ getInternalPosition() ~ "'" ~
42             ", internalQuery='" ~ getInternalQuery() ~ "'" ~
43             ", where='" ~ getWhere() ~ "'" ~
44             ", file='" ~ getFile() ~ "'" ~
45             ", line='" ~ getLine() ~ "'" ~
46             ", routine='" ~ getRoutine() ~ "'" ~
47             ", schema='" ~ getSchema() ~ "'" ~
48             ", table='" ~ getTable() ~ "'" ~
49             ", column='" ~ getColumn() ~ "'" ~
50             ", dataType='" ~ getDataType() ~ "'" ~
51             ", constraint='" ~ getConstraint() ~ "'");
52     }
53 
54     override string toString() {
55         return "NoticeResponse{" ~
56             "severity='" ~ getSeverity() ~ "\'" ~
57             ", code='" ~ getCode() ~ "\'" ~
58             ", message='" ~ getMessage() ~ "\'" ~
59             ", detail='" ~ getDetail() ~ "\'" ~
60             ", hint='" ~ getHint() ~ "\'" ~
61             ", position='" ~ getPosition() ~ "\'" ~
62             ", internalPosition='" ~ getInternalPosition() ~ "\'" ~
63             ", internalQuery='" ~ getInternalQuery() ~ "\'" ~
64             ", where='" ~ getWhere() ~ "\'" ~
65             ", file='" ~ getFile() ~ "\'" ~
66             ", line='" ~ getLine() ~ "\'" ~
67             ", routine='" ~ getRoutine() ~ "\'" ~
68             ", schema='" ~ getSchema() ~ "\'" ~
69             ", table='" ~ getTable() ~ "\'" ~
70             ", column='" ~ getColumn() ~ "\'" ~
71             ", dataType='" ~ getDataType() ~ "\'" ~
72             ", constraint='" ~ getConstraint() ~ "\'" ~
73             '}';
74     }
75 }