32
32
//! # }
33
33
//! ```
34
34
35
+ #[ cfg( feature = "log" ) ]
35
36
use log:: debug;
36
37
use rusqlite:: ToSql ;
37
38
use serde_rusqlite:: * ;
@@ -50,7 +51,10 @@ impl GeekConnection for rusqlite::Connection {
50
51
+ serde:: de:: DeserializeOwned ,
51
52
{
52
53
let query = T :: query_create ( ) . build ( ) ?;
53
- debug ! ( "Create Table Query :: {:?}" , query. to_str( ) ) ;
54
+ #[ cfg( feature = "log" ) ]
55
+ {
56
+ debug ! ( "Create Table Query :: {:?}" , query. to_str( ) ) ;
57
+ }
54
58
connection
55
59
. execute ( query. to_str ( ) , ( ) )
56
60
. map_err ( |e| crate :: Error :: RuSQLiteError ( e. to_string ( ) ) ) ?;
@@ -64,7 +68,10 @@ impl GeekConnection for rusqlite::Connection {
64
68
where
65
69
T : serde:: de:: DeserializeOwned ,
66
70
{
67
- debug ! ( "Query :: {:?}" , query. to_str( ) ) ;
71
+ #[ cfg( feature = "log" ) ]
72
+ {
73
+ debug ! ( "Query :: {:?}" , query. to_str( ) ) ;
74
+ }
68
75
let mut statement = connection
69
76
. prepare ( query. to_str ( ) )
70
77
. map_err ( |e| crate :: Error :: RuSQLiteError ( e. to_string ( ) ) ) ?;
@@ -74,7 +81,10 @@ impl GeekConnection for rusqlite::Connection {
74
81
} else {
75
82
rusqlite:: params_from_iter ( query. values . into_iter ( ) )
76
83
} ;
77
- debug ! ( "Query Params :: {:?}" , params) ;
84
+ #[ cfg( feature = "log" ) ]
85
+ {
86
+ debug ! ( "Query Params :: {:?}" , params) ;
87
+ }
78
88
79
89
let mut results = Vec :: new ( ) ;
80
90
@@ -97,7 +107,10 @@ impl GeekConnection for rusqlite::Connection {
97
107
where
98
108
T : serde:: de:: DeserializeOwned ,
99
109
{
100
- debug ! ( "Query First :: {:?}" , query. to_str( ) ) ;
110
+ #[ cfg( feature = "log" ) ]
111
+ {
112
+ debug ! ( "Query First :: {:?}" , query. to_str( ) ) ;
113
+ }
101
114
let mut statement = connection
102
115
. prepare ( query. to_str ( ) )
103
116
. map_err ( |e| crate :: Error :: RuSQLiteError ( e. to_string ( ) ) ) ?;
@@ -107,7 +120,10 @@ impl GeekConnection for rusqlite::Connection {
107
120
} else {
108
121
rusqlite:: params_from_iter ( query. values . into_iter ( ) )
109
122
} ;
110
- debug ! ( "Query First Params :: {:?}" , params) ;
123
+ #[ cfg( feature = "log" ) ]
124
+ {
125
+ debug ! ( "Query First Params :: {:?}" , params) ;
126
+ }
111
127
112
128
let mut res = from_rows :: < T > (
113
129
statement
@@ -128,7 +144,10 @@ impl GeekConnection for rusqlite::Connection {
128
144
where
129
145
T : serde:: de:: DeserializeOwned ,
130
146
{
131
- debug ! ( "Execute :: {:?}" , query. to_str( ) ) ;
147
+ #[ cfg( feature = "log" ) ]
148
+ {
149
+ debug ! ( "Execute :: {:?}" , query. to_str( ) ) ;
150
+ }
132
151
let mut statement = connection
133
152
. prepare ( query. to_str ( ) )
134
153
. map_err ( |e| crate :: Error :: RuSQLiteError ( e. to_string ( ) ) ) ?;
@@ -138,7 +157,10 @@ impl GeekConnection for rusqlite::Connection {
138
157
} else {
139
158
rusqlite:: params_from_iter ( query. values . into_iter ( ) )
140
159
} ;
141
- debug ! ( "Execute Params :: {:?}" , params) ;
160
+ #[ cfg( feature = "log" ) ]
161
+ {
162
+ debug ! ( "Execute Params :: {:?}" , params) ;
163
+ }
142
164
143
165
statement
144
166
. execute ( params)
0 commit comments