@@ -72,16 +72,16 @@ namespace sqlpp
72
72
if (handle->config ->debug )
73
73
std::cerr << " Sqlite3 debug: Preparing: '" << statement << " '" << std::endl;
74
74
75
- detail::prepared_statement_handle_t result ( nullptr , handle->config ->debug ) ;
75
+ detail::prepared_statement_handle_t result{ nullptr , handle->config ->debug } ;
76
76
77
77
auto rc = sqlite3_prepare_v2 (handle->native_handle (), statement.c_str (), static_cast <int >(statement.size ()),
78
78
&result.sqlite_statement , nullptr );
79
79
80
80
if (rc != SQLITE_OK)
81
81
{
82
- throw sqlpp::exception (
82
+ throw sqlpp::exception {
83
83
" Sqlite3 error: Could not prepare statement: " + std::string (sqlite3_errmsg (handle->native_handle ())) +
84
- " (statement was >>" + (rc == SQLITE_TOOBIG ? statement.substr (0 , 128 ) + " ..." : statement) + " <<\n " ) ;
84
+ " (statement was >>" + (rc == SQLITE_TOOBIG ? statement.substr (0 , 128 ) + " ..." : statement) + " <<\n " } ;
85
85
}
86
86
87
87
return result;
@@ -99,8 +99,8 @@ namespace sqlpp
99
99
default :
100
100
if (handle->config ->debug )
101
101
std::cerr << " Sqlite3 debug: sqlite3_step return code: " << rc << std::endl;
102
- throw sqlpp::exception ( " Sqlite3 error: Could not execute statement: " +
103
- std::string (sqlite3_errmsg (handle->native_handle ()))) ;
102
+ throw sqlpp::exception { " Sqlite3 error: Could not execute statement: " +
103
+ std::string (sqlite3_errmsg (handle->native_handle ()))} ;
104
104
}
105
105
}
106
106
} // namespace detail
@@ -110,7 +110,7 @@ namespace sqlpp
110
110
111
111
struct context_t
112
112
{
113
- context_t (const connection_base& db) : _db(db) , _count( 1 )
113
+ context_t (const connection_base& db) : _db{db} , _count{ 1 }
114
114
{
115
115
}
116
116
@@ -153,16 +153,16 @@ namespace sqlpp
153
153
active
154
154
};
155
155
156
- transaction_status_type _transaction_status = transaction_status_type::none;
156
+ transaction_status_type _transaction_status{ transaction_status_type::none} ;
157
157
158
158
// direct execution
159
159
bind_result_t select_impl (const std::string& statement)
160
160
{
161
- std::unique_ptr<detail::prepared_statement_handle_t > prepared (
162
- new detail::prepared_statement_handle_t (prepare_statement (_handle, statement))) ;
161
+ std::unique_ptr<detail::prepared_statement_handle_t > prepared{
162
+ new detail::prepared_statement_handle_t (prepare_statement (_handle, statement))} ;
163
163
if (!prepared)
164
164
{
165
- throw sqlpp::exception ( " Sqlite3 error: Could not store result set" ) ;
165
+ throw sqlpp::exception { " Sqlite3 error: Could not store result set" } ;
166
166
}
167
167
168
168
return {std::move (prepared)};
@@ -193,8 +193,8 @@ namespace sqlpp
193
193
// prepared execution
194
194
prepared_statement_t prepare_impl (const std::string& statement)
195
195
{
196
- return {std::unique_ptr<detail::prepared_statement_handle_t >(
197
- new detail::prepared_statement_handle_t (prepare_statement (_handle, statement))) };
196
+ return {std::unique_ptr<detail::prepared_statement_handle_t >{
197
+ new detail::prepared_statement_handle_t (prepare_statement (_handle, statement))} };
198
198
}
199
199
200
200
bind_result_t run_prepared_select_impl (prepared_statement_t & prepared_statement)
@@ -263,15 +263,15 @@ namespace sqlpp
263
263
template <typename Select>
264
264
bind_result_t select (const Select& s)
265
265
{
266
- _context_t context ( *this ) ;
266
+ _context_t context{ *this } ;
267
267
serialize (s, context);
268
268
return select_impl (context.str ());
269
269
}
270
270
271
271
template <typename Select>
272
272
_prepared_statement_t prepare_select (Select& s)
273
273
{
274
- _context_t context ( *this ) ;
274
+ _context_t context{ *this } ;
275
275
serialize (s, context);
276
276
return prepare_impl (context.str ());
277
277
}
@@ -288,15 +288,15 @@ namespace sqlpp
288
288
template <typename Insert>
289
289
size_t insert (const Insert& i)
290
290
{
291
- _context_t context ( *this ) ;
291
+ _context_t context{ *this } ;
292
292
serialize (i, context);
293
293
return insert_impl (context.str ());
294
294
}
295
295
296
296
template <typename Insert>
297
297
_prepared_statement_t prepare_insert (Insert& i)
298
298
{
299
- _context_t context ( *this ) ;
299
+ _context_t context{ *this } ;
300
300
serialize (i, context);
301
301
return prepare_impl (context.str ());
302
302
}
@@ -313,15 +313,15 @@ namespace sqlpp
313
313
template <typename Update>
314
314
size_t update (const Update& u)
315
315
{
316
- _context_t context ( *this ) ;
316
+ _context_t context{ *this } ;
317
317
serialize (u, context);
318
318
return update_impl (context.str ());
319
319
}
320
320
321
321
template <typename Update>
322
322
_prepared_statement_t prepare_update (Update& u)
323
323
{
324
- _context_t context ( *this ) ;
324
+ _context_t context{ *this } ;
325
325
serialize (u, context);
326
326
return prepare_impl (context.str ());
327
327
}
@@ -338,15 +338,15 @@ namespace sqlpp
338
338
template <typename Remove>
339
339
size_t remove (const Remove& r)
340
340
{
341
- _context_t context ( *this ) ;
341
+ _context_t context{ *this } ;
342
342
serialize (r, context);
343
343
return remove_impl (context.str ());
344
344
}
345
345
346
346
template <typename Remove>
347
347
_prepared_statement_t prepare_remove (Remove& r)
348
348
{
349
- _context_t context ( *this ) ;
349
+ _context_t context{ *this } ;
350
350
serialize (r, context);
351
351
return prepare_impl (context.str ());
352
352
}
@@ -372,15 +372,15 @@ namespace sqlpp
372
372
typename Enable = typename std::enable_if<not std::is_convertible<Execute, std::string>::value, void >::type>
373
373
size_t execute (const Execute& x)
374
374
{
375
- _context_t context ( *this ) ;
375
+ _context_t context{ *this } ;
376
376
serialize (x, context);
377
377
return execute (context.str ());
378
378
}
379
379
380
380
template <typename Execute>
381
381
_prepared_statement_t prepare_execute (Execute& x)
382
382
{
383
- _context_t context ( *this ) ;
383
+ _context_t context{ *this } ;
384
384
serialize (x, context);
385
385
return prepare_impl (context.str ());
386
386
}
@@ -472,7 +472,7 @@ namespace sqlpp
472
472
{
473
473
if (_transaction_status == transaction_status_type::active)
474
474
{
475
- throw sqlpp::exception ( " Sqlite3 error: Cannot have more than one open transaction per connection" ) ;
475
+ throw sqlpp::exception { " Sqlite3 error: Cannot have more than one open transaction per connection" } ;
476
476
}
477
477
478
478
_transaction_status = transaction_status_type::maybe;
@@ -486,7 +486,7 @@ namespace sqlpp
486
486
{
487
487
if (_transaction_status == transaction_status_type::none)
488
488
{
489
- throw sqlpp::exception ( " Sqlite3 error: Cannot commit a finished or failed transaction" ) ;
489
+ throw sqlpp::exception { " Sqlite3 error: Cannot commit a finished or failed transaction" } ;
490
490
}
491
491
_transaction_status = transaction_status_type::maybe;
492
492
auto prepared = prepare_statement (_handle, " COMMIT" );
@@ -500,7 +500,7 @@ namespace sqlpp
500
500
{
501
501
if (_transaction_status == transaction_status_type::none)
502
502
{
503
- throw sqlpp::exception ( " Sqlite3 error: Cannot rollback a finished or failed transaction" ) ;
503
+ throw sqlpp::exception { " Sqlite3 error: Cannot rollback a finished or failed transaction" } ;
504
504
}
505
505
if (report)
506
506
{
0 commit comments