~ubuntu-branches/debian/sid/sqlheavy/sid

« back to all changes in this revision

Viewing changes to sqlheavy/sqlheavy-database.c

  • Committer: Package Import Robot
  • Author(s): Devid Antonio Filoni
  • Date: 2012-05-17 09:47:17 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120517094717-ue17pqaud5tywjj5
Tags: 0.1.1-1
* New upstream release (Closes: #663320).
* Fix debug-package-should-be-priority-extra lintian warning.
* debian/control: switch to vala-0.16 in Build-Depends field.
* debian/libsqlheavy-dev.install, debian/libsqlheavygtk-dev.install:
  install files in vala-0.16 dir.
* Update libsqlheavy0.1-0.symbols.amd64 file.
* debian/rules: update override_dh_makeshlibs target.
* Bump Standards-Version to 3.9.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* sqlheavy-database.c generated by valac 0.12.1, the Vala compiler
 
1
/* sqlheavy-database.c generated by valac 0.16.0, the Vala compiler
2
2
 * generated from sqlheavy-database.vala, do not modify */
3
3
 
4
4
 
79
79
        GSimpleAsyncResult* _async_result;
80
80
        SQLHeavyDatabase* self;
81
81
        gchar* destination;
82
 
        SQLHeavyDatabase* _tmp0_;
 
82
        const gchar* _tmp0_;
83
83
        SQLHeavyDatabase* _tmp1_;
84
84
        SQLHeavyDatabase* _tmp2_;
85
 
        SQLHeavyBackup* _tmp3_;
 
85
        SQLHeavyDatabase* _tmp3_;
86
86
        SQLHeavyBackup* _tmp4_;
 
87
        SQLHeavyBackup* _tmp5_;
87
88
        SQLHeavyBackup* backup;
 
89
        SQLHeavyBackup* _tmp6_;
88
90
        GError * _inner_error_;
89
91
};
90
92
 
139
141
        SQL_HEAVY_DATABASE_VDBE_LISTING
140
142
};
141
143
static void sql_heavy_database_unregister_function_context (SQLHeavyDatabase* self, SQLHeavyUserFunctionUserFuncData* ufc);
 
144
static void _g_object_unref0_ (gpointer var);
142
145
static void sql_heavy_database_try_wal_checkpoint (SQLHeavyDatabase* self);
143
146
void sql_heavy_database_register_orm_table (SQLHeavyDatabase* self, SQLHeavyTable* table);
144
147
gint sql_heavy_table_direct_compare (SQLHeavyTable* a, SQLHeavyTable* b);
175
178
static GValue* _sql_heavy_common_function_compress_sql_heavy_user_function_user_func (SQLHeavyUserFunctionContext* ctx, GValueArray* args, gpointer self, GError** error);
176
179
static GValue* _sql_heavy_common_function_decompress_sql_heavy_user_function_user_func (SQLHeavyUserFunctionContext* ctx, GValueArray* args, gpointer self, GError** error);
177
180
static void sql_heavy_database_backup_async_data_free (gpointer _data);
178
 
static gboolean sql_heavy_database_backup_async_co (SqlHeavyDatabaseBackupAsyncData* data);
 
181
static gboolean sql_heavy_database_backup_async_co (SqlHeavyDatabaseBackupAsyncData* _data_);
179
182
static void sql_heavy_database_backup_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
180
183
gboolean sql_heavy_error_if_not_ok (gint ec, SQLHeavyQueryable* queryable, GError** error);
181
184
gint sql_heavy_database_direct_compare (SQLHeavyDatabase* a, SQLHeavyDatabase* b);
182
185
static gboolean sql_heavy_database_real_init (SQLHeavyDatabase* self, GCancellable* cancellable, GError** error);
183
186
const gchar* sql_heavy_sqlite_errstr (gint ec);
184
 
static void _lambda6_ (SQLHeavyDatabase* self, const gchar* sql);
185
 
static void __lambda6__sqlite_trace_callback (gpointer self, const gchar* message);
 
187
static void __lambda8_ (SQLHeavyDatabase* self, const gchar* sql);
 
188
static void ___lambda8__sqlite_trace_callback (gpointer self, const gchar* message);
186
189
static void _sql_heavy_database_update_hook_cb_sqlite_update_callback (gpointer self, int action, const gchar* dbname, const gchar* table, gint64 rowid);
187
 
static gint _lambda7_ (SQLHeavyDatabase* self, sqlite3* db, const gchar* dbname, gint pages);
188
 
static gint __lambda7__sql_heavy_wal_hook_callback (gpointer self, sqlite3* db, const gchar* dbname, gint pages);
 
190
static gint _sql_heavy_database_journal_mode____lambda9_ (SQLHeavyDatabase* self, sqlite3* db, const gchar* dbname, gint pages);
 
191
static gint __sql_heavy_database_journal_mode____lambda9__sql_heavy_wal_hook_callback (gpointer self, sqlite3* db, const gchar* dbname, gint pages);
189
192
static void sql_heavy_database_real_wal_committed (SQLHeavyDatabase* self, const gchar* db_name, gint pages);
190
193
static void g_cclosure_user_marshal_VOID__STRING_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
191
194
static void sql_heavy_database_finalize (GObject* obj);
193
196
static void _vala_sql_heavy_database_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
194
197
 
195
198
 
 
199
static void _g_object_unref0_ (gpointer var) {
 
200
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
 
201
}
 
202
 
 
203
 
196
204
static void sql_heavy_database_try_wal_checkpoint (SQLHeavyDatabase* self) {
197
205
        GError * _inner_error_ = NULL;
198
206
        g_return_if_fail (self != NULL);
199
 
        sql_heavy_database_wal_checkpoint (self, NULL, &_inner_error_);
200
 
        if (_inner_error_ != NULL) {
201
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
202
 
                        goto __catch3_sql_heavy_error;
 
207
        {
 
208
                sql_heavy_database_wal_checkpoint (self, NULL, &_inner_error_);
 
209
                if (_inner_error_ != NULL) {
 
210
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
211
                                goto __catch3_sql_heavy_error;
 
212
                        }
 
213
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
214
                        g_clear_error (&_inner_error_);
 
215
                        return;
203
216
                }
204
 
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
205
 
                g_clear_error (&_inner_error_);
206
 
                return;
207
217
        }
208
218
        goto __finally3;
209
219
        __catch3_sql_heavy_error:
210
220
        {
211
 
                GError * e;
 
221
                GError* e = NULL;
 
222
                GError* _tmp0_;
 
223
                const gchar* _tmp1_;
212
224
                e = _inner_error_;
213
225
                _inner_error_ = NULL;
214
 
                g_critical ("sqlheavy-database.vala:51: Unable to auto-checkpoint: %s", e->message);
 
226
                _tmp0_ = e;
 
227
                _tmp1_ = _tmp0_->message;
 
228
                g_critical ("sqlheavy-database.vala:51: Unable to auto-checkpoint: %s", _tmp1_);
215
229
                _g_error_free0 (e);
216
230
        }
217
231
        __finally3:
240
254
        g_return_if_fail (self != NULL);
241
255
        g_return_if_fail (table != NULL);
242
256
        {
243
 
                const gchar* _tmp1_ = NULL;
244
 
                gchar* _tmp2_;
245
 
                gchar* tblname;
246
 
                gconstpointer _tmp3_ = NULL;
247
 
                GSequence* list;
248
 
                GSequenceIter* _tmp7_ = NULL;
 
257
                GHashTable* _tmp0_;
 
258
                _tmp0_ = self->priv->orm_tables;
249
259
                g_static_rec_mutex_lock (&self->priv->__lock_orm_tables);
250
 
                if (self->priv->orm_tables == NULL) {
251
 
                        GHashTable* _tmp0_ = NULL;
252
 
                        _tmp0_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_sequence_free);
253
 
                        _g_hash_table_unref0 (self->priv->orm_tables);
254
 
                        self->priv->orm_tables = _tmp0_;
255
 
                }
256
 
                _tmp1_ = sql_heavy_table_get_name (table);
257
 
                _tmp2_ = g_strdup (_tmp1_);
258
 
                tblname = _tmp2_;
259
 
                _tmp3_ = g_hash_table_lookup (self->priv->orm_tables, tblname);
260
 
                list = (GSequence*) _tmp3_;
261
 
                if (list == NULL) {
262
 
                        gchar* _tmp4_;
263
 
                        GSequence* _tmp5_ = NULL;
264
 
                        gconstpointer _tmp6_ = NULL;
265
 
                        _tmp4_ = g_strdup (tblname);
266
 
                        _tmp5_ = g_sequence_new (NULL);
267
 
                        g_hash_table_insert (self->priv->orm_tables, _tmp4_, _tmp5_);
268
 
                        _tmp6_ = g_hash_table_lookup (self->priv->orm_tables, tblname);
269
 
                        list = (GSequence*) _tmp6_;
270
 
                }
271
 
                _tmp7_ = g_sequence_insert_sorted (list, table, _sql_heavy_table_direct_compare_gcompare_data_func, NULL);
272
 
                _g_free0 (tblname);
 
260
                {
 
261
                        GHashTable* _tmp1_;
 
262
                        SQLHeavyTable* _tmp6_;
 
263
                        const gchar* _tmp7_;
 
264
                        const gchar* _tmp8_;
 
265
                        gchar* _tmp9_;
 
266
                        gchar* tblname;
 
267
                        GHashTable* _tmp10_;
 
268
                        const gchar* _tmp11_;
 
269
                        gconstpointer _tmp12_ = NULL;
 
270
                        GSequence* list;
 
271
                        GSequence* _tmp13_;
 
272
                        GSequence* _tmp21_;
 
273
                        SQLHeavyTable* _tmp22_;
 
274
                        GSequenceIter* _tmp23_ = NULL;
 
275
                        _tmp1_ = self->priv->orm_tables;
 
276
                        if (_tmp1_ == NULL) {
 
277
                                GHashFunc _tmp2_;
 
278
                                GEqualFunc _tmp3_;
 
279
                                GDestroyNotify _tmp4_;
 
280
                                GHashTable* _tmp5_;
 
281
                                _tmp2_ = g_str_hash;
 
282
                                _tmp3_ = g_str_equal;
 
283
                                _tmp4_ = g_free;
 
284
                                _tmp5_ = g_hash_table_new_full (_tmp2_, _tmp3_, _tmp4_, (GDestroyNotify) g_sequence_free);
 
285
                                _g_hash_table_unref0 (self->priv->orm_tables);
 
286
                                self->priv->orm_tables = _tmp5_;
 
287
                        }
 
288
                        _tmp6_ = table;
 
289
                        _tmp7_ = sql_heavy_table_get_name (_tmp6_);
 
290
                        _tmp8_ = _tmp7_;
 
291
                        _tmp9_ = g_strdup (_tmp8_);
 
292
                        tblname = _tmp9_;
 
293
                        _tmp10_ = self->priv->orm_tables;
 
294
                        _tmp11_ = tblname;
 
295
                        _tmp12_ = g_hash_table_lookup (_tmp10_, _tmp11_);
 
296
                        list = (GSequence*) _tmp12_;
 
297
                        _tmp13_ = list;
 
298
                        if (_tmp13_ == NULL) {
 
299
                                GHashTable* _tmp14_;
 
300
                                const gchar* _tmp15_;
 
301
                                gchar* _tmp16_;
 
302
                                GSequence* _tmp17_;
 
303
                                GHashTable* _tmp18_;
 
304
                                const gchar* _tmp19_;
 
305
                                gconstpointer _tmp20_ = NULL;
 
306
                                _tmp14_ = self->priv->orm_tables;
 
307
                                _tmp15_ = tblname;
 
308
                                _tmp16_ = g_strdup (_tmp15_);
 
309
                                _tmp17_ = g_sequence_new (NULL);
 
310
                                g_hash_table_insert (_tmp14_, _tmp16_, _tmp17_);
 
311
                                _tmp18_ = self->priv->orm_tables;
 
312
                                _tmp19_ = tblname;
 
313
                                _tmp20_ = g_hash_table_lookup (_tmp18_, _tmp19_);
 
314
                                list = (GSequence*) _tmp20_;
 
315
                        }
 
316
                        _tmp21_ = list;
 
317
                        _tmp22_ = table;
 
318
                        _tmp23_ = g_sequence_insert_sorted (_tmp21_, _tmp22_, _sql_heavy_table_direct_compare_gcompare_data_func, NULL);
 
319
                        _g_free0 (tblname);
 
320
                }
273
321
                __finally4:
274
 
                g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
322
                {
 
323
                        GHashTable* _tmp24_;
 
324
                        _tmp24_ = self->priv->orm_tables;
 
325
                        g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
326
                }
275
327
                if (_inner_error_ != NULL) {
276
328
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
277
329
                        g_clear_error (&_inner_error_);
291
343
        g_return_if_fail (self != NULL);
292
344
        g_return_if_fail (table != NULL);
293
345
        {
294
 
                const gchar* _tmp0_ = NULL;
295
 
                gconstpointer _tmp1_ = NULL;
296
 
                GSequence* list;
 
346
                GHashTable* _tmp0_;
 
347
                _tmp0_ = self->priv->orm_tables;
297
348
                g_static_rec_mutex_lock (&self->priv->__lock_orm_tables);
298
 
                _tmp0_ = sql_heavy_table_get_name (table);
299
 
                _tmp1_ = g_hash_table_lookup (self->priv->orm_tables, _tmp0_);
300
 
                list = (GSequence*) _tmp1_;
301
 
                if (list != NULL) {
302
 
                        GSequenceIter* _tmp2_ = NULL;
303
 
                        GSequenceIter* _tmp3_ = NULL;
304
 
                        GSequenceIter* iter;
305
 
                        gconstpointer _tmp4_ = NULL;
306
 
                        SQLHeavyTable* t2;
307
 
                        _tmp2_ = g_sequence_search (list, table, _sql_heavy_table_direct_compare_gcompare_data_func, NULL);
308
 
                        _tmp3_ = g_sequence_iter_prev (_tmp2_);
309
 
                        iter = _tmp3_;
310
 
                        _tmp4_ = g_sequence_get (iter);
311
 
                        t2 = (SQLHeavyTable*) _tmp4_;
312
 
                        if (((gulong) table) == ((gulong) t2)) {
313
 
                                g_sequence_remove (iter);
 
349
                {
 
350
                        GHashTable* _tmp1_;
 
351
                        SQLHeavyTable* _tmp2_;
 
352
                        const gchar* _tmp3_;
 
353
                        const gchar* _tmp4_;
 
354
                        gconstpointer _tmp5_ = NULL;
 
355
                        GSequence* list;
 
356
                        GSequence* _tmp6_;
 
357
                        _tmp1_ = self->priv->orm_tables;
 
358
                        _tmp2_ = table;
 
359
                        _tmp3_ = sql_heavy_table_get_name (_tmp2_);
 
360
                        _tmp4_ = _tmp3_;
 
361
                        _tmp5_ = g_hash_table_lookup (_tmp1_, _tmp4_);
 
362
                        list = (GSequence*) _tmp5_;
 
363
                        _tmp6_ = list;
 
364
                        if (_tmp6_ != NULL) {
 
365
                                GSequence* _tmp7_;
 
366
                                SQLHeavyTable* _tmp8_;
 
367
                                GSequenceIter* _tmp9_ = NULL;
 
368
                                GSequenceIter* _tmp10_ = NULL;
 
369
                                GSequenceIter* iter;
 
370
                                GSequenceIter* _tmp11_;
 
371
                                gconstpointer _tmp12_ = NULL;
 
372
                                SQLHeavyTable* t2;
 
373
                                SQLHeavyTable* _tmp13_;
 
374
                                SQLHeavyTable* _tmp14_;
 
375
                                _tmp7_ = list;
 
376
                                _tmp8_ = table;
 
377
                                _tmp9_ = g_sequence_search (_tmp7_, _tmp8_, _sql_heavy_table_direct_compare_gcompare_data_func, NULL);
 
378
                                _tmp10_ = g_sequence_iter_prev (_tmp9_);
 
379
                                iter = _tmp10_;
 
380
                                _tmp11_ = iter;
 
381
                                _tmp12_ = g_sequence_get (_tmp11_);
 
382
                                t2 = (SQLHeavyTable*) _tmp12_;
 
383
                                _tmp13_ = table;
 
384
                                _tmp14_ = t2;
 
385
                                if (((gulong) _tmp13_) == ((gulong) _tmp14_)) {
 
386
                                        GSequence* _tmp15_;
 
387
                                        GSequenceIter* _tmp16_;
 
388
                                        _tmp15_ = list;
 
389
                                        _tmp16_ = iter;
 
390
                                        g_sequence_remove (_tmp16_);
 
391
                                }
314
392
                        }
315
393
                }
316
394
                __finally5:
317
 
                g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
395
                {
 
396
                        GHashTable* _tmp17_;
 
397
                        _tmp17_ = self->priv->orm_tables;
 
398
                        g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
399
                }
318
400
                if (_inner_error_ != NULL) {
319
401
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
320
402
                        g_clear_error (&_inner_error_);
330
412
     * See SQLite documentation at [[http://www.sqlite.org/c3ref/update_hook.html]]
331
413
     */
332
414
static void sql_heavy_database_update_hook_cb (SQLHeavyDatabase* self, int action, const gchar* dbname, const gchar* table, gint64 rowid) {
 
415
        GHashTable* _tmp0_;
333
416
        g_return_if_fail (self != NULL);
334
417
        g_return_if_fail (dbname != NULL);
335
418
        g_return_if_fail (table != NULL);
336
 
        if (self->priv->orm_tables != NULL) {
337
 
                gconstpointer _tmp0_ = NULL;
 
419
        _tmp0_ = self->priv->orm_tables;
 
420
        if (_tmp0_ != NULL) {
 
421
                GHashTable* _tmp1_;
 
422
                const gchar* _tmp2_;
 
423
                gconstpointer _tmp3_ = NULL;
338
424
                GSequence* list;
339
 
                _tmp0_ = g_hash_table_lookup (self->priv->orm_tables, table);
340
 
                list = (GSequence*) _tmp0_;
341
 
                if (list != NULL) {
 
425
                GSequence* _tmp4_;
 
426
                _tmp1_ = self->priv->orm_tables;
 
427
                _tmp2_ = table;
 
428
                _tmp3_ = g_hash_table_lookup (_tmp1_, _tmp2_);
 
429
                list = (GSequence*) _tmp3_;
 
430
                _tmp4_ = list;
 
431
                if (_tmp4_ != NULL) {
342
432
                        {
343
 
                                GSequenceIter* _tmp1_ = NULL;
 
433
                                GSequence* _tmp5_;
 
434
                                GSequenceIter* _tmp6_ = NULL;
344
435
                                GSequenceIter* iter;
345
 
                                _tmp1_ = g_sequence_get_begin_iter (list);
346
 
                                iter = _tmp1_;
 
436
                                _tmp5_ = list;
 
437
                                _tmp6_ = g_sequence_get_begin_iter (_tmp5_);
 
438
                                iter = _tmp6_;
347
439
                                {
348
 
                                        gboolean _tmp2_;
349
 
                                        _tmp2_ = TRUE;
 
440
                                        gboolean _tmp7_;
 
441
                                        _tmp7_ = TRUE;
350
442
                                        while (TRUE) {
351
 
                                                gboolean _tmp4_;
352
 
                                                gconstpointer _tmp5_ = NULL;
 
443
                                                gboolean _tmp8_;
 
444
                                                GSequenceIter* _tmp11_;
 
445
                                                gboolean _tmp12_ = FALSE;
 
446
                                                GSequenceIter* _tmp13_;
 
447
                                                gconstpointer _tmp14_ = NULL;
353
448
                                                SQLHeavyTable* tbl;
354
 
                                                if (!_tmp2_) {
355
 
                                                        GSequenceIter* _tmp3_ = NULL;
356
 
                                                        _tmp3_ = g_sequence_iter_next (iter);
357
 
                                                        iter = _tmp3_;
 
449
                                                int _tmp15_;
 
450
                                                _tmp8_ = _tmp7_;
 
451
                                                if (!_tmp8_) {
 
452
                                                        GSequenceIter* _tmp9_;
 
453
                                                        GSequenceIter* _tmp10_ = NULL;
 
454
                                                        _tmp9_ = iter;
 
455
                                                        _tmp10_ = g_sequence_iter_next (_tmp9_);
 
456
                                                        iter = _tmp10_;
358
457
                                                }
359
 
                                                _tmp2_ = FALSE;
360
 
                                                _tmp4_ = g_sequence_iter_is_end (iter);
361
 
                                                if (!(!_tmp4_)) {
 
458
                                                _tmp7_ = FALSE;
 
459
                                                _tmp11_ = iter;
 
460
                                                _tmp12_ = g_sequence_iter_is_end (_tmp11_);
 
461
                                                if (!(!_tmp12_)) {
362
462
                                                        break;
363
463
                                                }
364
 
                                                _tmp5_ = g_sequence_get (iter);
365
 
                                                tbl = (SQLHeavyTable*) _tmp5_;
366
 
                                                if (action == SQLITE_UPDATE) {
367
 
                                                        g_signal_emit_by_name (tbl, "row-modified", rowid);
 
464
                                                _tmp13_ = iter;
 
465
                                                _tmp14_ = g_sequence_get (_tmp13_);
 
466
                                                tbl = (SQLHeavyTable*) _tmp14_;
 
467
                                                _tmp15_ = action;
 
468
                                                if (_tmp15_ == SQLITE_UPDATE) {
 
469
                                                        SQLHeavyTable* _tmp16_;
 
470
                                                        gint64 _tmp17_;
 
471
                                                        _tmp16_ = tbl;
 
472
                                                        _tmp17_ = rowid;
 
473
                                                        g_signal_emit_by_name (_tmp16_, "row-modified", _tmp17_);
368
474
                                                } else {
369
 
                                                        if (action == SQLITE_INSERT) {
370
 
                                                                g_signal_emit_by_name (tbl, "row-inserted", rowid);
 
475
                                                        int _tmp18_;
 
476
                                                        _tmp18_ = action;
 
477
                                                        if (_tmp18_ == SQLITE_INSERT) {
 
478
                                                                SQLHeavyTable* _tmp19_;
 
479
                                                                gint64 _tmp20_;
 
480
                                                                _tmp19_ = tbl;
 
481
                                                                _tmp20_ = rowid;
 
482
                                                                g_signal_emit_by_name (_tmp19_, "row-inserted", _tmp20_);
371
483
                                                        } else {
372
 
                                                                if (action == SQLITE_DELETE) {
373
 
                                                                        g_signal_emit_by_name (tbl, "row-deleted", rowid);
 
484
                                                                int _tmp21_;
 
485
                                                                _tmp21_ = action;
 
486
                                                                if (_tmp21_ == SQLITE_DELETE) {
 
487
                                                                        SQLHeavyTable* _tmp22_;
 
488
                                                                        gint64 _tmp23_;
 
489
                                                                        _tmp22_ = tbl;
 
490
                                                                        _tmp23_ = rowid;
 
491
                                                                        g_signal_emit_by_name (_tmp22_, "row-deleted", _tmp23_);
374
492
                                                                }
375
493
                                                        }
376
494
                                                }
391
509
     */
392
510
sqlite3* sql_heavy_database_get_sqlite_db (SQLHeavyDatabase* self) {
393
511
        sqlite3* result = NULL;
 
512
        sqlite3* _tmp0_;
394
513
        g_return_val_if_fail (self != NULL, NULL);
395
 
        result = (sqlite3*) self->priv->db;
 
514
        _tmp0_ = self->priv->db;
 
515
        result = (sqlite3*) _tmp0_;
396
516
        return result;
397
517
}
398
518
 
402
522
     */
403
523
static void sql_heavy_database_real_lock (SQLHeavyQueryable* base) {
404
524
        SQLHeavyDatabase * self;
 
525
        sqlite3_mutex* _tmp0_;
405
526
        self = (SQLHeavyDatabase*) base;
406
 
        sqlite3_mutex_enter (self->priv->_transaction_lock);
 
527
        _tmp0_ = self->priv->_transaction_lock;
 
528
        sqlite3_mutex_enter (_tmp0_);
407
529
}
408
530
 
409
531
 
412
534
     */
413
535
static void sql_heavy_database_real_unlock (SQLHeavyQueryable* base) {
414
536
        SQLHeavyDatabase * self;
 
537
        sqlite3_mutex* _tmp26_;
415
538
        GError * _inner_error_ = NULL;
416
539
        self = (SQLHeavyDatabase*) base;
417
540
        {
418
 
                gboolean _tmp0_ = FALSE;
 
541
                GSequence* _tmp0_;
 
542
                _tmp0_ = self->priv->_queue;
419
543
                g_static_rec_mutex_lock (&self->priv->__lock__queue);
420
 
                if (self->priv->_queue != NULL) {
421
 
                        gint _tmp1_;
422
 
                        _tmp1_ = g_sequence_get_length (self->priv->_queue);
423
 
                        _tmp0_ = _tmp1_ > 0;
424
 
                } else {
425
 
                        _tmp0_ = FALSE;
426
 
                }
427
 
                if (_tmp0_) {
428
 
                        {
429
 
                                GSequenceIter* _tmp2_ = NULL;
430
 
                                GSequenceIter* iter;
431
 
                                _tmp2_ = g_sequence_get_begin_iter (self->priv->_queue);
432
 
                                iter = _tmp2_;
433
 
                                {
434
 
                                        gboolean _tmp3_;
435
 
                                        _tmp3_ = TRUE;
436
 
                                        while (TRUE) {
437
 
                                                gboolean _tmp5_;
438
 
                                                gconstpointer _tmp6_ = NULL;
439
 
                                                SQLHeavyQueryResult* _tmp7_ = NULL;
440
 
                                                SQLHeavyQueryResult* _result_;
441
 
                                                if (!_tmp3_) {
442
 
                                                        GSequenceIter* _tmp4_ = NULL;
443
 
                                                        _tmp4_ = g_sequence_iter_next (iter);
444
 
                                                        iter = _tmp4_;
445
 
                                                }
446
 
                                                _tmp3_ = FALSE;
447
 
                                                _tmp5_ = g_sequence_iter_is_end (iter);
448
 
                                                if (!(!_tmp5_)) {
449
 
                                                        break;
450
 
                                                }
451
 
                                                _tmp6_ = g_sequence_get (iter);
452
 
                                                _tmp7_ = sql_heavy_query_result_new_no_exec ((SQLHeavyQuery*) _tmp6_, &_inner_error_);
453
 
                                                _result_ = _tmp7_;
454
 
                                                if (_inner_error_ != NULL) {
455
 
                                                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
456
 
                                                                goto __catch7_sql_heavy_error;
457
 
                                                        }
458
 
                                                        g_static_rec_mutex_unlock (&self->priv->__lock__queue);
459
 
                                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
460
 
                                                        g_clear_error (&_inner_error_);
461
 
                                                        return;
462
 
                                                }
463
 
                                                sql_heavy_query_result_next_internal (_result_, &_inner_error_);
464
 
                                                if (_inner_error_ != NULL) {
465
 
                                                        _g_object_unref0 (_result_);
466
 
                                                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
467
 
                                                                goto __catch7_sql_heavy_error;
468
 
                                                        }
469
 
                                                        _g_object_unref0 (_result_);
470
 
                                                        g_static_rec_mutex_unlock (&self->priv->__lock__queue);
471
 
                                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
472
 
                                                        g_clear_error (&_inner_error_);
473
 
                                                        return;
474
 
                                                }
475
 
                                                g_sequence_remove (iter);
476
 
                                                _g_object_unref0 (_result_);
477
 
                                        }
478
 
                                }
479
 
                        }
480
 
                        goto __finally7;
481
 
                        __catch7_sql_heavy_error:
482
 
                        {
483
 
                                GError * e;
484
 
                                e = _inner_error_;
485
 
                                _inner_error_ = NULL;
486
 
                                g_critical ("sqlheavy-database.vala:167: Unable to execute queued query: %s", e->message);
487
 
                                _g_error_free0 (e);
488
 
                        }
489
 
                        __finally7:
490
 
                        if (_inner_error_ != NULL) {
491
 
                                g_static_rec_mutex_unlock (&self->priv->__lock__queue);
492
 
                                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
493
 
                                g_clear_error (&_inner_error_);
494
 
                                return;
 
544
                {
 
545
                        gboolean _tmp1_ = FALSE;
 
546
                        GSequence* _tmp2_;
 
547
                        gboolean _tmp5_;
 
548
                        _tmp2_ = self->priv->_queue;
 
549
                        if (_tmp2_ != NULL) {
 
550
                                GSequence* _tmp3_;
 
551
                                gint _tmp4_ = 0;
 
552
                                _tmp3_ = self->priv->_queue;
 
553
                                _tmp4_ = g_sequence_get_length (_tmp3_);
 
554
                                _tmp1_ = _tmp4_ > 0;
 
555
                        } else {
 
556
                                _tmp1_ = FALSE;
 
557
                        }
 
558
                        _tmp5_ = _tmp1_;
 
559
                        if (_tmp5_) {
 
560
                                {
 
561
                                        {
 
562
                                                GSequence* _tmp6_;
 
563
                                                GSequenceIter* _tmp7_ = NULL;
 
564
                                                GSequenceIter* iter;
 
565
                                                _tmp6_ = self->priv->_queue;
 
566
                                                _tmp7_ = g_sequence_get_begin_iter (_tmp6_);
 
567
                                                iter = _tmp7_;
 
568
                                                {
 
569
                                                        gboolean _tmp8_;
 
570
                                                        _tmp8_ = TRUE;
 
571
                                                        while (TRUE) {
 
572
                                                                gboolean _tmp9_;
 
573
                                                                GSequenceIter* _tmp12_;
 
574
                                                                gboolean _tmp13_ = FALSE;
 
575
                                                                GSequenceIter* _tmp14_;
 
576
                                                                gconstpointer _tmp15_ = NULL;
 
577
                                                                SQLHeavyQueryResult* _tmp16_;
 
578
                                                                SQLHeavyQueryResult* _result_;
 
579
                                                                SQLHeavyQueryResult* _tmp18_;
 
580
                                                                GSequence* _tmp20_;
 
581
                                                                GSequenceIter* _tmp21_;
 
582
                                                                _tmp9_ = _tmp8_;
 
583
                                                                if (!_tmp9_) {
 
584
                                                                        GSequenceIter* _tmp10_;
 
585
                                                                        GSequenceIter* _tmp11_ = NULL;
 
586
                                                                        _tmp10_ = iter;
 
587
                                                                        _tmp11_ = g_sequence_iter_next (_tmp10_);
 
588
                                                                        iter = _tmp11_;
 
589
                                                                }
 
590
                                                                _tmp8_ = FALSE;
 
591
                                                                _tmp12_ = iter;
 
592
                                                                _tmp13_ = g_sequence_iter_is_end (_tmp12_);
 
593
                                                                if (!(!_tmp13_)) {
 
594
                                                                        break;
 
595
                                                                }
 
596
                                                                _tmp14_ = iter;
 
597
                                                                _tmp15_ = g_sequence_get (_tmp14_);
 
598
                                                                _tmp16_ = sql_heavy_query_result_new_no_exec ((SQLHeavyQuery*) _tmp15_, &_inner_error_);
 
599
                                                                _result_ = _tmp16_;
 
600
                                                                if (_inner_error_ != NULL) {
 
601
                                                                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
602
                                                                                goto __catch7_sql_heavy_error;
 
603
                                                                        }
 
604
                                                                        {
 
605
                                                                                GSequence* _tmp17_;
 
606
                                                                                _tmp17_ = self->priv->_queue;
 
607
                                                                                g_static_rec_mutex_unlock (&self->priv->__lock__queue);
 
608
                                                                        }
 
609
                                                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
610
                                                                        g_clear_error (&_inner_error_);
 
611
                                                                        return;
 
612
                                                                }
 
613
                                                                _tmp18_ = _result_;
 
614
                                                                sql_heavy_query_result_next_internal (_tmp18_, &_inner_error_);
 
615
                                                                if (_inner_error_ != NULL) {
 
616
                                                                        _g_object_unref0 (_result_);
 
617
                                                                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
618
                                                                                goto __catch7_sql_heavy_error;
 
619
                                                                        }
 
620
                                                                        _g_object_unref0 (_result_);
 
621
                                                                        {
 
622
                                                                                GSequence* _tmp19_;
 
623
                                                                                _tmp19_ = self->priv->_queue;
 
624
                                                                                g_static_rec_mutex_unlock (&self->priv->__lock__queue);
 
625
                                                                        }
 
626
                                                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
627
                                                                        g_clear_error (&_inner_error_);
 
628
                                                                        return;
 
629
                                                                }
 
630
                                                                _tmp20_ = self->priv->_queue;
 
631
                                                                _tmp21_ = iter;
 
632
                                                                g_sequence_remove (_tmp21_);
 
633
                                                                _g_object_unref0 (_result_);
 
634
                                                        }
 
635
                                                }
 
636
                                        }
 
637
                                }
 
638
                                goto __finally7;
 
639
                                __catch7_sql_heavy_error:
 
640
                                {
 
641
                                        GError* e = NULL;
 
642
                                        GError* _tmp22_;
 
643
                                        const gchar* _tmp23_;
 
644
                                        e = _inner_error_;
 
645
                                        _inner_error_ = NULL;
 
646
                                        _tmp22_ = e;
 
647
                                        _tmp23_ = _tmp22_->message;
 
648
                                        g_critical ("sqlheavy-database.vala:167: Unable to execute queued query: %s", _tmp23_);
 
649
                                        _g_error_free0 (e);
 
650
                                }
 
651
                                __finally7:
 
652
                                if (_inner_error_ != NULL) {
 
653
                                        {
 
654
                                                GSequence* _tmp24_;
 
655
                                                _tmp24_ = self->priv->_queue;
 
656
                                                g_static_rec_mutex_unlock (&self->priv->__lock__queue);
 
657
                                        }
 
658
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
659
                                        g_clear_error (&_inner_error_);
 
660
                                        return;
 
661
                                }
495
662
                        }
496
663
                }
497
664
                __finally6:
498
 
                g_static_rec_mutex_unlock (&self->priv->__lock__queue);
 
665
                {
 
666
                        GSequence* _tmp25_;
 
667
                        _tmp25_ = self->priv->_queue;
 
668
                        g_static_rec_mutex_unlock (&self->priv->__lock__queue);
 
669
                }
499
670
                if (_inner_error_ != NULL) {
500
671
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
501
672
                        g_clear_error (&_inner_error_);
502
673
                        return;
503
674
                }
504
675
        }
505
 
        sqlite3_mutex_leave (self->priv->_transaction_lock);
 
676
        _tmp26_ = self->priv->_transaction_lock;
 
677
        sqlite3_mutex_leave (_tmp26_);
506
678
}
507
679
 
508
680
 
520
692
        self = (SQLHeavyDatabase*) base;
521
693
        g_return_if_fail (query != NULL);
522
694
        {
523
 
                SQLHeavyQuery* _tmp1_;
524
 
                GSequenceIter* _tmp2_ = NULL;
 
695
                GSequence* _tmp0_;
 
696
                _tmp0_ = self->priv->_queue;
525
697
                g_static_rec_mutex_lock (&self->priv->__lock__queue);
526
 
                if (self->priv->_queue == NULL) {
527
 
                        GSequence* _tmp0_ = NULL;
528
 
                        _tmp0_ = g_sequence_new (g_object_unref);
529
 
                        _g_sequence_free0 (self->priv->_queue);
530
 
                        self->priv->_queue = _tmp0_;
 
698
                {
 
699
                        GSequence* _tmp1_;
 
700
                        GSequence* _tmp3_;
 
701
                        SQLHeavyQuery* _tmp4_;
 
702
                        SQLHeavyQuery* _tmp5_;
 
703
                        GSequenceIter* _tmp6_ = NULL;
 
704
                        _tmp1_ = self->priv->_queue;
 
705
                        if (_tmp1_ == NULL) {
 
706
                                GSequence* _tmp2_;
 
707
                                _tmp2_ = g_sequence_new (_g_object_unref0_);
 
708
                                _g_sequence_free0 (self->priv->_queue);
 
709
                                self->priv->_queue = _tmp2_;
 
710
                        }
 
711
                        _tmp3_ = self->priv->_queue;
 
712
                        _tmp4_ = query;
 
713
                        _tmp5_ = _g_object_ref0 (_tmp4_);
 
714
                        _tmp6_ = g_sequence_append (_tmp3_, _tmp5_);
531
715
                }
532
 
                _tmp1_ = _g_object_ref0 (query);
533
 
                _tmp2_ = g_sequence_append (self->priv->_queue, _tmp1_);
534
716
                __finally8:
535
 
                g_static_rec_mutex_unlock (&self->priv->__lock__queue);
 
717
                {
 
718
                        GSequence* _tmp7_;
 
719
                        _tmp7_ = self->priv->_queue;
 
720
                        g_static_rec_mutex_unlock (&self->priv->__lock__queue);
 
721
                }
536
722
                if (_inner_error_ != NULL) {
537
723
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
538
724
                                g_propagate_error (error, _inner_error_);
554
740
     * @see _step_lock
555
741
     */
556
742
void sql_heavy_database_step_lock (SQLHeavyDatabase* self) {
 
743
        sqlite3_mutex* _tmp0_;
557
744
        g_return_if_fail (self != NULL);
558
 
        sqlite3_mutex_enter (self->priv->_step_lock);
 
745
        _tmp0_ = self->priv->_step_lock;
 
746
        sqlite3_mutex_enter (_tmp0_);
559
747
}
560
748
 
561
749
 
566
754
     * @see _step_lock
567
755
     */
568
756
void sql_heavy_database_step_unlock (SQLHeavyDatabase* self) {
 
757
        sqlite3_mutex* _tmp0_;
569
758
        GError * _inner_error_ = NULL;
570
759
        g_return_if_fail (self != NULL);
571
 
        sqlite3_mutex_leave (self->priv->_step_lock);
 
760
        _tmp0_ = self->priv->_step_lock;
 
761
        sqlite3_mutex_leave (_tmp0_);
572
762
        {
573
 
                GSequenceIter* _tmp0_ = NULL;
574
 
                GSequenceIter* i;
 
763
                GSequence* _tmp1_;
 
764
                _tmp1_ = self->priv->needs_update_on_step_unlock;
575
765
                g_static_rec_mutex_lock (&self->priv->__lock_needs_update_on_step_unlock);
576
 
                _tmp0_ = g_sequence_get_begin_iter (self->priv->needs_update_on_step_unlock);
577
 
                i = _tmp0_;
578
 
                while (TRUE) {
579
 
                        gboolean _tmp1_;
580
 
                        gconstpointer _tmp2_ = NULL;
581
 
                        GSequenceIter* o;
 
766
                {
 
767
                        GSequence* _tmp2_;
582
768
                        GSequenceIter* _tmp3_ = NULL;
583
 
                        _tmp1_ = g_sequence_iter_is_end (i);
584
 
                        if (!(!_tmp1_)) {
585
 
                                break;
586
 
                        }
587
 
                        _tmp2_ = g_sequence_get (i);
588
 
                        sql_heavy_row_update_cache ((SQLHeavyRow*) _tmp2_, &_inner_error_);
589
 
                        if (_inner_error_ != NULL) {
590
 
                                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
591
 
                                        goto __catch10_sql_heavy_error;
592
 
                                }
593
 
                                g_static_rec_mutex_unlock (&self->priv->__lock_needs_update_on_step_unlock);
594
 
                                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
595
 
                                g_clear_error (&_inner_error_);
596
 
                                return;
597
 
                        }
598
 
                        goto __finally10;
599
 
                        __catch10_sql_heavy_error:
600
 
                        {
601
 
                                GError * e;
602
 
                                e = _inner_error_;
603
 
                                _inner_error_ = NULL;
604
 
                                g_warning ("sqlheavy-database.vala:224: Unable to update row cache: %s", e->message);
605
 
                                _g_error_free0 (e);
606
 
                        }
607
 
                        __finally10:
608
 
                        if (_inner_error_ != NULL) {
609
 
                                g_static_rec_mutex_unlock (&self->priv->__lock_needs_update_on_step_unlock);
610
 
                                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
611
 
                                g_clear_error (&_inner_error_);
612
 
                                return;
613
 
                        }
614
 
                        o = i;
615
 
                        _tmp3_ = g_sequence_iter_next (i);
 
769
                        GSequenceIter* i;
 
770
                        _tmp2_ = self->priv->needs_update_on_step_unlock;
 
771
                        _tmp3_ = g_sequence_get_begin_iter (_tmp2_);
616
772
                        i = _tmp3_;
617
 
                        g_sequence_remove (o);
 
773
                        while (TRUE) {
 
774
                                GSequenceIter* _tmp4_;
 
775
                                gboolean _tmp5_ = FALSE;
 
776
                                GSequenceIter* _tmp12_;
 
777
                                GSequenceIter* o;
 
778
                                GSequenceIter* _tmp13_;
 
779
                                GSequenceIter* _tmp14_ = NULL;
 
780
                                GSequence* _tmp15_;
 
781
                                GSequenceIter* _tmp16_;
 
782
                                _tmp4_ = i;
 
783
                                _tmp5_ = g_sequence_iter_is_end (_tmp4_);
 
784
                                if (!(!_tmp5_)) {
 
785
                                        break;
 
786
                                }
 
787
                                {
 
788
                                        GSequenceIter* _tmp6_;
 
789
                                        gconstpointer _tmp7_ = NULL;
 
790
                                        _tmp6_ = i;
 
791
                                        _tmp7_ = g_sequence_get (_tmp6_);
 
792
                                        sql_heavy_row_update_cache ((SQLHeavyRow*) _tmp7_, &_inner_error_);
 
793
                                        if (_inner_error_ != NULL) {
 
794
                                                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
795
                                                        goto __catch10_sql_heavy_error;
 
796
                                                }
 
797
                                                {
 
798
                                                        GSequence* _tmp8_;
 
799
                                                        _tmp8_ = self->priv->needs_update_on_step_unlock;
 
800
                                                        g_static_rec_mutex_unlock (&self->priv->__lock_needs_update_on_step_unlock);
 
801
                                                }
 
802
                                                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
803
                                                g_clear_error (&_inner_error_);
 
804
                                                return;
 
805
                                        }
 
806
                                }
 
807
                                goto __finally10;
 
808
                                __catch10_sql_heavy_error:
 
809
                                {
 
810
                                        GError* e = NULL;
 
811
                                        GError* _tmp9_;
 
812
                                        const gchar* _tmp10_;
 
813
                                        e = _inner_error_;
 
814
                                        _inner_error_ = NULL;
 
815
                                        _tmp9_ = e;
 
816
                                        _tmp10_ = _tmp9_->message;
 
817
                                        g_warning ("sqlheavy-database.vala:224: Unable to update row cache: %s", _tmp10_);
 
818
                                        _g_error_free0 (e);
 
819
                                }
 
820
                                __finally10:
 
821
                                if (_inner_error_ != NULL) {
 
822
                                        {
 
823
                                                GSequence* _tmp11_;
 
824
                                                _tmp11_ = self->priv->needs_update_on_step_unlock;
 
825
                                                g_static_rec_mutex_unlock (&self->priv->__lock_needs_update_on_step_unlock);
 
826
                                        }
 
827
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
828
                                        g_clear_error (&_inner_error_);
 
829
                                        return;
 
830
                                }
 
831
                                _tmp12_ = i;
 
832
                                o = _tmp12_;
 
833
                                _tmp13_ = i;
 
834
                                _tmp14_ = g_sequence_iter_next (_tmp13_);
 
835
                                i = _tmp14_;
 
836
                                _tmp15_ = self->priv->needs_update_on_step_unlock;
 
837
                                _tmp16_ = o;
 
838
                                g_sequence_remove (_tmp16_);
 
839
                        }
618
840
                }
619
841
                __finally9:
620
 
                g_static_rec_mutex_unlock (&self->priv->__lock_needs_update_on_step_unlock);
 
842
                {
 
843
                        GSequence* _tmp17_;
 
844
                        _tmp17_ = self->priv->needs_update_on_step_unlock;
 
845
                        g_static_rec_mutex_unlock (&self->priv->__lock_needs_update_on_step_unlock);
 
846
                }
621
847
                if (_inner_error_ != NULL) {
622
848
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
623
849
                        g_clear_error (&_inner_error_);
633
859
     * @param cb the callback to add
634
860
     */
635
861
void sql_heavy_database_add_step_unlock_notify_row (SQLHeavyDatabase* self, SQLHeavyRow* row) {
636
 
        SQLHeavyRow* _tmp0_;
637
 
        GSequenceIter* _tmp1_ = NULL;
 
862
        GSequence* _tmp0_;
 
863
        SQLHeavyRow* _tmp1_;
 
864
        SQLHeavyRow* _tmp2_;
 
865
        GSequenceIter* _tmp3_ = NULL;
638
866
        g_return_if_fail (self != NULL);
639
867
        g_return_if_fail (row != NULL);
640
 
        _tmp0_ = _g_object_ref0 (row);
641
 
        _tmp1_ = g_sequence_append (self->priv->needs_update_on_step_unlock, _tmp0_);
 
868
        _tmp0_ = self->priv->needs_update_on_step_unlock;
 
869
        _tmp1_ = row;
 
870
        _tmp2_ = _g_object_ref0 (_tmp1_);
 
871
        _tmp3_ = g_sequence_append (_tmp0_, _tmp2_);
642
872
}
643
873
 
644
874
 
648
878
     * See SQLite documentation at [[http://www.sqlite.org/c3ref/interrupt.html]]
649
879
     */
650
880
void sql_heavy_database_interrupt (SQLHeavyDatabase* self) {
 
881
        sqlite3* _tmp0_;
651
882
        g_return_if_fail (self != NULL);
652
 
        sqlite3_interrupt (self->priv->db);
 
883
        _tmp0_ = self->priv->db;
 
884
        sqlite3_interrupt (_tmp0_);
653
885
}
654
886
 
655
887
 
661
893
     */
662
894
static gchar* sql_heavy_database_pragma_get_string (SQLHeavyDatabase* self, const gchar* pragma) {
663
895
        gchar* result = NULL;
664
 
        gchar* _tmp0_ = NULL;
665
 
        gchar* _tmp1_;
666
 
        SQLHeavyQuery* _tmp2_ = NULL;
667
 
        SQLHeavyQuery* _tmp3_;
668
 
        SQLHeavyQuery* _tmp4_;
669
 
        SQLHeavyQuery* _tmp5_;
670
 
        SQLHeavyQueryResult* _tmp6_ = NULL;
671
 
        SQLHeavyQueryResult* _tmp7_;
672
 
        SQLHeavyQueryResult* _tmp8_;
673
 
        SQLHeavyQueryResult* _tmp9_;
674
 
        gchar* _tmp10_ = NULL;
675
 
        gchar* _tmp11_;
676
 
        gchar* _tmp12_;
677
896
        GError * _inner_error_ = NULL;
678
897
        g_return_val_if_fail (self != NULL, NULL);
679
898
        g_return_val_if_fail (pragma != NULL, NULL);
680
 
        _tmp0_ = g_strdup_printf ("PRAGMA %s;", pragma);
681
 
        _tmp1_ = _tmp0_;
682
 
        _tmp2_ = sql_heavy_query_new ((SQLHeavyQueryable*) self, _tmp1_, &_inner_error_);
683
 
        _tmp3_ = _tmp2_;
684
 
        _g_free0 (_tmp1_);
685
 
        _tmp4_ = _tmp3_;
686
 
        if (_inner_error_ != NULL) {
687
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
688
 
                        goto __catch11_sql_heavy_error;
689
 
                }
690
 
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
691
 
                g_clear_error (&_inner_error_);
692
 
                return NULL;
693
 
        }
694
 
        _tmp5_ = _tmp4_;
695
 
        _tmp6_ = sql_heavy_query_execute (_tmp5_, NULL, &_inner_error_, NULL);
696
 
        _tmp7_ = _tmp6_;
697
 
        _g_object_unref0 (_tmp5_);
698
 
        _tmp8_ = _tmp7_;
699
 
        if (_inner_error_ != NULL) {
700
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
701
 
                        goto __catch11_sql_heavy_error;
702
 
                }
703
 
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
704
 
                g_clear_error (&_inner_error_);
705
 
                return NULL;
706
 
        }
707
 
        _tmp9_ = _tmp8_;
708
 
        _tmp10_ = sql_heavy_record_fetch_string ((SQLHeavyRecord*) _tmp9_, 0, &_inner_error_);
709
 
        _tmp11_ = _tmp10_;
710
 
        _g_object_unref0 (_tmp9_);
711
 
        _tmp12_ = _tmp11_;
712
 
        if (_inner_error_ != NULL) {
713
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
714
 
                        goto __catch11_sql_heavy_error;
715
 
                }
716
 
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
717
 
                g_clear_error (&_inner_error_);
718
 
                return NULL;
719
 
        }
720
 
        result = _tmp12_;
721
 
        return result;
 
899
        {
 
900
                const gchar* _tmp0_;
 
901
                gchar* _tmp1_ = NULL;
 
902
                gchar* _tmp2_;
 
903
                SQLHeavyQuery* _tmp3_;
 
904
                SQLHeavyQuery* _tmp4_;
 
905
                SQLHeavyQuery* _tmp5_;
 
906
                SQLHeavyQuery* _tmp6_;
 
907
                SQLHeavyQueryResult* _tmp7_ = NULL;
 
908
                SQLHeavyQueryResult* _tmp8_;
 
909
                SQLHeavyQueryResult* _tmp9_;
 
910
                SQLHeavyQueryResult* _tmp10_;
 
911
                gchar* _tmp11_ = NULL;
 
912
                gchar* _tmp12_;
 
913
                gchar* _tmp13_;
 
914
                _tmp0_ = pragma;
 
915
                _tmp1_ = g_strdup_printf ("PRAGMA %s;", _tmp0_);
 
916
                _tmp2_ = _tmp1_;
 
917
                _tmp3_ = sql_heavy_query_new ((SQLHeavyQueryable*) self, _tmp2_, &_inner_error_);
 
918
                _tmp4_ = _tmp3_;
 
919
                _g_free0 (_tmp2_);
 
920
                _tmp5_ = _tmp4_;
 
921
                if (_inner_error_ != NULL) {
 
922
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
923
                                goto __catch11_sql_heavy_error;
 
924
                        }
 
925
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
926
                        g_clear_error (&_inner_error_);
 
927
                        return NULL;
 
928
                }
 
929
                _tmp6_ = _tmp5_;
 
930
                _tmp7_ = sql_heavy_query_execute (_tmp6_, NULL, &_inner_error_, NULL);
 
931
                _tmp8_ = _tmp7_;
 
932
                _g_object_unref0 (_tmp6_);
 
933
                _tmp9_ = _tmp8_;
 
934
                if (_inner_error_ != NULL) {
 
935
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
936
                                goto __catch11_sql_heavy_error;
 
937
                        }
 
938
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
939
                        g_clear_error (&_inner_error_);
 
940
                        return NULL;
 
941
                }
 
942
                _tmp10_ = _tmp9_;
 
943
                _tmp11_ = sql_heavy_record_fetch_string ((SQLHeavyRecord*) _tmp10_, 0, &_inner_error_);
 
944
                _tmp12_ = _tmp11_;
 
945
                _g_object_unref0 (_tmp10_);
 
946
                _tmp13_ = _tmp12_;
 
947
                if (_inner_error_ != NULL) {
 
948
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
949
                                goto __catch11_sql_heavy_error;
 
950
                        }
 
951
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
952
                        g_clear_error (&_inner_error_);
 
953
                        return NULL;
 
954
                }
 
955
                result = _tmp13_;
 
956
                return result;
 
957
        }
722
958
        goto __finally11;
723
959
        __catch11_sql_heavy_error:
724
960
        {
725
 
                GError * e;
 
961
                GError* e = NULL;
 
962
                const gchar* _tmp14_;
 
963
                GError* _tmp15_;
 
964
                const gchar* _tmp16_;
726
965
                e = _inner_error_;
727
966
                _inner_error_ = NULL;
728
 
                g_critical ("sqlheavy-database.vala:342: Unable to retrieve pragma value %s: %s", pragma, e->message);
 
967
                _tmp14_ = pragma;
 
968
                _tmp15_ = e;
 
969
                _tmp16_ = _tmp15_->message;
 
970
                g_critical ("sqlheavy-database.vala:342: Unable to retrieve pragma value %s: %s", _tmp14_, _tmp16_);
729
971
                result = NULL;
730
972
                _g_error_free0 (e);
731
973
                return result;
745
987
     */
746
988
static gint sql_heavy_database_pragma_get_int (SQLHeavyDatabase* self, const gchar* pragma) {
747
989
        gint result = 0;
748
 
        gchar* _tmp0_ = NULL;
749
 
        gchar* _tmp1_;
750
 
        gint _tmp2_;
751
 
        gint _tmp3_;
 
990
        const gchar* _tmp0_;
 
991
        gchar* _tmp1_ = NULL;
 
992
        gchar* _tmp2_;
 
993
        gint _tmp3_ = 0;
 
994
        gint _tmp4_;
752
995
        g_return_val_if_fail (self != NULL, 0);
753
996
        g_return_val_if_fail (pragma != NULL, 0);
754
 
        _tmp0_ = sql_heavy_database_pragma_get_string (self, pragma);
755
 
        _tmp1_ = _tmp0_;
756
 
        _tmp2_ = atoi (_tmp1_);
757
 
        _tmp3_ = _tmp2_;
758
 
        _g_free0 (_tmp1_);
759
 
        result = _tmp3_;
 
997
        _tmp0_ = pragma;
 
998
        _tmp1_ = sql_heavy_database_pragma_get_string (self, _tmp0_);
 
999
        _tmp2_ = _tmp1_;
 
1000
        _tmp3_ = atoi (_tmp2_);
 
1001
        _tmp4_ = _tmp3_;
 
1002
        _g_free0 (_tmp2_);
 
1003
        result = _tmp4_;
760
1004
        return result;
761
1005
}
762
1006
 
769
1013
     */
770
1014
static gboolean sql_heavy_database_pragma_get_bool (SQLHeavyDatabase* self, const gchar* pragma) {
771
1015
        gboolean result = FALSE;
772
 
        gint _tmp0_;
 
1016
        const gchar* _tmp0_;
 
1017
        gint _tmp1_ = 0;
773
1018
        g_return_val_if_fail (self != NULL, FALSE);
774
1019
        g_return_val_if_fail (pragma != NULL, FALSE);
775
 
        _tmp0_ = sql_heavy_database_pragma_get_int (self, pragma);
776
 
        result = _tmp0_ != 0;
 
1020
        _tmp0_ = pragma;
 
1021
        _tmp1_ = sql_heavy_database_pragma_get_int (self, _tmp0_);
 
1022
        result = _tmp1_ != 0;
777
1023
        return result;
778
1024
}
779
1025
 
785
1031
     * @param the value of the pragma
786
1032
     */
787
1033
static void sql_heavy_database_pragma_set_string (SQLHeavyDatabase* self, const gchar* pragma, const gchar* value) {
788
 
        gchar* _tmp0_ = NULL;
789
 
        gchar* _tmp1_;
790
 
        SQLHeavyQuery* _tmp2_ = NULL;
791
 
        SQLHeavyQuery* _tmp3_;
792
 
        SQLHeavyQuery* stmt;
793
 
        SQLHeavyQueryResult* _tmp4_ = NULL;
794
 
        SQLHeavyQueryResult* _tmp5_;
795
1034
        GError * _inner_error_ = NULL;
796
1035
        g_return_if_fail (self != NULL);
797
1036
        g_return_if_fail (pragma != NULL);
798
1037
        g_return_if_fail (value != NULL);
799
 
        _tmp0_ = g_strdup_printf ("PRAGMA %s = %s;", pragma, value);
800
 
        _tmp1_ = _tmp0_;
801
 
        _tmp2_ = sql_heavy_query_new ((SQLHeavyQueryable*) self, _tmp1_, &_inner_error_);
802
 
        _tmp3_ = _tmp2_;
803
 
        _g_free0 (_tmp1_);
804
 
        stmt = _tmp3_;
805
 
        if (_inner_error_ != NULL) {
806
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
807
 
                        goto __catch12_sql_heavy_error;
808
 
                }
809
 
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
810
 
                g_clear_error (&_inner_error_);
811
 
                return;
812
 
        }
813
 
        _tmp4_ = sql_heavy_query_execute (stmt, NULL, &_inner_error_, NULL);
814
 
        _tmp5_ = _tmp4_;
815
 
        _g_object_unref0 (_tmp5_);
816
 
        if (_inner_error_ != NULL) {
817
 
                _g_object_unref0 (stmt);
818
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
819
 
                        goto __catch12_sql_heavy_error;
820
 
                }
821
 
                _g_object_unref0 (stmt);
822
 
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
823
 
                g_clear_error (&_inner_error_);
824
 
                return;
825
 
        }
826
 
        _g_object_unref0 (stmt);
 
1038
        {
 
1039
                const gchar* _tmp0_;
 
1040
                const gchar* _tmp1_;
 
1041
                gchar* _tmp2_ = NULL;
 
1042
                gchar* _tmp3_;
 
1043
                SQLHeavyQuery* _tmp4_;
 
1044
                SQLHeavyQuery* _tmp5_;
 
1045
                SQLHeavyQuery* stmt;
 
1046
                SQLHeavyQuery* _tmp6_;
 
1047
                SQLHeavyQueryResult* _tmp7_ = NULL;
 
1048
                SQLHeavyQueryResult* _tmp8_;
 
1049
                _tmp0_ = pragma;
 
1050
                _tmp1_ = value;
 
1051
                _tmp2_ = g_strdup_printf ("PRAGMA %s = %s;", _tmp0_, _tmp1_);
 
1052
                _tmp3_ = _tmp2_;
 
1053
                _tmp4_ = sql_heavy_query_new ((SQLHeavyQueryable*) self, _tmp3_, &_inner_error_);
 
1054
                _tmp5_ = _tmp4_;
 
1055
                _g_free0 (_tmp3_);
 
1056
                stmt = _tmp5_;
 
1057
                if (_inner_error_ != NULL) {
 
1058
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
1059
                                goto __catch12_sql_heavy_error;
 
1060
                        }
 
1061
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
1062
                        g_clear_error (&_inner_error_);
 
1063
                        return;
 
1064
                }
 
1065
                _tmp6_ = stmt;
 
1066
                _tmp7_ = sql_heavy_query_execute (_tmp6_, NULL, &_inner_error_, NULL);
 
1067
                _tmp8_ = _tmp7_;
 
1068
                _g_object_unref0 (_tmp8_);
 
1069
                if (_inner_error_ != NULL) {
 
1070
                        _g_object_unref0 (stmt);
 
1071
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
1072
                                goto __catch12_sql_heavy_error;
 
1073
                        }
 
1074
                        _g_object_unref0 (stmt);
 
1075
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
1076
                        g_clear_error (&_inner_error_);
 
1077
                        return;
 
1078
                }
 
1079
                _g_object_unref0 (stmt);
 
1080
        }
827
1081
        goto __finally12;
828
1082
        __catch12_sql_heavy_error:
829
1083
        {
830
 
                GError * e;
 
1084
                GError* e = NULL;
 
1085
                GError* _tmp9_;
 
1086
                const gchar* _tmp10_;
831
1087
                e = _inner_error_;
832
1088
                _inner_error_ = NULL;
833
 
                g_critical ("sqlheavy-database.vala:392: Unable to retrieve pragma value: %s", e->message);
 
1089
                _tmp9_ = e;
 
1090
                _tmp10_ = _tmp9_->message;
 
1091
                g_critical ("sqlheavy-database.vala:392: Unable to retrieve pragma value: %s", _tmp10_);
834
1092
                _g_error_free0 (e);
835
1093
        }
836
1094
        __finally12:
849
1107
     * @param the value of the pragma
850
1108
     */
851
1109
static void sql_heavy_database_pragma_set_int (SQLHeavyDatabase* self, const gchar* pragma, gint value) {
852
 
        gchar* _tmp0_ = NULL;
853
 
        gchar* _tmp1_;
 
1110
        const gchar* _tmp0_;
 
1111
        gint _tmp1_;
 
1112
        gchar* _tmp2_ = NULL;
 
1113
        gchar* _tmp3_;
854
1114
        g_return_if_fail (self != NULL);
855
1115
        g_return_if_fail (pragma != NULL);
856
 
        _tmp0_ = g_strdup_printf ("%d", value);
857
 
        _tmp1_ = _tmp0_;
858
 
        sql_heavy_database_pragma_set_string (self, pragma, _tmp1_);
859
 
        _g_free0 (_tmp1_);
 
1116
        _tmp0_ = pragma;
 
1117
        _tmp1_ = value;
 
1118
        _tmp2_ = g_strdup_printf ("%d", _tmp1_);
 
1119
        _tmp3_ = _tmp2_;
 
1120
        sql_heavy_database_pragma_set_string (self, _tmp0_, _tmp3_);
 
1121
        _g_free0 (_tmp3_);
860
1122
}
861
1123
 
862
1124
 
868
1130
     */
869
1131
static void sql_heavy_database_pragma_set_bool (SQLHeavyDatabase* self, const gchar* pragma, gboolean value) {
870
1132
        gint _tmp0_ = 0;
 
1133
        gboolean _tmp1_;
 
1134
        const gchar* _tmp2_;
 
1135
        gint _tmp3_;
871
1136
        g_return_if_fail (self != NULL);
872
1137
        g_return_if_fail (pragma != NULL);
873
 
        if (value) {
 
1138
        _tmp1_ = value;
 
1139
        if (_tmp1_) {
874
1140
                _tmp0_ = 1;
875
1141
        } else {
876
1142
                _tmp0_ = 0;
877
1143
        }
878
 
        sql_heavy_database_pragma_set_int (self, pragma, _tmp0_);
 
1144
        _tmp2_ = pragma;
 
1145
        _tmp3_ = _tmp0_;
 
1146
        sql_heavy_database_pragma_set_int (self, _tmp2_, _tmp3_);
879
1147
}
880
1148
 
881
1149
 
889
1157
     * @param pages the number of pages to remove
890
1158
     */
891
1159
void sql_heavy_database_incremental_vacuum (SQLHeavyDatabase* self, gint pages, GError** error) {
892
 
        gchar* _tmp0_ = NULL;
893
 
        gchar* _tmp1_;
894
 
        SQLHeavyQueryResult* _tmp2_ = NULL;
895
 
        SQLHeavyQueryResult* _tmp3_;
 
1160
        gint _tmp0_;
 
1161
        gchar* _tmp1_ = NULL;
 
1162
        gchar* _tmp2_;
 
1163
        SQLHeavyQueryResult* _tmp3_ = NULL;
 
1164
        SQLHeavyQueryResult* _tmp4_;
896
1165
        GError * _inner_error_ = NULL;
897
1166
        g_return_if_fail (self != NULL);
898
 
        _tmp0_ = g_strdup_printf ("PRAGMA incremental_vacuum(%d);", pages);
899
 
        _tmp1_ = _tmp0_;
900
 
        _tmp2_ = sql_heavy_queryable_execute ((SQLHeavyQueryable*) self, _tmp1_, &_inner_error_, NULL);
901
 
        _tmp3_ = _tmp2_;
902
 
        _g_object_unref0 (_tmp3_);
903
 
        _g_free0 (_tmp1_);
 
1167
        _tmp0_ = pages;
 
1168
        _tmp1_ = g_strdup_printf ("PRAGMA incremental_vacuum(%d);", _tmp0_);
 
1169
        _tmp2_ = _tmp1_;
 
1170
        _tmp3_ = sql_heavy_queryable_execute ((SQLHeavyQueryable*) self, _tmp2_, &_inner_error_, NULL);
 
1171
        _tmp4_ = _tmp3_;
 
1172
        _g_object_unref0 (_tmp4_);
 
1173
        _g_free0 (_tmp2_);
904
1174
        if (_inner_error_ != NULL) {
905
1175
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
906
1176
                        g_propagate_error (error, _inner_error_);
935
1205
 
936
1206
 
937
1207
void sql_heavy_database_register_aggregate_function (SQLHeavyDatabase* self, const gchar* name, gint argc, SQLHeavyUserFunctionUserFunc func, void* func_target, GDestroyNotify func_target_destroy_notify, SQLHeavyUserFunctionFinalizeFunc final, void* final_target, GDestroyNotify final_target_destroy_notify) {
938
 
        SQLHeavyUserFunctionUserFuncData* _tmp0_ = NULL;
 
1208
        const gchar* _tmp0_;
 
1209
        const gchar* _tmp1_;
 
1210
        gint _tmp2_;
 
1211
        SQLHeavyUserFunctionUserFunc _tmp3_;
 
1212
        void* _tmp3__target;
 
1213
        SQLHeavyUserFunctionUserFuncData* _tmp4_;
939
1214
        SQLHeavyUserFunctionUserFuncData* ufc;
940
 
        gchar* _tmp1_;
941
 
        SQLHeavyUserFunctionUserFuncData* _tmp2_;
 
1215
        GHashTable* _tmp5_;
 
1216
        const gchar* _tmp6_;
 
1217
        gchar* _tmp7_;
 
1218
        SQLHeavyUserFunctionUserFuncData* _tmp8_;
 
1219
        sqlite3* _tmp9_;
 
1220
        const gchar* _tmp10_;
 
1221
        gint _tmp11_;
942
1222
        g_return_if_fail (self != NULL);
943
1223
        g_return_if_fail (name != NULL);
944
 
        sql_heavy_database_unregister_function (self, name);
945
 
        _tmp0_ = sql_heavy_user_function_user_func_data_new_scalar (self, name, argc, func, func_target);
946
 
        ufc = _tmp0_;
947
 
        _tmp1_ = g_strdup (name);
948
 
        _tmp2_ = _g_object_ref0 (ufc);
949
 
        g_hash_table_insert (self->priv->user_functions, _tmp1_, _tmp2_);
950
 
        sqlite3_create_function (self->priv->db, name, argc, SQLITE_UTF8, ufc, NULL, _sql_heavy_user_function_on_user_function_called_sqlite_user_func_callback, _sql_heavy_user_function_on_user_finalize_called_sqlite_user_func_finish_callback);
 
1224
        _tmp0_ = name;
 
1225
        sql_heavy_database_unregister_function (self, _tmp0_);
 
1226
        _tmp1_ = name;
 
1227
        _tmp2_ = argc;
 
1228
        _tmp3_ = func;
 
1229
        _tmp3__target = func_target;
 
1230
        _tmp4_ = sql_heavy_user_function_user_func_data_new_scalar (self, _tmp1_, _tmp2_, _tmp3_, _tmp3__target);
 
1231
        ufc = _tmp4_;
 
1232
        _tmp5_ = self->priv->user_functions;
 
1233
        _tmp6_ = name;
 
1234
        _tmp7_ = g_strdup (_tmp6_);
 
1235
        _tmp8_ = _g_object_ref0 (ufc);
 
1236
        g_hash_table_insert (_tmp5_, _tmp7_, _tmp8_);
 
1237
        _tmp9_ = self->priv->db;
 
1238
        _tmp10_ = name;
 
1239
        _tmp11_ = argc;
 
1240
        sqlite3_create_function_v2 (_tmp9_, _tmp10_, _tmp11_, SQLITE_UTF8, ufc, NULL, _sql_heavy_user_function_on_user_function_called_sqlite_user_func_callback, _sql_heavy_user_function_on_user_finalize_called_sqlite_user_func_finish_callback, NULL);
951
1241
        _g_object_unref0 (ufc);
952
1242
        (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
953
1243
        func = NULL;
968
1258
     * @param func callback for the user defined function
969
1259
     */
970
1260
void sql_heavy_database_register_scalar_function (SQLHeavyDatabase* self, const gchar* name, gint argc, SQLHeavyUserFunctionUserFunc func, void* func_target, GDestroyNotify func_target_destroy_notify) {
971
 
        SQLHeavyUserFunctionUserFuncData* _tmp0_ = NULL;
 
1261
        const gchar* _tmp0_;
 
1262
        const gchar* _tmp1_;
 
1263
        gint _tmp2_;
 
1264
        SQLHeavyUserFunctionUserFunc _tmp3_;
 
1265
        void* _tmp3__target;
 
1266
        SQLHeavyUserFunctionUserFuncData* _tmp4_;
972
1267
        SQLHeavyUserFunctionUserFuncData* ufc;
973
 
        gchar* _tmp1_;
974
 
        SQLHeavyUserFunctionUserFuncData* _tmp2_;
 
1268
        GHashTable* _tmp5_;
 
1269
        const gchar* _tmp6_;
 
1270
        gchar* _tmp7_;
 
1271
        SQLHeavyUserFunctionUserFuncData* _tmp8_;
 
1272
        sqlite3* _tmp9_;
 
1273
        const gchar* _tmp10_;
 
1274
        gint _tmp11_;
975
1275
        g_return_if_fail (self != NULL);
976
1276
        g_return_if_fail (name != NULL);
977
 
        sql_heavy_database_unregister_function (self, name);
978
 
        _tmp0_ = sql_heavy_user_function_user_func_data_new_scalar (self, name, argc, func, func_target);
979
 
        ufc = _tmp0_;
980
 
        _tmp1_ = g_strdup (name);
981
 
        _tmp2_ = _g_object_ref0 (ufc);
982
 
        g_hash_table_insert (self->priv->user_functions, _tmp1_, _tmp2_);
983
 
        sqlite3_create_function (self->priv->db, name, argc, SQLITE_UTF8, ufc, _sql_heavy_user_function_on_user_function_called_sqlite_user_func_callback, NULL, NULL);
 
1277
        _tmp0_ = name;
 
1278
        sql_heavy_database_unregister_function (self, _tmp0_);
 
1279
        _tmp1_ = name;
 
1280
        _tmp2_ = argc;
 
1281
        _tmp3_ = func;
 
1282
        _tmp3__target = func_target;
 
1283
        _tmp4_ = sql_heavy_user_function_user_func_data_new_scalar (self, _tmp1_, _tmp2_, _tmp3_, _tmp3__target);
 
1284
        ufc = _tmp4_;
 
1285
        _tmp5_ = self->priv->user_functions;
 
1286
        _tmp6_ = name;
 
1287
        _tmp7_ = g_strdup (_tmp6_);
 
1288
        _tmp8_ = _g_object_ref0 (ufc);
 
1289
        g_hash_table_insert (_tmp5_, _tmp7_, _tmp8_);
 
1290
        _tmp9_ = self->priv->db;
 
1291
        _tmp10_ = name;
 
1292
        _tmp11_ = argc;
 
1293
        sqlite3_create_function (_tmp9_, _tmp10_, _tmp11_, SQLITE_UTF8, ufc, _sql_heavy_user_function_on_user_function_called_sqlite_user_func_callback, NULL, NULL);
984
1294
        _g_object_unref0 (ufc);
985
1295
        (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
986
1296
        func = NULL;
995
1305
     * @see user_functions
996
1306
     */
997
1307
static void sql_heavy_database_unregister_function_context (SQLHeavyDatabase* self, SQLHeavyUserFunctionUserFuncData* ufc) {
 
1308
        sqlite3* _tmp0_;
 
1309
        SQLHeavyUserFunctionUserFuncData* _tmp1_;
 
1310
        const gchar* _tmp2_;
 
1311
        SQLHeavyUserFunctionUserFuncData* _tmp3_;
 
1312
        gint _tmp4_;
 
1313
        SQLHeavyUserFunctionUserFuncData* _tmp5_;
998
1314
        g_return_if_fail (self != NULL);
999
1315
        g_return_if_fail (ufc != NULL);
1000
 
        sqlite3_create_function (self->priv->db, ufc->name, ufc->argc, SQLITE_UTF8, ufc, NULL, NULL, NULL);
 
1316
        _tmp0_ = self->priv->db;
 
1317
        _tmp1_ = ufc;
 
1318
        _tmp2_ = _tmp1_->name;
 
1319
        _tmp3_ = ufc;
 
1320
        _tmp4_ = _tmp3_->argc;
 
1321
        _tmp5_ = ufc;
 
1322
        sqlite3_create_function (_tmp0_, _tmp2_, _tmp4_, SQLITE_UTF8, _tmp5_, NULL, NULL, NULL);
1001
1323
}
1002
1324
 
1003
1325
 
1009
1331
     * @param name name of the function
1010
1332
     */
1011
1333
void sql_heavy_database_unregister_function (SQLHeavyDatabase* self, const gchar* name) {
1012
 
        gconstpointer _tmp0_ = NULL;
1013
 
        SQLHeavyUserFunctionUserFuncData* _tmp1_;
 
1334
        GHashTable* _tmp0_;
 
1335
        const gchar* _tmp1_;
 
1336
        gconstpointer _tmp2_ = NULL;
 
1337
        SQLHeavyUserFunctionUserFuncData* _tmp3_;
1014
1338
        SQLHeavyUserFunctionUserFuncData* ufc;
 
1339
        SQLHeavyUserFunctionUserFuncData* _tmp4_;
1015
1340
        g_return_if_fail (self != NULL);
1016
1341
        g_return_if_fail (name != NULL);
1017
 
        _tmp0_ = g_hash_table_lookup (self->priv->user_functions, name);
1018
 
        _tmp1_ = _g_object_ref0 ((SQLHeavyUserFunctionUserFuncData*) _tmp0_);
1019
 
        ufc = _tmp1_;
1020
 
        if (ufc != NULL) {
1021
 
                sql_heavy_database_unregister_function_context (self, SQL_HEAVY_USER_FUNCTION_USER_FUNC_DATA (ufc));
 
1342
        _tmp0_ = self->priv->user_functions;
 
1343
        _tmp1_ = name;
 
1344
        _tmp2_ = g_hash_table_lookup (_tmp0_, _tmp1_);
 
1345
        _tmp3_ = _g_object_ref0 ((SQLHeavyUserFunctionUserFuncData*) _tmp2_);
 
1346
        ufc = _tmp3_;
 
1347
        _tmp4_ = ufc;
 
1348
        if (_tmp4_ != NULL) {
 
1349
                SQLHeavyUserFunctionUserFuncData* _tmp5_;
 
1350
                _tmp5_ = ufc;
 
1351
                sql_heavy_database_unregister_function_context (self, SQL_HEAVY_USER_FUNCTION_USER_FUNC_DATA (_tmp5_));
1022
1352
        }
1023
1353
        _g_object_unref0 (ufc);
1024
1354
}
1105
1435
     * @see backup_async
1106
1436
     */
1107
1437
void sql_heavy_database_backup (SQLHeavyDatabase* self, const gchar* destination, GError** error) {
1108
 
        SQLHeavyDatabase* _tmp0_ = NULL;
 
1438
        const gchar* _tmp0_;
1109
1439
        SQLHeavyDatabase* _tmp1_;
1110
1440
        SQLHeavyDatabase* _tmp2_;
1111
 
        SQLHeavyBackup* _tmp3_ = NULL;
 
1441
        SQLHeavyDatabase* _tmp3_;
1112
1442
        SQLHeavyBackup* _tmp4_;
1113
1443
        SQLHeavyBackup* _tmp5_;
1114
1444
        SQLHeavyBackup* _tmp6_;
 
1445
        SQLHeavyBackup* _tmp7_;
1115
1446
        GError * _inner_error_ = NULL;
1116
1447
        g_return_if_fail (self != NULL);
1117
1448
        g_return_if_fail (destination != NULL);
1118
 
        _tmp0_ = sql_heavy_database_new (destination, (SQL_HEAVY_FILE_MODE_READ | SQL_HEAVY_FILE_MODE_WRITE) | SQL_HEAVY_FILE_MODE_CREATE, &_inner_error_);
1119
 
        _tmp1_ = _tmp0_;
1120
 
        if (_inner_error_ != NULL) {
1121
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1122
 
                        g_propagate_error (error, _inner_error_);
1123
 
                        return;
1124
 
                } else {
1125
 
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1126
 
                        g_clear_error (&_inner_error_);
1127
 
                        return;
1128
 
                }
1129
 
        }
 
1449
        _tmp0_ = destination;
 
1450
        _tmp1_ = sql_heavy_database_new (_tmp0_, (SQL_HEAVY_FILE_MODE_READ | SQL_HEAVY_FILE_MODE_WRITE) | SQL_HEAVY_FILE_MODE_CREATE, &_inner_error_);
1130
1451
        _tmp2_ = _tmp1_;
1131
 
        _tmp3_ = sql_heavy_backup_new (self, _tmp2_, &_inner_error_);
1132
 
        _tmp4_ = _tmp3_;
1133
 
        _g_object_unref0 (_tmp2_);
 
1452
        if (_inner_error_ != NULL) {
 
1453
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
1454
                        g_propagate_error (error, _inner_error_);
 
1455
                        return;
 
1456
                } else {
 
1457
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
1458
                        g_clear_error (&_inner_error_);
 
1459
                        return;
 
1460
                }
 
1461
        }
 
1462
        _tmp3_ = _tmp2_;
 
1463
        _tmp4_ = sql_heavy_backup_new (self, _tmp3_, &_inner_error_);
1134
1464
        _tmp5_ = _tmp4_;
1135
 
        if (_inner_error_ != NULL) {
1136
 
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1137
 
                        g_propagate_error (error, _inner_error_);
1138
 
                        return;
1139
 
                } else {
1140
 
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1141
 
                        g_clear_error (&_inner_error_);
1142
 
                        return;
1143
 
                }
1144
 
        }
 
1465
        _g_object_unref0 (_tmp3_);
1145
1466
        _tmp6_ = _tmp5_;
1146
 
        sql_heavy_backup_execute (_tmp6_, &_inner_error_);
1147
 
        _g_object_unref0 (_tmp6_);
 
1467
        if (_inner_error_ != NULL) {
 
1468
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
1469
                        g_propagate_error (error, _inner_error_);
 
1470
                        return;
 
1471
                } else {
 
1472
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
1473
                        g_clear_error (&_inner_error_);
 
1474
                        return;
 
1475
                }
 
1476
        }
 
1477
        _tmp7_ = _tmp6_;
 
1478
        sql_heavy_backup_execute (_tmp7_, &_inner_error_);
 
1479
        _g_object_unref0 (_tmp7_);
1148
1480
        if (_inner_error_ != NULL) {
1149
1481
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1150
1482
                        g_propagate_error (error, _inner_error_);
1159
1491
 
1160
1492
 
1161
1493
static void sql_heavy_database_backup_async_data_free (gpointer _data) {
1162
 
        SqlHeavyDatabaseBackupAsyncData* data;
1163
 
        data = _data;
1164
 
        _g_free0 (data->destination);
1165
 
        _g_object_unref0 (data->self);
1166
 
        g_slice_free (SqlHeavyDatabaseBackupAsyncData, data);
 
1494
        SqlHeavyDatabaseBackupAsyncData* _data_;
 
1495
        _data_ = _data;
 
1496
        _g_free0 (_data_->destination);
 
1497
        _g_object_unref0 (_data_->self);
 
1498
        g_slice_free (SqlHeavyDatabaseBackupAsyncData, _data_);
1167
1499
}
1168
1500
 
1169
1501
 
1170
1502
void sql_heavy_database_backup_async (SQLHeavyDatabase* self, const gchar* destination, GAsyncReadyCallback _callback_, gpointer _user_data_) {
1171
1503
        SqlHeavyDatabaseBackupAsyncData* _data_;
 
1504
        SQLHeavyDatabase* _tmp0_;
 
1505
        const gchar* _tmp1_;
 
1506
        gchar* _tmp2_;
1172
1507
        _data_ = g_slice_new0 (SqlHeavyDatabaseBackupAsyncData);
1173
1508
        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, sql_heavy_database_backup_async);
1174
1509
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, sql_heavy_database_backup_async_data_free);
1175
 
        _data_->self = _g_object_ref0 (self);
1176
 
        _data_->destination = g_strdup (destination);
 
1510
        _tmp0_ = _g_object_ref0 (self);
 
1511
        _data_->self = _tmp0_;
 
1512
        _tmp1_ = destination;
 
1513
        _tmp2_ = g_strdup (_tmp1_);
 
1514
        _data_->destination = _tmp2_;
1177
1515
        sql_heavy_database_backup_async_co (_data_);
1178
1516
}
1179
1517
 
1195
1533
     * @see backup
1196
1534
     */
1197
1535
static void sql_heavy_database_backup_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
1198
 
        SqlHeavyDatabaseBackupAsyncData* data;
1199
 
        data = _user_data_;
1200
 
        data->_source_object_ = source_object;
1201
 
        data->_res_ = _res_;
1202
 
        sql_heavy_database_backup_async_co (data);
 
1536
        SqlHeavyDatabaseBackupAsyncData* _data_;
 
1537
        _data_ = _user_data_;
 
1538
        _data_->_source_object_ = source_object;
 
1539
        _data_->_res_ = _res_;
 
1540
        sql_heavy_database_backup_async_co (_data_);
1203
1541
}
1204
1542
 
1205
1543
 
1206
 
static gboolean sql_heavy_database_backup_async_co (SqlHeavyDatabaseBackupAsyncData* data) {
1207
 
        switch (data->_state_) {
 
1544
static gboolean sql_heavy_database_backup_async_co (SqlHeavyDatabaseBackupAsyncData* _data_) {
 
1545
        switch (_data_->_state_) {
1208
1546
                case 0:
1209
1547
                goto _state_0;
1210
1548
                case 1:
1213
1551
                g_assert_not_reached ();
1214
1552
        }
1215
1553
        _state_0:
1216
 
        data->_tmp0_ = NULL;
1217
 
        data->_tmp0_ = sql_heavy_database_new (data->destination, (SQL_HEAVY_FILE_MODE_READ | SQL_HEAVY_FILE_MODE_WRITE) | SQL_HEAVY_FILE_MODE_CREATE, &data->_inner_error_);
1218
 
        data->_tmp1_ = data->_tmp0_;
1219
 
        if (data->_inner_error_ != NULL) {
1220
 
                if (data->_inner_error_->domain == SQL_HEAVY_ERROR) {
1221
 
                        g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
1222
 
                        g_error_free (data->_inner_error_);
1223
 
                        if (data->_state_ == 0) {
1224
 
                                g_simple_async_result_complete_in_idle (data->_async_result);
1225
 
                        } else {
1226
 
                                g_simple_async_result_complete (data->_async_result);
1227
 
                        }
1228
 
                        g_object_unref (data->_async_result);
1229
 
                        return FALSE;
1230
 
                } else {
1231
 
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
1232
 
                        g_clear_error (&data->_inner_error_);
1233
 
                        return FALSE;
1234
 
                }
1235
 
        }
1236
 
        data->_tmp2_ = data->_tmp1_;
1237
 
        data->_tmp3_ = NULL;
1238
 
        data->_tmp3_ = sql_heavy_backup_new (data->self, data->_tmp2_, &data->_inner_error_);
1239
 
        data->_tmp4_ = data->_tmp3_;
1240
 
        _g_object_unref0 (data->_tmp2_);
1241
 
        data->backup = data->_tmp4_;
1242
 
        if (data->_inner_error_ != NULL) {
1243
 
                if (data->_inner_error_->domain == SQL_HEAVY_ERROR) {
1244
 
                        g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
1245
 
                        g_error_free (data->_inner_error_);
1246
 
                        if (data->_state_ == 0) {
1247
 
                                g_simple_async_result_complete_in_idle (data->_async_result);
1248
 
                        } else {
1249
 
                                g_simple_async_result_complete (data->_async_result);
1250
 
                        }
1251
 
                        g_object_unref (data->_async_result);
1252
 
                        return FALSE;
1253
 
                } else {
1254
 
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
1255
 
                        g_clear_error (&data->_inner_error_);
1256
 
                        return FALSE;
1257
 
                }
1258
 
        }
1259
 
        data->_state_ = 1;
1260
 
        sql_heavy_backup_execute_async (data->backup, NULL, sql_heavy_database_backup_async_ready, data);
 
1554
        _data_->_tmp0_ = _data_->destination;
 
1555
        _data_->_tmp1_ = sql_heavy_database_new (_data_->_tmp0_, (SQL_HEAVY_FILE_MODE_READ | SQL_HEAVY_FILE_MODE_WRITE) | SQL_HEAVY_FILE_MODE_CREATE, &_data_->_inner_error_);
 
1556
        _data_->_tmp2_ = _data_->_tmp1_;
 
1557
        if (_data_->_inner_error_ != NULL) {
 
1558
                if (_data_->_inner_error_->domain == SQL_HEAVY_ERROR) {
 
1559
                        g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
 
1560
                        g_error_free (_data_->_inner_error_);
 
1561
                        if (_data_->_state_ == 0) {
 
1562
                                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1563
                        } else {
 
1564
                                g_simple_async_result_complete (_data_->_async_result);
 
1565
                        }
 
1566
                        g_object_unref (_data_->_async_result);
 
1567
                        return FALSE;
 
1568
                } else {
 
1569
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1570
                        g_clear_error (&_data_->_inner_error_);
 
1571
                        return FALSE;
 
1572
                }
 
1573
        }
 
1574
        _data_->_tmp3_ = _data_->_tmp2_;
 
1575
        _data_->_tmp4_ = sql_heavy_backup_new (_data_->self, _data_->_tmp3_, &_data_->_inner_error_);
 
1576
        _data_->_tmp5_ = _data_->_tmp4_;
 
1577
        _g_object_unref0 (_data_->_tmp3_);
 
1578
        _data_->backup = _data_->_tmp5_;
 
1579
        if (_data_->_inner_error_ != NULL) {
 
1580
                if (_data_->_inner_error_->domain == SQL_HEAVY_ERROR) {
 
1581
                        g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
 
1582
                        g_error_free (_data_->_inner_error_);
 
1583
                        if (_data_->_state_ == 0) {
 
1584
                                g_simple_async_result_complete_in_idle (_data_->_async_result);
 
1585
                        } else {
 
1586
                                g_simple_async_result_complete (_data_->_async_result);
 
1587
                        }
 
1588
                        g_object_unref (_data_->_async_result);
 
1589
                        return FALSE;
 
1590
                } else {
 
1591
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1592
                        g_clear_error (&_data_->_inner_error_);
 
1593
                        return FALSE;
 
1594
                }
 
1595
        }
 
1596
        _data_->_tmp6_ = _data_->backup;
 
1597
        _data_->_state_ = 1;
 
1598
        sql_heavy_backup_execute_async (_data_->_tmp6_, NULL, sql_heavy_database_backup_async_ready, _data_);
1261
1599
        return FALSE;
1262
1600
        _state_1:
1263
 
        sql_heavy_backup_execute_finish (data->backup, data->_res_, &data->_inner_error_);
1264
 
        if (data->_inner_error_ != NULL) {
1265
 
                if (data->_inner_error_->domain == SQL_HEAVY_ERROR) {
1266
 
                        g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
1267
 
                        g_error_free (data->_inner_error_);
1268
 
                        _g_object_unref0 (data->backup);
1269
 
                        if (data->_state_ == 0) {
1270
 
                                g_simple_async_result_complete_in_idle (data->_async_result);
 
1601
        sql_heavy_backup_execute_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error_);
 
1602
        if (_data_->_inner_error_ != NULL) {
 
1603
                if (_data_->_inner_error_->domain == SQL_HEAVY_ERROR) {
 
1604
                        g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
 
1605
                        g_error_free (_data_->_inner_error_);
 
1606
                        _g_object_unref0 (_data_->backup);
 
1607
                        if (_data_->_state_ == 0) {
 
1608
                                g_simple_async_result_complete_in_idle (_data_->_async_result);
1271
1609
                        } else {
1272
 
                                g_simple_async_result_complete (data->_async_result);
 
1610
                                g_simple_async_result_complete (_data_->_async_result);
1273
1611
                        }
1274
 
                        g_object_unref (data->_async_result);
 
1612
                        g_object_unref (_data_->_async_result);
1275
1613
                        return FALSE;
1276
1614
                } else {
1277
 
                        _g_object_unref0 (data->backup);
1278
 
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
1279
 
                        g_clear_error (&data->_inner_error_);
 
1615
                        _g_object_unref0 (_data_->backup);
 
1616
                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
 
1617
                        g_clear_error (&_data_->_inner_error_);
1280
1618
                        return FALSE;
1281
1619
                }
1282
1620
        }
1283
 
        _g_object_unref0 (data->backup);
1284
 
        if (data->_state_ == 0) {
1285
 
                g_simple_async_result_complete_in_idle (data->_async_result);
 
1621
        _g_object_unref0 (_data_->backup);
 
1622
        if (_data_->_state_ == 0) {
 
1623
                g_simple_async_result_complete_in_idle (_data_->_async_result);
1286
1624
        } else {
1287
 
                g_simple_async_result_complete (data->_async_result);
 
1625
                g_simple_async_result_complete (_data_->_async_result);
1288
1626
        }
1289
 
        g_object_unref (data->_async_result);
 
1627
        g_object_unref (_data_->_async_result);
1290
1628
        return FALSE;
1291
1629
}
1292
1630
 
1300
1638
     * @see journal_mode
1301
1639
     */
1302
1640
void sql_heavy_database_wal_checkpoint (SQLHeavyDatabase* self, const gchar* database, GError** error) {
1303
 
        gint _tmp0_;
 
1641
        gint _tmp0_ = 0;
1304
1642
        GModule* _tmp3_ = NULL;
1305
1643
        GModule* mod;
1306
1644
        void* sqlite3_wal_checkpoint = NULL;
1307
1645
        void* _tmp4_ = NULL;
1308
 
        gboolean _tmp5_;
1309
 
        gint _tmp6_;
 
1646
        gboolean _tmp5_ = FALSE;
 
1647
        sqlite3* _tmp6_;
 
1648
        const gchar* _tmp7_;
 
1649
        gint _tmp8_ = 0;
1310
1650
        GError * _inner_error_ = NULL;
1311
1651
        g_return_if_fail (self != NULL);
1312
1652
        _tmp0_ = sqlite3_libversion_number ();
1313
1653
        if (_tmp0_ < 3007000) {
1314
1654
                const gchar* _tmp1_ = NULL;
1315
 
                GError* _tmp2_ = NULL;
 
1655
                GError* _tmp2_;
1316
1656
                _tmp1_ = sqlite3_libversion ();
1317
1657
                _tmp2_ = g_error_new (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_FEATURE_NOT_SUPPORTED, "Write-ahead logging features are only available in SQLite >= 3.7.0, yo" \
1318
1658
"u are using %s", _tmp1_);
1331
1671
        _tmp5_ = g_module_symbol (mod, "sqlite3_wal_checkpoint", &_tmp4_);
1332
1672
        sqlite3_wal_checkpoint = _tmp4_;
1333
1673
        g_assert (_tmp5_);
1334
 
        _tmp6_ = ((SQLHeavyWALCheckpointFunc) sqlite3_wal_checkpoint) (self->priv->db, database);
1335
 
        sql_heavy_error_if_not_ok (_tmp6_, (SQLHeavyQueryable*) self, &_inner_error_);
 
1674
        _tmp6_ = self->priv->db;
 
1675
        _tmp7_ = database;
 
1676
        _tmp8_ = ((SQLHeavyWALCheckpointFunc) sqlite3_wal_checkpoint) (_tmp6_, _tmp7_);
 
1677
        sql_heavy_error_if_not_ok (_tmp8_, (SQLHeavyQueryable*) self, &_inner_error_);
1336
1678
        if (_inner_error_ != NULL) {
1337
1679
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1338
1680
                        g_propagate_error (error, _inner_error_);
1357
1699
     */
1358
1700
SQLHeavyTable* sql_heavy_database_get_table (SQLHeavyDatabase* self, const gchar* table, GError** error) {
1359
1701
        SQLHeavyTable* result = NULL;
1360
 
        SQLHeavyTable* _tmp13_ = NULL;
1361
 
        SQLHeavyTable* _tmp14_;
 
1702
        const gchar* _tmp36_;
 
1703
        SQLHeavyTable* _tmp37_;
 
1704
        SQLHeavyTable* _tmp38_;
1362
1705
        GError * _inner_error_ = NULL;
1363
1706
        g_return_val_if_fail (self != NULL, NULL);
1364
1707
        g_return_val_if_fail (table != NULL, NULL);
1365
1708
        {
1366
 
                gconstpointer _tmp1_ = NULL;
1367
 
                GSequence* list;
 
1709
                GHashTable* _tmp0_;
 
1710
                _tmp0_ = self->priv->orm_tables;
1368
1711
                g_static_rec_mutex_lock (&self->priv->__lock_orm_tables);
1369
 
                if (self->priv->orm_tables == NULL) {
1370
 
                        GHashTable* _tmp0_ = NULL;
1371
 
                        _tmp0_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_sequence_free);
1372
 
                        _g_hash_table_unref0 (self->priv->orm_tables);
1373
 
                        self->priv->orm_tables = _tmp0_;
1374
 
                }
1375
 
                _tmp1_ = g_hash_table_lookup (self->priv->orm_tables, table);
1376
 
                list = (GSequence*) _tmp1_;
1377
 
                if (list == NULL) {
1378
 
                        gchar* _tmp2_;
1379
 
                        GSequence* _tmp3_ = NULL;
1380
 
                        gconstpointer _tmp4_ = NULL;
1381
 
                        SQLHeavyTable* _tmp5_ = NULL;
1382
 
                        SQLHeavyTable* res;
1383
 
                        GSequenceIter* _tmp6_ = NULL;
1384
 
                        _tmp2_ = g_strdup (table);
1385
 
                        _tmp3_ = g_sequence_new (NULL);
1386
 
                        g_hash_table_insert (self->priv->orm_tables, _tmp2_, _tmp3_);
1387
 
                        _tmp4_ = g_hash_table_lookup (self->priv->orm_tables, table);
1388
 
                        list = (GSequence*) _tmp4_;
1389
 
                        _tmp5_ = sql_heavy_table_new ((SQLHeavyQueryable*) self, table, &_inner_error_);
1390
 
                        res = _tmp5_;
1391
 
                        if (_inner_error_ != NULL) {
1392
 
                                goto __finally13;
 
1712
                {
 
1713
                        GHashTable* _tmp1_;
 
1714
                        GHashTable* _tmp6_;
 
1715
                        const gchar* _tmp7_;
 
1716
                        gconstpointer _tmp8_ = NULL;
 
1717
                        GSequence* list;
 
1718
                        GSequence* _tmp9_;
 
1719
                        _tmp1_ = self->priv->orm_tables;
 
1720
                        if (_tmp1_ == NULL) {
 
1721
                                GHashFunc _tmp2_;
 
1722
                                GEqualFunc _tmp3_;
 
1723
                                GDestroyNotify _tmp4_;
 
1724
                                GHashTable* _tmp5_;
 
1725
                                _tmp2_ = g_str_hash;
 
1726
                                _tmp3_ = g_str_equal;
 
1727
                                _tmp4_ = g_free;
 
1728
                                _tmp5_ = g_hash_table_new_full (_tmp2_, _tmp3_, _tmp4_, (GDestroyNotify) g_sequence_free);
 
1729
                                _g_hash_table_unref0 (self->priv->orm_tables);
 
1730
                                self->priv->orm_tables = _tmp5_;
1393
1731
                        }
1394
 
                        _tmp6_ = g_sequence_insert_sorted (list, res, _sql_heavy_table_direct_compare_gcompare_data_func, NULL);
1395
 
                        result = res;
1396
 
                        g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
1397
 
                        return result;
1398
 
                } else {
1399
 
                        {
1400
 
                                GSequenceIter* _tmp7_ = NULL;
1401
 
                                GSequenceIter* iter;
1402
 
                                _tmp7_ = g_sequence_get_begin_iter (list);
1403
 
                                iter = _tmp7_;
1404
 
                                {
1405
 
                                        gboolean _tmp8_;
1406
 
                                        _tmp8_ = TRUE;
1407
 
                                        while (TRUE) {
1408
 
                                                gboolean _tmp10_;
1409
 
                                                gconstpointer _tmp11_ = NULL;
1410
 
                                                SQLHeavyTable* _tmp12_;
1411
 
                                                if (!_tmp8_) {
1412
 
                                                        GSequenceIter* _tmp9_ = NULL;
1413
 
                                                        _tmp9_ = g_sequence_iter_next (iter);
1414
 
                                                        iter = _tmp9_;
1415
 
                                                }
1416
 
                                                _tmp8_ = FALSE;
1417
 
                                                _tmp10_ = g_sequence_iter_is_end (iter);
1418
 
                                                if (!(!_tmp10_)) {
1419
 
                                                        break;
1420
 
                                                }
1421
 
                                                _tmp11_ = g_sequence_get (iter);
1422
 
                                                _tmp12_ = _g_object_ref0 ((SQLHeavyTable*) _tmp11_);
1423
 
                                                result = _tmp12_;
1424
 
                                                g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
1425
 
                                                return result;
 
1732
                        _tmp6_ = self->priv->orm_tables;
 
1733
                        _tmp7_ = table;
 
1734
                        _tmp8_ = g_hash_table_lookup (_tmp6_, _tmp7_);
 
1735
                        list = (GSequence*) _tmp8_;
 
1736
                        _tmp9_ = list;
 
1737
                        if (_tmp9_ == NULL) {
 
1738
                                GHashTable* _tmp10_;
 
1739
                                const gchar* _tmp11_;
 
1740
                                gchar* _tmp12_;
 
1741
                                GSequence* _tmp13_;
 
1742
                                GHashTable* _tmp14_;
 
1743
                                const gchar* _tmp15_;
 
1744
                                gconstpointer _tmp16_ = NULL;
 
1745
                                const gchar* _tmp17_;
 
1746
                                SQLHeavyTable* _tmp18_;
 
1747
                                SQLHeavyTable* res;
 
1748
                                GSequence* _tmp19_;
 
1749
                                SQLHeavyTable* _tmp20_;
 
1750
                                GSequenceIter* _tmp21_ = NULL;
 
1751
                                _tmp10_ = self->priv->orm_tables;
 
1752
                                _tmp11_ = table;
 
1753
                                _tmp12_ = g_strdup (_tmp11_);
 
1754
                                _tmp13_ = g_sequence_new (NULL);
 
1755
                                g_hash_table_insert (_tmp10_, _tmp12_, _tmp13_);
 
1756
                                _tmp14_ = self->priv->orm_tables;
 
1757
                                _tmp15_ = table;
 
1758
                                _tmp16_ = g_hash_table_lookup (_tmp14_, _tmp15_);
 
1759
                                list = (GSequence*) _tmp16_;
 
1760
                                _tmp17_ = table;
 
1761
                                _tmp18_ = sql_heavy_table_new ((SQLHeavyQueryable*) self, _tmp17_, &_inner_error_);
 
1762
                                res = _tmp18_;
 
1763
                                if (_inner_error_ != NULL) {
 
1764
                                        goto __finally13;
 
1765
                                }
 
1766
                                _tmp19_ = list;
 
1767
                                _tmp20_ = res;
 
1768
                                _tmp21_ = g_sequence_insert_sorted (_tmp19_, _tmp20_, _sql_heavy_table_direct_compare_gcompare_data_func, NULL);
 
1769
                                result = res;
 
1770
                                {
 
1771
                                        GHashTable* _tmp22_;
 
1772
                                        _tmp22_ = self->priv->orm_tables;
 
1773
                                        g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
1774
                                }
 
1775
                                return result;
 
1776
                        } else {
 
1777
                                {
 
1778
                                        GSequence* _tmp23_;
 
1779
                                        GSequenceIter* _tmp24_ = NULL;
 
1780
                                        GSequenceIter* iter;
 
1781
                                        _tmp23_ = list;
 
1782
                                        _tmp24_ = g_sequence_get_begin_iter (_tmp23_);
 
1783
                                        iter = _tmp24_;
 
1784
                                        {
 
1785
                                                gboolean _tmp25_;
 
1786
                                                _tmp25_ = TRUE;
 
1787
                                                while (TRUE) {
 
1788
                                                        gboolean _tmp26_;
 
1789
                                                        GSequenceIter* _tmp29_;
 
1790
                                                        gboolean _tmp30_ = FALSE;
 
1791
                                                        GSequenceIter* _tmp31_;
 
1792
                                                        gconstpointer _tmp32_ = NULL;
 
1793
                                                        SQLHeavyTable* _tmp33_;
 
1794
                                                        _tmp26_ = _tmp25_;
 
1795
                                                        if (!_tmp26_) {
 
1796
                                                                GSequenceIter* _tmp27_;
 
1797
                                                                GSequenceIter* _tmp28_ = NULL;
 
1798
                                                                _tmp27_ = iter;
 
1799
                                                                _tmp28_ = g_sequence_iter_next (_tmp27_);
 
1800
                                                                iter = _tmp28_;
 
1801
                                                        }
 
1802
                                                        _tmp25_ = FALSE;
 
1803
                                                        _tmp29_ = iter;
 
1804
                                                        _tmp30_ = g_sequence_iter_is_end (_tmp29_);
 
1805
                                                        if (!(!_tmp30_)) {
 
1806
                                                                break;
 
1807
                                                        }
 
1808
                                                        _tmp31_ = iter;
 
1809
                                                        _tmp32_ = g_sequence_get (_tmp31_);
 
1810
                                                        _tmp33_ = _g_object_ref0 ((SQLHeavyTable*) _tmp32_);
 
1811
                                                        result = _tmp33_;
 
1812
                                                        {
 
1813
                                                                GHashTable* _tmp34_;
 
1814
                                                                _tmp34_ = self->priv->orm_tables;
 
1815
                                                                g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
1816
                                                        }
 
1817
                                                        return result;
 
1818
                                                }
1426
1819
                                        }
1427
1820
                                }
1428
1821
                        }
1429
1822
                }
1430
1823
                __finally13:
1431
 
                g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
1824
                {
 
1825
                        GHashTable* _tmp35_;
 
1826
                        _tmp35_ = self->priv->orm_tables;
 
1827
                        g_static_rec_mutex_unlock (&self->priv->__lock_orm_tables);
 
1828
                }
1432
1829
                if (_inner_error_ != NULL) {
1433
1830
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1434
1831
                                g_propagate_error (error, _inner_error_);
1440
1837
                        }
1441
1838
                }
1442
1839
        }
1443
 
        _tmp13_ = sql_heavy_table_new ((SQLHeavyQueryable*) self, table, &_inner_error_);
1444
 
        _tmp14_ = _tmp13_;
 
1840
        _tmp36_ = table;
 
1841
        _tmp37_ = sql_heavy_table_new ((SQLHeavyQueryable*) self, _tmp36_, &_inner_error_);
 
1842
        _tmp38_ = _tmp37_;
1445
1843
        if (_inner_error_ != NULL) {
1446
1844
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1447
1845
                        g_propagate_error (error, _inner_error_);
1452
1850
                        return NULL;
1453
1851
                }
1454
1852
        }
1455
 
        result = _tmp14_;
 
1853
        result = _tmp38_;
1456
1854
        return result;
1457
1855
}
1458
1856
 
1464
1862
     */
1465
1863
GHashTable* sql_heavy_database_get_tables (SQLHeavyDatabase* self, GError** error) {
1466
1864
        GHashTable* result = NULL;
1467
 
        GHashTable* _tmp0_ = NULL;
 
1865
        GHashFunc _tmp0_;
 
1866
        GEqualFunc _tmp1_;
 
1867
        GDestroyNotify _tmp2_;
 
1868
        GDestroyNotify _tmp3_;
 
1869
        GHashTable* _tmp4_;
1468
1870
        GHashTable* ht;
1469
 
        SQLHeavyQuery* _tmp1_ = NULL;
1470
 
        SQLHeavyQuery* _tmp2_;
1471
 
        SQLHeavyQuery* _tmp3_;
1472
 
        SQLHeavyQueryResult* _tmp4_ = NULL;
1473
 
        SQLHeavyQueryResult* _tmp5_;
 
1871
        SQLHeavyQuery* _tmp5_ = NULL;
 
1872
        SQLHeavyQuery* _tmp6_;
 
1873
        SQLHeavyQuery* _tmp7_;
 
1874
        SQLHeavyQueryResult* _tmp8_ = NULL;
 
1875
        SQLHeavyQueryResult* _tmp9_;
1474
1876
        SQLHeavyQueryResult* _result_;
1475
1877
        GError * _inner_error_ = NULL;
1476
1878
        g_return_val_if_fail (self != NULL, NULL);
1477
 
        _tmp0_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1478
 
        ht = _tmp0_;
1479
 
        _tmp1_ = sql_heavy_queryable_prepare ((SQLHeavyQueryable*) self, "SELECT `name` FROM `SQLITE_MASTER` WHERE `type` = 'table';", &_inner_error_);
1480
 
        _tmp2_ = _tmp1_;
 
1879
        _tmp0_ = g_str_hash;
 
1880
        _tmp1_ = g_str_equal;
 
1881
        _tmp2_ = g_free;
 
1882
        _tmp3_ = g_object_unref;
 
1883
        _tmp4_ = g_hash_table_new_full (_tmp0_, _tmp1_, _tmp2_, _tmp3_);
 
1884
        ht = _tmp4_;
 
1885
        _tmp5_ = sql_heavy_queryable_prepare ((SQLHeavyQueryable*) self, "SELECT `name` FROM `SQLITE_MASTER` WHERE `type` = 'table';", &_inner_error_);
 
1886
        _tmp6_ = _tmp5_;
1481
1887
        if (_inner_error_ != NULL) {
1482
1888
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1483
1889
                        g_propagate_error (error, _inner_error_);
1490
1896
                        return NULL;
1491
1897
                }
1492
1898
        }
1493
 
        _tmp3_ = _tmp2_;
1494
 
        _tmp4_ = sql_heavy_query_execute (_tmp3_, NULL, &_inner_error_, NULL);
1495
 
        _tmp5_ = _tmp4_;
1496
 
        _g_object_unref0 (_tmp3_);
1497
 
        _result_ = _tmp5_;
 
1899
        _tmp7_ = _tmp6_;
 
1900
        _tmp8_ = sql_heavy_query_execute (_tmp7_, NULL, &_inner_error_, NULL);
 
1901
        _tmp9_ = _tmp8_;
 
1902
        _g_object_unref0 (_tmp7_);
 
1903
        _result_ = _tmp9_;
1498
1904
        if (_inner_error_ != NULL) {
1499
1905
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1500
1906
                        g_propagate_error (error, _inner_error_);
1508
1914
                }
1509
1915
        }
1510
1916
        while (TRUE) {
1511
 
                gboolean _tmp6_;
1512
 
                gchar* _tmp7_ = NULL;
 
1917
                SQLHeavyQueryResult* _tmp10_;
 
1918
                gboolean _tmp11_;
 
1919
                gboolean _tmp12_;
 
1920
                SQLHeavyQueryResult* _tmp13_;
 
1921
                gchar* _tmp14_ = NULL;
1513
1922
                gchar* table_name;
1514
 
                gboolean _tmp8_;
1515
 
                _tmp6_ = sql_heavy_query_result_get_finished (_result_);
1516
 
                if (!(!_tmp6_)) {
 
1923
                const gchar* _tmp15_;
 
1924
                gboolean _tmp16_ = FALSE;
 
1925
                SQLHeavyQueryResult* _tmp23_;
 
1926
                _tmp10_ = _result_;
 
1927
                _tmp11_ = sql_heavy_query_result_get_finished (_tmp10_);
 
1928
                _tmp12_ = _tmp11_;
 
1929
                if (!(!_tmp12_)) {
1517
1930
                        break;
1518
1931
                }
1519
 
                _tmp7_ = sql_heavy_record_fetch_string ((SQLHeavyRecord*) _result_, 0, &_inner_error_);
1520
 
                table_name = _tmp7_;
 
1932
                _tmp13_ = _result_;
 
1933
                _tmp14_ = sql_heavy_record_fetch_string ((SQLHeavyRecord*) _tmp13_, 0, &_inner_error_);
 
1934
                table_name = _tmp14_;
1521
1935
                if (_inner_error_ != NULL) {
1522
1936
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1523
1937
                                g_propagate_error (error, _inner_error_);
1532
1946
                                return NULL;
1533
1947
                        }
1534
1948
                }
1535
 
                _tmp8_ = g_str_has_prefix (table_name, "sqlite_");
1536
 
                if (!_tmp8_) {
1537
 
                        SQLHeavyTable* _tmp9_ = NULL;
1538
 
                        SQLHeavyTable* _tmp10_;
1539
 
                        gchar* _tmp11_;
1540
 
                        _tmp9_ = sql_heavy_database_get_table (self, table_name, &_inner_error_);
1541
 
                        _tmp10_ = _tmp9_;
 
1949
                _tmp15_ = table_name;
 
1950
                _tmp16_ = g_str_has_prefix (_tmp15_, "sqlite_");
 
1951
                if (!_tmp16_) {
 
1952
                        const gchar* _tmp17_;
 
1953
                        SQLHeavyTable* _tmp18_ = NULL;
 
1954
                        SQLHeavyTable* _tmp19_;
 
1955
                        GHashTable* _tmp20_;
 
1956
                        const gchar* _tmp21_;
 
1957
                        gchar* _tmp22_;
 
1958
                        _tmp17_ = table_name;
 
1959
                        _tmp18_ = sql_heavy_database_get_table (self, _tmp17_, &_inner_error_);
 
1960
                        _tmp19_ = _tmp18_;
1542
1961
                        if (_inner_error_ != NULL) {
1543
1962
                                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1544
1963
                                        g_propagate_error (error, _inner_error_);
1555
1974
                                        return NULL;
1556
1975
                                }
1557
1976
                        }
1558
 
                        _tmp11_ = g_strdup (table_name);
1559
 
                        g_hash_table_insert (ht, _tmp11_, _tmp10_);
 
1977
                        _tmp20_ = ht;
 
1978
                        _tmp21_ = table_name;
 
1979
                        _tmp22_ = g_strdup (_tmp21_);
 
1980
                        g_hash_table_insert (_tmp20_, _tmp22_, _tmp19_);
1560
1981
                }
1561
 
                sql_heavy_record_set_next ((SQLHeavyRecordSet*) _result_, &_inner_error_);
 
1982
                _tmp23_ = _result_;
 
1983
                sql_heavy_record_set_next ((SQLHeavyRecordSet*) _tmp23_, &_inner_error_);
1562
1984
                if (_inner_error_ != NULL) {
1563
1985
                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1564
1986
                                g_propagate_error (error, _inner_error_);
1593
2015
gint sql_heavy_database_compare (SQLHeavyDatabase* a, SQLHeavyDatabase* b) {
1594
2016
        gint result = 0;
1595
2017
        gint r;
1596
 
        gint _tmp0_;
1597
 
        gint _tmp1_;
 
2018
        SQLHeavyDatabase* _tmp0_;
 
2019
        SQLHeavyDatabase* _tmp1_;
 
2020
        SQLHeavyDatabase* _tmp2_;
 
2021
        SQLHeavyDatabase* _tmp3_;
 
2022
        GCompareFunc _tmp4_;
 
2023
        SQLHeavyDatabase* _tmp5_;
 
2024
        const gchar* _tmp6_;
 
2025
        SQLHeavyDatabase* _tmp7_;
 
2026
        const gchar* _tmp8_;
 
2027
        gint _tmp9_ = 0;
 
2028
        gint _tmp10_;
 
2029
        SQLHeavyDatabase* _tmp11_;
 
2030
        SQLHeavyFileMode _tmp12_;
 
2031
        SQLHeavyDatabase* _tmp13_;
 
2032
        SQLHeavyFileMode _tmp14_;
 
2033
        gint _tmp15_;
 
2034
        SQLHeavyDatabase* _tmp16_;
 
2035
        SQLHeavyDatabase* _tmp17_;
 
2036
        gint _tmp18_ = 0;
1598
2037
        r = 0;
1599
 
        if (a == b) {
 
2038
        _tmp0_ = a;
 
2039
        _tmp1_ = b;
 
2040
        if (_tmp0_ == _tmp1_) {
1600
2041
                result = 0;
1601
2042
                return result;
1602
2043
        }
1603
 
        if (a == NULL) {
 
2044
        _tmp2_ = a;
 
2045
        if (_tmp2_ == NULL) {
1604
2046
                result = -1;
1605
2047
                return result;
1606
2048
        }
1607
 
        if (b == NULL) {
 
2049
        _tmp3_ = b;
 
2050
        if (_tmp3_ == NULL) {
1608
2051
                result = 1;
1609
2052
                return result;
1610
2053
        }
1611
 
        _tmp0_ = g_strcmp0 (a->priv->_filename, b->priv->_filename);
1612
 
        r = _tmp0_;
1613
 
        if (r != 0) {
1614
 
                result = r;
1615
 
                return result;
1616
 
        }
1617
 
        r = (gint) (a->priv->_mode - b->priv->_mode);
1618
 
        if (r != 0) {
1619
 
                result = r;
1620
 
                return result;
1621
 
        }
1622
 
        _tmp1_ = sql_heavy_database_direct_compare (a, b);
1623
 
        result = _tmp1_;
 
2054
        _tmp4_ = g_strcmp0;
 
2055
        _tmp5_ = a;
 
2056
        _tmp6_ = _tmp5_->priv->_filename;
 
2057
        _tmp7_ = b;
 
2058
        _tmp8_ = _tmp7_->priv->_filename;
 
2059
        _tmp9_ = _tmp4_ (_tmp6_, _tmp8_);
 
2060
        r = _tmp9_;
 
2061
        _tmp10_ = r;
 
2062
        if (_tmp10_ != 0) {
 
2063
                result = r;
 
2064
                return result;
 
2065
        }
 
2066
        _tmp11_ = a;
 
2067
        _tmp12_ = _tmp11_->priv->_mode;
 
2068
        _tmp13_ = b;
 
2069
        _tmp14_ = _tmp13_->priv->_mode;
 
2070
        r = (gint) (_tmp12_ - _tmp14_);
 
2071
        _tmp15_ = r;
 
2072
        if (_tmp15_ != 0) {
 
2073
                result = r;
 
2074
                return result;
 
2075
        }
 
2076
        _tmp16_ = a;
 
2077
        _tmp17_ = b;
 
2078
        _tmp18_ = sql_heavy_database_direct_compare (_tmp16_, _tmp17_);
 
2079
        result = _tmp18_;
1624
2080
        return result;
1625
2081
}
1626
2082
 
1634
2090
     */
1635
2091
gint sql_heavy_database_direct_compare (SQLHeavyDatabase* a, SQLHeavyDatabase* b) {
1636
2092
        gint result = 0;
1637
 
        result = (gint) (((gulong) a) - ((gulong) b));
 
2093
        SQLHeavyDatabase* _tmp0_;
 
2094
        SQLHeavyDatabase* _tmp1_;
 
2095
        _tmp0_ = a;
 
2096
        _tmp1_ = b;
 
2097
        result = (gint) (((gulong) _tmp0_) - ((gulong) _tmp1_));
1638
2098
        return result;
1639
2099
}
1640
2100
 
1645
2105
     * @param cancellable optional GCancellable object
1646
2106
     * @return true on success, false on failure
1647
2107
     */
1648
 
static void _lambda6_ (SQLHeavyDatabase* self, const gchar* sql) {
 
2108
static void __lambda8_ (SQLHeavyDatabase* self, const gchar* sql) {
 
2109
        const gchar* _tmp0_;
1649
2110
        g_return_if_fail (sql != NULL);
1650
 
        g_signal_emit_by_name (self, "sql-executed", sql);
 
2111
        _tmp0_ = sql;
 
2112
        g_signal_emit_by_name (self, "sql-executed", _tmp0_);
1651
2113
}
1652
2114
 
1653
2115
 
1654
 
static void __lambda6__sqlite_trace_callback (gpointer self, const gchar* message) {
1655
 
        _lambda6_ (self, message);
 
2116
static void ___lambda8__sqlite_trace_callback (gpointer self, const gchar* message) {
 
2117
        __lambda8_ (self, message);
1656
2118
}
1657
2119
 
1658
2120
 
1663
2125
 
1664
2126
static gboolean sql_heavy_database_real_init (SQLHeavyDatabase* self, GCancellable* cancellable, GError** error) {
1665
2127
        gboolean result = FALSE;
 
2128
        const gchar* _tmp0_;
1666
2129
        gint flags;
1667
 
        sqlite3* _tmp4_ = NULL;
1668
 
        gint _tmp5_;
 
2130
        SQLHeavyFileMode _tmp13_;
 
2131
        SQLHeavyFileMode _tmp14_;
 
2132
        SQLHeavyFileMode _tmp15_;
 
2133
        const gchar* _tmp17_;
 
2134
        gint _tmp18_;
 
2135
        sqlite3* _tmp19_ = NULL;
 
2136
        gint _tmp20_ = 0;
 
2137
        sqlite3* _tmp23_;
 
2138
        sqlite3* _tmp24_;
 
2139
        sqlite3* _tmp25_;
 
2140
        gint _tmp26_;
1669
2141
        GError * _inner_error_ = NULL;
1670
 
        g_return_val_if_fail (self != NULL, FALSE);
1671
 
        if (g_strcmp0 (self->priv->_filename, ":memory:") != 0) {
1672
 
                GFile* _tmp0_ = NULL;
 
2142
        _tmp0_ = self->priv->_filename;
 
2143
        if (g_strcmp0 (_tmp0_, ":memory:") != 0) {
 
2144
                const gchar* _tmp1_;
 
2145
                GFile* _tmp2_ = NULL;
1673
2146
                GFile* file;
1674
 
                GFile* _tmp1_ = NULL;
1675
 
                GFile* _tmp2_;
1676
 
                _tmp0_ = g_file_new_for_path (self->priv->_filename);
1677
 
                file = _tmp0_;
1678
 
                _tmp1_ = g_file_get_parent (file);
1679
 
                _tmp2_ = _tmp1_;
1680
 
                g_file_make_directory_with_parents (_tmp2_, cancellable, &_inner_error_);
1681
 
                _g_object_unref0 (_tmp2_);
1682
 
                if (_inner_error_ != NULL) {
1683
 
                        goto __catch14_g_error;
 
2147
                _tmp1_ = self->priv->_filename;
 
2148
                _tmp2_ = g_file_new_for_path (_tmp1_);
 
2149
                file = _tmp2_;
 
2150
                {
 
2151
                        GFile* _tmp3_;
 
2152
                        GFile* _tmp4_ = NULL;
 
2153
                        GFile* _tmp5_;
 
2154
                        GCancellable* _tmp6_;
 
2155
                        _tmp3_ = file;
 
2156
                        _tmp4_ = g_file_get_parent (_tmp3_);
 
2157
                        _tmp5_ = _tmp4_;
 
2158
                        _tmp6_ = cancellable;
 
2159
                        g_file_make_directory_with_parents (_tmp5_, _tmp6_, &_inner_error_);
 
2160
                        _g_object_unref0 (_tmp5_);
 
2161
                        if (_inner_error_ != NULL) {
 
2162
                                goto __catch14_g_error;
 
2163
                        }
1684
2164
                }
1685
2165
                goto __finally14;
1686
2166
                __catch14_g_error:
1687
2167
                {
1688
 
                        GError * e;
 
2168
                        GError* e = NULL;
 
2169
                        GError* _tmp7_;
1689
2170
                        e = _inner_error_;
1690
2171
                        _inner_error_ = NULL;
1691
 
                        if (!g_error_matches (e, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
1692
 
                                GError* _tmp3_ = NULL;
1693
 
                                _tmp3_ = g_error_new (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CAN_NOT_OPEN, "Unable to create parent directory: %s (%d)", e->message, e->code);
1694
 
                                _inner_error_ = _tmp3_;
 
2172
                        _tmp7_ = e;
 
2173
                        if (!g_error_matches (_tmp7_, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
 
2174
                                GError* _tmp8_;
 
2175
                                const gchar* _tmp9_;
 
2176
                                GError* _tmp10_;
 
2177
                                gint _tmp11_;
 
2178
                                GError* _tmp12_;
 
2179
                                _tmp8_ = e;
 
2180
                                _tmp9_ = _tmp8_->message;
 
2181
                                _tmp10_ = e;
 
2182
                                _tmp11_ = _tmp10_->code;
 
2183
                                _tmp12_ = g_error_new (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CAN_NOT_OPEN, "Unable to create parent directory: %s (%d)", _tmp9_, _tmp11_);
 
2184
                                _inner_error_ = _tmp12_;
1695
2185
                                _g_error_free0 (e);
1696
2186
                                goto __finally14;
1697
2187
                        }
1713
2203
                _g_object_unref0 (file);
1714
2204
        }
1715
2205
        flags = 0;
1716
 
        if ((self->priv->_mode & SQL_HEAVY_FILE_MODE_READ) == SQL_HEAVY_FILE_MODE_READ) {
 
2206
        _tmp13_ = self->priv->_mode;
 
2207
        if ((_tmp13_ & SQL_HEAVY_FILE_MODE_READ) == SQL_HEAVY_FILE_MODE_READ) {
1717
2208
                flags = SQLITE_OPEN_READONLY;
1718
2209
        }
1719
 
        if ((self->priv->_mode & SQL_HEAVY_FILE_MODE_WRITE) == SQL_HEAVY_FILE_MODE_WRITE) {
 
2210
        _tmp14_ = self->priv->_mode;
 
2211
        if ((_tmp14_ & SQL_HEAVY_FILE_MODE_WRITE) == SQL_HEAVY_FILE_MODE_WRITE) {
1720
2212
                flags = SQLITE_OPEN_READWRITE;
1721
2213
        }
1722
 
        if ((self->priv->_mode & SQL_HEAVY_FILE_MODE_CREATE) == SQL_HEAVY_FILE_MODE_CREATE) {
1723
 
                flags = flags | SQLITE_OPEN_CREATE;
 
2214
        _tmp15_ = self->priv->_mode;
 
2215
        if ((_tmp15_ & SQL_HEAVY_FILE_MODE_CREATE) == SQL_HEAVY_FILE_MODE_CREATE) {
 
2216
                gint _tmp16_;
 
2217
                _tmp16_ = flags;
 
2218
                flags = _tmp16_ | SQLITE_OPEN_CREATE;
1724
2219
        }
1725
 
        _tmp5_ = sqlite3_open_v2 ((const gchar*) self->priv->_filename, &_tmp4_, flags, NULL);
 
2220
        _tmp17_ = self->priv->_filename;
 
2221
        _tmp18_ = flags;
 
2222
        _tmp20_ = sqlite3_open_v2 ((const gchar*) _tmp17_, &_tmp19_, _tmp18_, NULL);
1726
2223
        _sqlite3_close0 (self->priv->db);
1727
 
        self->priv->db = _tmp4_;
1728
 
        if (_tmp5_ != SQLITE_OK) {
1729
 
                const gchar* _tmp6_ = NULL;
1730
 
                GError* _tmp7_ = NULL;
1731
 
                _tmp6_ = sql_heavy_sqlite_errstr (SQLITE_CANTOPEN);
1732
 
                _tmp7_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CAN_NOT_OPEN, _tmp6_);
1733
 
                _inner_error_ = _tmp7_;
 
2224
        self->priv->db = _tmp19_;
 
2225
        if (_tmp20_ != SQLITE_OK) {
 
2226
                const gchar* _tmp21_ = NULL;
 
2227
                GError* _tmp22_;
 
2228
                _tmp21_ = sql_heavy_sqlite_errstr (SQLITE_CANTOPEN);
 
2229
                _tmp22_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CAN_NOT_OPEN, _tmp21_);
 
2230
                _inner_error_ = _tmp22_;
1734
2231
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1735
2232
                        g_propagate_error (error, _inner_error_);
1736
2233
                        return FALSE;
1740
2237
                        return FALSE;
1741
2238
                }
1742
2239
        }
1743
 
        sqlite3_trace (self->priv->db, __lambda6__sqlite_trace_callback, self);
1744
 
        sqlite3_update_hook (self->priv->db, _sql_heavy_database_update_hook_cb_sqlite_update_callback, self);
1745
 
        sqlite3_busy_timeout (self->priv->db, G_MAXINT);
 
2240
        _tmp23_ = self->priv->db;
 
2241
        sqlite3_trace (_tmp23_, ___lambda8__sqlite_trace_callback, self);
 
2242
        _tmp24_ = self->priv->db;
 
2243
        sqlite3_update_hook (_tmp24_, _sql_heavy_database_update_hook_cb_sqlite_update_callback, self);
 
2244
        _tmp25_ = self->priv->db;
 
2245
        _tmp26_ = G_MAXINT;
 
2246
        sqlite3_busy_timeout (_tmp25_, _tmp26_);
1746
2247
        {
1747
2248
                gchar* env_var;
1748
 
                gboolean _tmp8_ = FALSE;
1749
 
                const gchar* _tmp14_ = NULL;
1750
 
                gchar* _tmp15_;
1751
 
                const gchar* _tmp17_ = NULL;
1752
 
                gchar* _tmp18_;
 
2249
                gboolean _tmp27_ = FALSE;
 
2250
                gboolean _tmp31_;
 
2251
                const gchar* _tmp39_ = NULL;
 
2252
                gchar* _tmp40_;
 
2253
                const gchar* _tmp41_;
 
2254
                const gchar* _tmp44_ = NULL;
 
2255
                gchar* _tmp45_;
 
2256
                const gchar* _tmp46_;
1753
2257
                env_var = NULL;
1754
2258
                if (!SQL_HEAVY_IS_PROFILING_DATABASE (self)) {
1755
 
                        const gchar* _tmp9_ = NULL;
1756
 
                        gchar* _tmp10_;
1757
 
                        _tmp9_ = g_getenv ("SQLHEAVY_PROFILING_DATA");
1758
 
                        _tmp10_ = g_strdup (_tmp9_);
 
2259
                        const gchar* _tmp28_ = NULL;
 
2260
                        gchar* _tmp29_;
 
2261
                        const gchar* _tmp30_;
 
2262
                        _tmp28_ = g_getenv ("SQLHEAVY_PROFILING_DATA");
 
2263
                        _tmp29_ = g_strdup (_tmp28_);
1759
2264
                        _g_free0 (env_var);
1760
 
                        env_var = _tmp10_;
1761
 
                        _tmp8_ = env_var != NULL;
 
2265
                        env_var = _tmp29_;
 
2266
                        _tmp30_ = env_var;
 
2267
                        _tmp27_ = _tmp30_ != NULL;
1762
2268
                } else {
1763
 
                        _tmp8_ = FALSE;
 
2269
                        _tmp27_ = FALSE;
1764
2270
                }
1765
 
                if (_tmp8_) {
1766
 
                        SQLHeavyProfilingDatabase* _tmp11_ = NULL;
1767
 
                        SQLHeavyProfilingDatabase* _tmp12_;
1768
 
                        SQLHeavyProfilingDatabase* _tmp13_;
1769
 
                        _tmp11_ = sql_heavy_profiling_database_new (env_var, &_inner_error_);
1770
 
                        _tmp12_ = _tmp11_;
1771
 
                        if (_inner_error_ != NULL) {
1772
 
                                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1773
 
                                        goto __catch15_sql_heavy_error;
 
2271
                _tmp31_ = _tmp27_;
 
2272
                if (_tmp31_) {
 
2273
                        {
 
2274
                                const gchar* _tmp32_;
 
2275
                                SQLHeavyProfilingDatabase* _tmp33_;
 
2276
                                SQLHeavyProfilingDatabase* _tmp34_;
 
2277
                                SQLHeavyProfilingDatabase* _tmp35_;
 
2278
                                _tmp32_ = env_var;
 
2279
                                _tmp33_ = sql_heavy_profiling_database_new (_tmp32_, &_inner_error_);
 
2280
                                _tmp34_ = _tmp33_;
 
2281
                                if (_inner_error_ != NULL) {
 
2282
                                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
2283
                                                goto __catch15_sql_heavy_error;
 
2284
                                        }
 
2285
                                        _g_free0 (env_var);
 
2286
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
2287
                                        g_clear_error (&_inner_error_);
 
2288
                                        return FALSE;
1774
2289
                                }
1775
 
                                _g_free0 (env_var);
1776
 
                                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1777
 
                                g_clear_error (&_inner_error_);
1778
 
                                return FALSE;
 
2290
                                _tmp35_ = _tmp34_;
 
2291
                                sql_heavy_database_set_profiling_data (self, _tmp35_);
 
2292
                                _g_object_unref0 (_tmp35_);
1779
2293
                        }
1780
 
                        _tmp13_ = _tmp12_;
1781
 
                        sql_heavy_database_set_profiling_data (self, _tmp13_);
1782
 
                        _g_object_unref0 (_tmp13_);
1783
2294
                        goto __finally15;
1784
2295
                        __catch15_sql_heavy_error:
1785
2296
                        {
1786
 
                                GError * e;
 
2297
                                GError* e = NULL;
 
2298
                                const gchar* _tmp36_;
 
2299
                                GError* _tmp37_;
 
2300
                                const gchar* _tmp38_;
1787
2301
                                e = _inner_error_;
1788
2302
                                _inner_error_ = NULL;
 
2303
                                _tmp36_ = env_var;
 
2304
                                _tmp37_ = e;
 
2305
                                _tmp38_ = _tmp37_->message;
1789
2306
                                g_critical ("sqlheavy-database.vala:1106: Unable to set profiling database to `%s':" \
1790
 
" %s", env_var, e->message);
 
2307
" %s", _tmp36_, _tmp38_);
1791
2308
                                _g_error_free0 (e);
1792
2309
                        }
1793
2310
                        __finally15:
1804
2321
                                }
1805
2322
                        }
1806
2323
                }
1807
 
                _tmp14_ = g_getenv ("SQLHEAVY_JOURNAL_MODE");
1808
 
                _tmp15_ = g_strdup (_tmp14_);
 
2324
                _tmp39_ = g_getenv ("SQLHEAVY_JOURNAL_MODE");
 
2325
                _tmp40_ = g_strdup (_tmp39_);
1809
2326
                _g_free0 (env_var);
1810
 
                env_var = _tmp15_;
1811
 
                if (env_var != NULL) {
1812
 
                        SQLHeavyJournalMode _tmp16_;
1813
 
                        _tmp16_ = sql_heavy_journal_mode_from_string (env_var);
1814
 
                        sql_heavy_database_set_journal_mode (self, _tmp16_);
 
2327
                env_var = _tmp40_;
 
2328
                _tmp41_ = env_var;
 
2329
                if (_tmp41_ != NULL) {
 
2330
                        const gchar* _tmp42_;
 
2331
                        SQLHeavyJournalMode _tmp43_ = 0;
 
2332
                        _tmp42_ = env_var;
 
2333
                        _tmp43_ = sql_heavy_journal_mode_from_string (_tmp42_);
 
2334
                        sql_heavy_database_set_journal_mode (self, _tmp43_);
1815
2335
                }
1816
 
                _tmp17_ = g_getenv ("SQLHEAVY_SYNCHRONOUS_MODE");
1817
 
                _tmp18_ = g_strdup (_tmp17_);
 
2336
                _tmp44_ = g_getenv ("SQLHEAVY_SYNCHRONOUS_MODE");
 
2337
                _tmp45_ = g_strdup (_tmp44_);
1818
2338
                _g_free0 (env_var);
1819
 
                env_var = _tmp18_;
1820
 
                if (env_var != NULL) {
1821
 
                        SQLHeavySynchronousMode _tmp19_;
1822
 
                        _tmp19_ = sql_heavy_synchronous_mode_from_string (env_var);
1823
 
                        sql_heavy_database_set_synchronous (self, _tmp19_);
 
2339
                env_var = _tmp45_;
 
2340
                _tmp46_ = env_var;
 
2341
                if (_tmp46_ != NULL) {
 
2342
                        const gchar* _tmp47_;
 
2343
                        SQLHeavySynchronousMode _tmp48_ = 0;
 
2344
                        _tmp47_ = env_var;
 
2345
                        _tmp48_ = sql_heavy_synchronous_mode_from_string (_tmp47_);
 
2346
                        sql_heavy_database_set_synchronous (self, _tmp48_);
1824
2347
                }
1825
2348
                _g_free0 (env_var);
1826
2349
        }
1830
2353
 
1831
2354
 
1832
2355
gboolean sql_heavy_database_init (SQLHeavyDatabase* self, GCancellable* cancellable, GError** error) {
 
2356
        g_return_val_if_fail (self != NULL, FALSE);
1833
2357
        return SQL_HEAVY_DATABASE_GET_CLASS (self)->init (self, cancellable, error);
1834
2358
}
1835
2359
 
1842
2366
     */
1843
2367
SQLHeavyDatabase* sql_heavy_database_construct (GType object_type, const gchar* filename, SQLHeavyFileMode mode, GError** error) {
1844
2368
        SQLHeavyDatabase * self = NULL;
 
2369
        const gchar* _tmp0_;
 
2370
        const gchar* _tmp1_;
 
2371
        SQLHeavyFileMode _tmp2_;
1845
2372
        GError * _inner_error_ = NULL;
1846
 
        if (filename == NULL) {
 
2373
        _tmp0_ = filename;
 
2374
        if (_tmp0_ == NULL) {
1847
2375
                filename = ":memory:";
1848
2376
        }
1849
 
        self = (SQLHeavyDatabase*) g_object_new (object_type, "filename", (const gchar*) filename, "mode", mode, NULL);
 
2377
        _tmp1_ = filename;
 
2378
        _tmp2_ = mode;
 
2379
        self = (SQLHeavyDatabase*) g_object_new (object_type, "filename", (const gchar*) _tmp1_, "mode", _tmp2_, NULL);
1850
2380
        sql_heavy_database_init (self, NULL, &_inner_error_);
1851
2381
        if (_inner_error_ != NULL) {
1852
2382
                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1870
2400
 
1871
2401
gint sql_heavy_database_get_wal_auto_checkpoint (SQLHeavyDatabase* self) {
1872
2402
        gint result;
 
2403
        gint _tmp0_;
1873
2404
        g_return_val_if_fail (self != NULL, 0);
1874
 
        result = self->priv->_wal_auto_checkpoint;
 
2405
        _tmp0_ = self->priv->_wal_auto_checkpoint;
 
2406
        result = _tmp0_;
1875
2407
        return result;
1876
2408
}
1877
2409
 
1878
2410
 
1879
2411
void sql_heavy_database_set_wal_auto_checkpoint (SQLHeavyDatabase* self, gint value) {
 
2412
        gint _tmp0_;
1880
2413
        g_return_if_fail (self != NULL);
1881
 
        self->priv->_wal_auto_checkpoint = value;
 
2414
        _tmp0_ = value;
 
2415
        self->priv->_wal_auto_checkpoint = _tmp0_;
1882
2416
        g_object_notify ((GObject *) self, "wal-auto-checkpoint");
1883
2417
}
1884
2418
 
1896
2430
 
1897
2431
SQLHeavyProfilingDatabase* sql_heavy_database_get_profiling_data (SQLHeavyDatabase* self) {
1898
2432
        SQLHeavyProfilingDatabase* result;
 
2433
        SQLHeavyProfilingDatabase* _tmp0_;
1899
2434
        g_return_val_if_fail (self != NULL, NULL);
1900
 
        result = self->priv->_profiling_data;
 
2435
        _tmp0_ = self->priv->_profiling_data;
 
2436
        result = _tmp0_;
1901
2437
        return result;
1902
2438
}
1903
2439
 
1904
2440
 
1905
2441
void sql_heavy_database_set_profiling_data (SQLHeavyDatabase* self, SQLHeavyProfilingDatabase* value) {
1906
2442
        SQLHeavyProfilingDatabase* _tmp0_;
 
2443
        SQLHeavyProfilingDatabase* _tmp1_;
1907
2444
        g_return_if_fail (self != NULL);
1908
 
        _tmp0_ = _g_object_ref0 (value);
 
2445
        _tmp0_ = value;
 
2446
        _tmp1_ = _g_object_ref0 (_tmp0_);
1909
2447
        _g_object_unref0 (self->priv->_profiling_data);
1910
 
        self->priv->_profiling_data = _tmp0_;
 
2448
        self->priv->_profiling_data = _tmp1_;
1911
2449
        g_object_notify ((GObject *) self, "profiling-data");
1912
2450
}
1913
2451
 
1914
2452
 
1915
2453
gboolean sql_heavy_database_get_enable_profiling (SQLHeavyDatabase* self) {
1916
2454
        gboolean result;
 
2455
        SQLHeavyProfilingDatabase* _tmp0_;
1917
2456
        g_return_val_if_fail (self != NULL, FALSE);
1918
 
        result = self->priv->_profiling_data != NULL;
 
2457
        _tmp0_ = self->priv->_profiling_data;
 
2458
        result = _tmp0_ != NULL;
1919
2459
        return result;
1920
2460
}
1921
2461
 
1922
2462
 
1923
2463
void sql_heavy_database_set_enable_profiling (SQLHeavyDatabase* self, gboolean value) {
 
2464
        gboolean _tmp0_;
1924
2465
        GError * _inner_error_ = NULL;
1925
2466
        g_return_if_fail (self != NULL);
1926
 
        if (value == FALSE) {
 
2467
        _tmp0_ = value;
 
2468
        if (_tmp0_ == FALSE) {
1927
2469
                sql_heavy_database_set_profiling_data (self, NULL);
1928
2470
        } else {
1929
 
                if (self->priv->_profiling_data == NULL) {
1930
 
                        SQLHeavyProfilingDatabase* _tmp0_ = NULL;
 
2471
                {
1931
2472
                        SQLHeavyProfilingDatabase* _tmp1_;
1932
 
                        SQLHeavyProfilingDatabase* _tmp2_;
1933
 
                        _tmp0_ = sql_heavy_profiling_database_new (NULL, &_inner_error_);
1934
 
                        _tmp1_ = _tmp0_;
1935
 
                        if (_inner_error_ != NULL) {
1936
 
                                if (_inner_error_->domain == SQL_HEAVY_ERROR) {
1937
 
                                        goto __catch16_sql_heavy_error;
 
2473
                        _tmp1_ = self->priv->_profiling_data;
 
2474
                        if (_tmp1_ == NULL) {
 
2475
                                SQLHeavyProfilingDatabase* _tmp2_;
 
2476
                                SQLHeavyProfilingDatabase* _tmp3_;
 
2477
                                SQLHeavyProfilingDatabase* _tmp4_;
 
2478
                                _tmp2_ = sql_heavy_profiling_database_new (NULL, &_inner_error_);
 
2479
                                _tmp3_ = _tmp2_;
 
2480
                                if (_inner_error_ != NULL) {
 
2481
                                        if (_inner_error_->domain == SQL_HEAVY_ERROR) {
 
2482
                                                goto __catch16_sql_heavy_error;
 
2483
                                        }
 
2484
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
2485
                                        g_clear_error (&_inner_error_);
 
2486
                                        return;
1938
2487
                                }
1939
 
                                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1940
 
                                g_clear_error (&_inner_error_);
1941
 
                                return;
 
2488
                                _tmp4_ = _tmp3_;
 
2489
                                sql_heavy_database_set_profiling_data (self, _tmp4_);
 
2490
                                _g_object_unref0 (_tmp4_);
1942
2491
                        }
1943
 
                        _tmp2_ = _tmp1_;
1944
 
                        sql_heavy_database_set_profiling_data (self, _tmp2_);
1945
 
                        _g_object_unref0 (_tmp2_);
1946
2492
                }
1947
2493
                goto __finally16;
1948
2494
                __catch16_sql_heavy_error:
1949
2495
                {
1950
 
                        GError * e;
 
2496
                        GError* e = NULL;
 
2497
                        GError* _tmp5_;
 
2498
                        const gchar* _tmp6_;
 
2499
                        GError* _tmp7_;
 
2500
                        gint _tmp8_;
1951
2501
                        e = _inner_error_;
1952
2502
                        _inner_error_ = NULL;
1953
 
                        g_warning ("sqlheavy-database.vala:303: Unable to enable profiling: %s (%d)", e->message, e->code);
 
2503
                        _tmp5_ = e;
 
2504
                        _tmp6_ = _tmp5_->message;
 
2505
                        _tmp7_ = e;
 
2506
                        _tmp8_ = _tmp7_->code;
 
2507
                        g_warning ("sqlheavy-database.vala:303: Unable to enable profiling: %s (%d)", _tmp6_, _tmp8_);
1954
2508
                        _g_error_free0 (e);
1955
2509
                        return;
1956
2510
                }
1967
2521
 
1968
2522
const gchar* sql_heavy_database_get_filename (SQLHeavyDatabase* self) {
1969
2523
        const gchar* result;
 
2524
        const gchar* _tmp0_;
1970
2525
        g_return_val_if_fail (self != NULL, NULL);
1971
 
        result = self->priv->_filename;
 
2526
        _tmp0_ = self->priv->_filename;
 
2527
        result = _tmp0_;
1972
2528
        return result;
1973
2529
}
1974
2530
 
1975
2531
 
1976
2532
static void sql_heavy_database_set_filename (SQLHeavyDatabase* self, const gchar* value) {
1977
 
        gchar* _tmp0_;
 
2533
        const gchar* _tmp0_;
 
2534
        gchar* _tmp1_;
1978
2535
        g_return_if_fail (self != NULL);
1979
 
        _tmp0_ = g_strdup (value);
 
2536
        _tmp0_ = value;
 
2537
        _tmp1_ = g_strdup (_tmp0_);
1980
2538
        _g_free0 (self->priv->_filename);
1981
 
        self->priv->_filename = _tmp0_;
 
2539
        self->priv->_filename = _tmp1_;
1982
2540
        g_object_notify ((GObject *) self, "filename");
1983
2541
}
1984
2542
 
1985
2543
 
1986
2544
SQLHeavyFileMode sql_heavy_database_get_mode (SQLHeavyDatabase* self) {
1987
2545
        SQLHeavyFileMode result;
 
2546
        SQLHeavyFileMode _tmp0_;
1988
2547
        g_return_val_if_fail (self != NULL, 0);
1989
 
        result = self->priv->_mode;
 
2548
        _tmp0_ = self->priv->_mode;
 
2549
        result = _tmp0_;
1990
2550
        return result;
1991
2551
}
1992
2552
 
1993
2553
 
1994
2554
static void sql_heavy_database_set_mode (SQLHeavyDatabase* self, SQLHeavyFileMode value) {
 
2555
        SQLHeavyFileMode _tmp0_;
1995
2556
        g_return_if_fail (self != NULL);
1996
 
        self->priv->_mode = value;
 
2557
        _tmp0_ = value;
 
2558
        self->priv->_mode = _tmp0_;
1997
2559
        g_object_notify ((GObject *) self, "mode");
1998
2560
}
1999
2561
 
2000
2562
 
2001
2563
gint64 sql_heavy_database_get_last_insert_id (SQLHeavyDatabase* self) {
2002
2564
        gint64 result;
2003
 
        gint64 _tmp0_;
 
2565
        sqlite3* _tmp0_;
 
2566
        gint64 _tmp1_ = 0LL;
2004
2567
        g_return_val_if_fail (self != NULL, 0LL);
2005
 
        _tmp0_ = sqlite3_last_insert_rowid (self->priv->db);
2006
 
        result = _tmp0_;
 
2568
        _tmp0_ = self->priv->db;
 
2569
        _tmp1_ = sqlite3_last_insert_rowid (_tmp0_);
 
2570
        result = _tmp1_;
2007
2571
        return result;
2008
2572
}
2009
2573
 
2012
2576
        gint result;
2013
2577
        gint current = 0;
2014
2578
        gint high = 0;
2015
 
        gint _tmp0_;
2016
 
        gint _tmp1_;
 
2579
        sqlite3* _tmp0_;
 
2580
        gint _tmp1_ = 0;
 
2581
        gint _tmp2_ = 0;
2017
2582
        g_return_val_if_fail (self != NULL, 0);
2018
 
        sqlite3_db_status (self->priv->db, SQLITE_DBSTATUS_LOOKASIDE_USED, &_tmp0_, &_tmp1_, 0);
2019
 
        current = _tmp0_;
2020
 
        high = _tmp1_;
 
2583
        _tmp0_ = self->priv->db;
 
2584
        sqlite3_db_status (_tmp0_, SQLITE_DBSTATUS_LOOKASIDE_USED, &_tmp1_, &_tmp2_, 0);
 
2585
        current = _tmp1_;
 
2586
        high = _tmp2_;
2021
2587
        result = current;
2022
2588
        return result;
2023
2589
}
2025
2591
 
2026
2592
SQLHeavyAutoVacuum sql_heavy_database_get_auto_vacuum (SQLHeavyDatabase* self) {
2027
2593
        SQLHeavyAutoVacuum result;
2028
 
        gint _tmp0_;
 
2594
        gint _tmp0_ = 0;
2029
2595
        g_return_val_if_fail (self != NULL, 0);
2030
2596
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "auto_vacuum");
2031
2597
        result = (SQLHeavyAutoVacuum) _tmp0_;
2034
2600
 
2035
2601
 
2036
2602
void sql_heavy_database_set_auto_vacuum (SQLHeavyDatabase* self, SQLHeavyAutoVacuum value) {
 
2603
        SQLHeavyAutoVacuum _tmp0_;
2037
2604
        g_return_if_fail (self != NULL);
2038
 
        sql_heavy_database_pragma_set_int (self, "auto_vacuum", (gint) value);
 
2605
        _tmp0_ = value;
 
2606
        sql_heavy_database_pragma_set_int (self, "auto_vacuum", (gint) _tmp0_);
2039
2607
        g_object_notify ((GObject *) self, "auto-vacuum");
2040
2608
}
2041
2609
 
2042
2610
 
2043
2611
gint sql_heavy_database_get_cache_size (SQLHeavyDatabase* self) {
2044
2612
        gint result;
2045
 
        gint _tmp0_;
 
2613
        gint _tmp0_ = 0;
2046
2614
        g_return_val_if_fail (self != NULL, 0);
2047
2615
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "cache_size");
2048
2616
        result = _tmp0_;
2051
2619
 
2052
2620
 
2053
2621
void sql_heavy_database_set_cache_size (SQLHeavyDatabase* self, gint value) {
 
2622
        gint _tmp0_;
2054
2623
        g_return_if_fail (self != NULL);
2055
 
        sql_heavy_database_pragma_set_int (self, "cache_size", value);
 
2624
        _tmp0_ = value;
 
2625
        sql_heavy_database_pragma_set_int (self, "cache_size", _tmp0_);
2056
2626
        g_object_notify ((GObject *) self, "cache-size");
2057
2627
}
2058
2628
 
2059
2629
 
2060
2630
gboolean sql_heavy_database_get_case_sensitive_like (SQLHeavyDatabase* self) {
2061
2631
        gboolean result;
2062
 
        gboolean _tmp0_;
 
2632
        gboolean _tmp0_ = FALSE;
2063
2633
        g_return_val_if_fail (self != NULL, FALSE);
2064
2634
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "case_sensitive_like");
2065
2635
        result = _tmp0_;
2068
2638
 
2069
2639
 
2070
2640
void sql_heavy_database_set_case_sensitive_like (SQLHeavyDatabase* self, gboolean value) {
 
2641
        gboolean _tmp0_;
2071
2642
        g_return_if_fail (self != NULL);
2072
 
        sql_heavy_database_pragma_set_bool (self, "case_sensitive_like", value);
 
2643
        _tmp0_ = value;
 
2644
        sql_heavy_database_pragma_set_bool (self, "case_sensitive_like", _tmp0_);
2073
2645
        g_object_notify ((GObject *) self, "case-sensitive-like");
2074
2646
}
2075
2647
 
2076
2648
 
2077
2649
gboolean sql_heavy_database_get_count_changes (SQLHeavyDatabase* self) {
2078
2650
        gboolean result;
2079
 
        gboolean _tmp0_;
 
2651
        gboolean _tmp0_ = FALSE;
2080
2652
        g_return_val_if_fail (self != NULL, FALSE);
2081
2653
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "count_changes");
2082
2654
        result = _tmp0_;
2085
2657
 
2086
2658
 
2087
2659
void sql_heavy_database_set_count_changes (SQLHeavyDatabase* self, gboolean value) {
 
2660
        gboolean _tmp0_;
2088
2661
        g_return_if_fail (self != NULL);
2089
 
        sql_heavy_database_pragma_set_bool (self, "count_changes", value);
 
2662
        _tmp0_ = value;
 
2663
        sql_heavy_database_pragma_set_bool (self, "count_changes", _tmp0_);
2090
2664
        g_object_notify ((GObject *) self, "count-changes");
2091
2665
}
2092
2666
 
2093
2667
 
2094
2668
gint sql_heavy_database_get_default_cache_size (SQLHeavyDatabase* self) {
2095
2669
        gint result;
2096
 
        gint _tmp0_;
 
2670
        gint _tmp0_ = 0;
2097
2671
        g_return_val_if_fail (self != NULL, 0);
2098
2672
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "default_cache_size");
2099
2673
        result = _tmp0_;
2102
2676
 
2103
2677
 
2104
2678
void sql_heavy_database_set_default_cache_size (SQLHeavyDatabase* self, gint value) {
 
2679
        gint _tmp0_;
2105
2680
        g_return_if_fail (self != NULL);
2106
 
        sql_heavy_database_pragma_set_int (self, "default_cache_size", value);
 
2681
        _tmp0_ = value;
 
2682
        sql_heavy_database_pragma_set_int (self, "default_cache_size", _tmp0_);
2107
2683
        g_object_notify ((GObject *) self, "default-cache-size");
2108
2684
}
2109
2685
 
2110
2686
 
2111
2687
gboolean sql_heavy_database_get_empty_result_callbacks (SQLHeavyDatabase* self) {
2112
2688
        gboolean result;
2113
 
        gboolean _tmp0_;
 
2689
        gboolean _tmp0_ = FALSE;
2114
2690
        g_return_val_if_fail (self != NULL, FALSE);
2115
2691
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "empty_result_callbacks");
2116
2692
        result = _tmp0_;
2119
2695
 
2120
2696
 
2121
2697
void sql_heavy_database_set_empty_result_callbacks (SQLHeavyDatabase* self, gboolean value) {
 
2698
        gboolean _tmp0_;
2122
2699
        g_return_if_fail (self != NULL);
2123
 
        sql_heavy_database_pragma_set_bool (self, "empty_result_callbacks", value);
 
2700
        _tmp0_ = value;
 
2701
        sql_heavy_database_pragma_set_bool (self, "empty_result_callbacks", _tmp0_);
2124
2702
        g_object_notify ((GObject *) self, "empty-result-callbacks");
2125
2703
}
2126
2704
 
2129
2707
        SQLHeavyEncoding result;
2130
2708
        gchar* _tmp0_ = NULL;
2131
2709
        gchar* _tmp1_;
2132
 
        SQLHeavyEncoding _tmp2_;
 
2710
        SQLHeavyEncoding _tmp2_ = 0;
2133
2711
        SQLHeavyEncoding _tmp3_;
2134
2712
        g_return_val_if_fail (self != NULL, 0);
2135
2713
        _tmp0_ = sql_heavy_database_pragma_get_string (self, "encoding");
2143
2721
 
2144
2722
 
2145
2723
void sql_heavy_database_set_encoding (SQLHeavyDatabase* self, SQLHeavyEncoding value) {
2146
 
        const gchar* _tmp0_ = NULL;
 
2724
        SQLHeavyEncoding _tmp0_;
 
2725
        const gchar* _tmp1_ = NULL;
2147
2726
        g_return_if_fail (self != NULL);
2148
 
        _tmp0_ = sql_heavy_encoding_to_string (value);
2149
 
        sql_heavy_database_pragma_set_string (self, "encoding", _tmp0_);
 
2727
        _tmp0_ = value;
 
2728
        _tmp1_ = sql_heavy_encoding_to_string (_tmp0_);
 
2729
        sql_heavy_database_pragma_set_string (self, "encoding", _tmp1_);
2150
2730
        g_object_notify ((GObject *) self, "encoding");
2151
2731
}
2152
2732
 
2153
2733
 
2154
2734
gboolean sql_heavy_database_get_foreign_keys (SQLHeavyDatabase* self) {
2155
2735
        gboolean result;
2156
 
        gboolean _tmp0_;
 
2736
        gboolean _tmp0_ = FALSE;
2157
2737
        g_return_val_if_fail (self != NULL, FALSE);
2158
2738
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "foreign_keys");
2159
2739
        result = _tmp0_;
2162
2742
 
2163
2743
 
2164
2744
void sql_heavy_database_set_foreign_keys (SQLHeavyDatabase* self, gboolean value) {
 
2745
        gboolean _tmp0_;
2165
2746
        g_return_if_fail (self != NULL);
2166
 
        sql_heavy_database_pragma_set_bool (self, "foreign_keys", value);
 
2747
        _tmp0_ = value;
 
2748
        sql_heavy_database_pragma_set_bool (self, "foreign_keys", _tmp0_);
2167
2749
        g_object_notify ((GObject *) self, "foreign-keys");
2168
2750
}
2169
2751
 
2170
2752
 
2171
2753
gboolean sql_heavy_database_get_full_column_names (SQLHeavyDatabase* self) {
2172
2754
        gboolean result;
2173
 
        gboolean _tmp0_;
 
2755
        gboolean _tmp0_ = FALSE;
2174
2756
        g_return_val_if_fail (self != NULL, FALSE);
2175
2757
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "full_column_names");
2176
2758
        result = _tmp0_;
2179
2761
 
2180
2762
 
2181
2763
void sql_heavy_database_set_full_column_names (SQLHeavyDatabase* self, gboolean value) {
 
2764
        gboolean _tmp0_;
2182
2765
        g_return_if_fail (self != NULL);
2183
 
        sql_heavy_database_pragma_set_bool (self, "full_column_names", value);
 
2766
        _tmp0_ = value;
 
2767
        sql_heavy_database_pragma_set_bool (self, "full_column_names", _tmp0_);
2184
2768
        g_object_notify ((GObject *) self, "full-column-names");
2185
2769
}
2186
2770
 
2187
2771
 
2188
2772
gboolean sql_heavy_database_get_full_fsync (SQLHeavyDatabase* self) {
2189
2773
        gboolean result;
2190
 
        gboolean _tmp0_;
 
2774
        gboolean _tmp0_ = FALSE;
2191
2775
        g_return_val_if_fail (self != NULL, FALSE);
2192
2776
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "fullfsync");
2193
2777
        result = _tmp0_;
2196
2780
 
2197
2781
 
2198
2782
void sql_heavy_database_set_full_fsync (SQLHeavyDatabase* self, gboolean value) {
 
2783
        gboolean _tmp0_;
2199
2784
        g_return_if_fail (self != NULL);
2200
 
        sql_heavy_database_pragma_set_bool (self, "fullfsync", value);
 
2785
        _tmp0_ = value;
 
2786
        sql_heavy_database_pragma_set_bool (self, "fullfsync", _tmp0_);
2201
2787
        g_object_notify ((GObject *) self, "full-fsync");
2202
2788
}
2203
2789
 
2206
2792
        SQLHeavyJournalMode result;
2207
2793
        gchar* _tmp0_ = NULL;
2208
2794
        gchar* _tmp1_;
2209
 
        SQLHeavyJournalMode _tmp2_;
 
2795
        SQLHeavyJournalMode _tmp2_ = 0;
2210
2796
        SQLHeavyJournalMode _tmp3_;
2211
2797
        g_return_val_if_fail (self != NULL, 0);
2212
2798
        _tmp0_ = sql_heavy_database_pragma_get_string (self, "journal_mode");
2219
2805
}
2220
2806
 
2221
2807
 
2222
 
static gint _lambda7_ (SQLHeavyDatabase* self, sqlite3* db, const gchar* dbname, gint pages) {
 
2808
static gint _sql_heavy_database_journal_mode____lambda9_ (SQLHeavyDatabase* self, sqlite3* db, const gchar* dbname, gint pages) {
2223
2809
        gint result = 0;
 
2810
        const gchar* _tmp0_;
 
2811
        gint _tmp1_;
2224
2812
        g_return_val_if_fail (db != NULL, 0);
2225
2813
        g_return_val_if_fail (dbname != NULL, 0);
2226
 
        g_signal_emit_by_name (self, "wal-committed", dbname, pages);
 
2814
        _tmp0_ = dbname;
 
2815
        _tmp1_ = pages;
 
2816
        g_signal_emit_by_name (self, "wal-committed", _tmp0_, _tmp1_);
2227
2817
        result = SQLITE_OK;
2228
2818
        return result;
2229
2819
}
2230
2820
 
2231
2821
 
2232
 
static gint __lambda7__sql_heavy_wal_hook_callback (gpointer self, sqlite3* db, const gchar* dbname, gint pages) {
 
2822
static gint __sql_heavy_database_journal_mode____lambda9__sql_heavy_wal_hook_callback (gpointer self, sqlite3* db, const gchar* dbname, gint pages) {
2233
2823
        gint result;
2234
 
        result = _lambda7_ (self, db, dbname, pages);
 
2824
        result = _sql_heavy_database_journal_mode____lambda9_ (self, db, dbname, pages);
2235
2825
        return result;
2236
2826
}
2237
2827
 
2238
2828
 
2239
2829
void sql_heavy_database_set_journal_mode (SQLHeavyDatabase* self, SQLHeavyJournalMode value) {
2240
 
        const gchar* _tmp5_ = NULL;
 
2830
        SQLHeavyJournalMode _tmp0_;
 
2831
        SQLHeavyJournalMode _tmp9_;
 
2832
        const gchar* _tmp10_ = NULL;
2241
2833
        g_return_if_fail (self != NULL);
2242
 
        if (value == SQL_HEAVY_JOURNAL_MODE_WAL) {
2243
 
                gint _tmp0_;
2244
 
                GModule* _tmp2_ = NULL;
 
2834
        _tmp0_ = value;
 
2835
        if (_tmp0_ == SQL_HEAVY_JOURNAL_MODE_WAL) {
 
2836
                gint _tmp1_ = 0;
 
2837
                GModule* _tmp3_ = NULL;
2245
2838
                GModule* mod;
2246
2839
                void* sqlite3_wal_hook = NULL;
2247
 
                void* _tmp3_ = NULL;
2248
 
                gboolean _tmp4_;
2249
 
                _tmp0_ = sqlite3_libversion_number ();
2250
 
                if (_tmp0_ < 3007000) {
2251
 
                        const gchar* _tmp1_ = NULL;
2252
 
                        _tmp1_ = sqlite3_libversion ();
 
2840
                GModule* _tmp4_;
 
2841
                void* _tmp5_ = NULL;
 
2842
                gboolean _tmp6_ = FALSE;
 
2843
                void* _tmp7_;
 
2844
                sqlite3* _tmp8_;
 
2845
                _tmp1_ = sqlite3_libversion_number ();
 
2846
                if (_tmp1_ < 3007000) {
 
2847
                        const gchar* _tmp2_ = NULL;
 
2848
                        _tmp2_ = sqlite3_libversion ();
2253
2849
                        g_warning ("sqlheavy-database.vala:564: SQLite-%s does not support write-ahead log" \
2254
 
"ging.", _tmp1_);
 
2850
"ging.", _tmp2_);
2255
2851
                        return;
2256
2852
                }
2257
 
                _tmp2_ = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
2258
 
                mod = _tmp2_;
2259
 
                _tmp4_ = g_module_symbol (mod, "sqlite3_wal_hook", &_tmp3_);
2260
 
                sqlite3_wal_hook = _tmp3_;
2261
 
                g_assert (_tmp4_);
2262
 
                ((SQLHeavyWALHookFunc) sqlite3_wal_hook) (self->priv->db, __lambda7__sql_heavy_wal_hook_callback, self);
 
2853
                _tmp3_ = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
 
2854
                mod = _tmp3_;
 
2855
                _tmp4_ = mod;
 
2856
                _tmp6_ = g_module_symbol (_tmp4_, "sqlite3_wal_hook", &_tmp5_);
 
2857
                sqlite3_wal_hook = _tmp5_;
 
2858
                g_assert (_tmp6_);
 
2859
                _tmp7_ = sqlite3_wal_hook;
 
2860
                _tmp8_ = self->priv->db;
 
2861
                ((SQLHeavyWALHookFunc) _tmp7_) (_tmp8_, __sql_heavy_database_journal_mode____lambda9__sql_heavy_wal_hook_callback, self);
2263
2862
                _g_module_close0 (mod);
2264
2863
        }
2265
 
        _tmp5_ = sql_heavy_journal_mode_to_string (value);
2266
 
        sql_heavy_database_pragma_set_string (self, "journal_mode", _tmp5_);
 
2864
        _tmp9_ = value;
 
2865
        _tmp10_ = sql_heavy_journal_mode_to_string (_tmp9_);
 
2866
        sql_heavy_database_pragma_set_string (self, "journal_mode", _tmp10_);
2267
2867
        g_object_notify ((GObject *) self, "journal-mode");
2268
2868
}
2269
2869
 
2270
2870
 
2271
2871
gint sql_heavy_database_get_journal_size_limit (SQLHeavyDatabase* self) {
2272
2872
        gint result;
2273
 
        gint _tmp0_;
 
2873
        gint _tmp0_ = 0;
2274
2874
        g_return_val_if_fail (self != NULL, 0);
2275
2875
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "journal_size_limit");
2276
2876
        result = _tmp0_;
2279
2879
 
2280
2880
 
2281
2881
void sql_heavy_database_set_journal_size_limit (SQLHeavyDatabase* self, gint value) {
 
2882
        gint _tmp0_;
2282
2883
        g_return_if_fail (self != NULL);
2283
 
        sql_heavy_database_pragma_set_int (self, "journal_size_limit", value);
 
2884
        _tmp0_ = value;
 
2885
        sql_heavy_database_pragma_set_int (self, "journal_size_limit", _tmp0_);
2284
2886
        g_object_notify ((GObject *) self, "journal-size-limit");
2285
2887
}
2286
2888
 
2287
2889
 
2288
2890
gboolean sql_heavy_database_get_legacy_file_format (SQLHeavyDatabase* self) {
2289
2891
        gboolean result;
2290
 
        gboolean _tmp0_;
 
2892
        gboolean _tmp0_ = FALSE;
2291
2893
        g_return_val_if_fail (self != NULL, FALSE);
2292
2894
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "legacy_file_format");
2293
2895
        result = _tmp0_;
2296
2898
 
2297
2899
 
2298
2900
void sql_heavy_database_set_legacy_file_format (SQLHeavyDatabase* self, gboolean value) {
 
2901
        gboolean _tmp0_;
2299
2902
        g_return_if_fail (self != NULL);
2300
 
        sql_heavy_database_pragma_set_bool (self, "legacy_file_format", value);
 
2903
        _tmp0_ = value;
 
2904
        sql_heavy_database_pragma_set_bool (self, "legacy_file_format", _tmp0_);
2301
2905
        g_object_notify ((GObject *) self, "legacy-file-format");
2302
2906
}
2303
2907
 
2306
2910
        SQLHeavyLockingMode result;
2307
2911
        gchar* _tmp0_ = NULL;
2308
2912
        gchar* _tmp1_;
2309
 
        SQLHeavyLockingMode _tmp2_;
 
2913
        SQLHeavyLockingMode _tmp2_ = 0;
2310
2914
        SQLHeavyLockingMode _tmp3_;
2311
2915
        g_return_val_if_fail (self != NULL, 0);
2312
2916
        _tmp0_ = sql_heavy_database_pragma_get_string (self, "locking_mode");
2320
2924
 
2321
2925
 
2322
2926
void sql_heavy_database_set_locking_mode (SQLHeavyDatabase* self, SQLHeavyLockingMode value) {
2323
 
        const gchar* _tmp0_ = NULL;
 
2927
        SQLHeavyLockingMode _tmp0_;
 
2928
        const gchar* _tmp1_ = NULL;
2324
2929
        g_return_if_fail (self != NULL);
2325
 
        _tmp0_ = sql_heavy_locking_mode_to_string (value);
2326
 
        sql_heavy_database_pragma_set_string (self, "locking_mode", _tmp0_);
 
2930
        _tmp0_ = value;
 
2931
        _tmp1_ = sql_heavy_locking_mode_to_string (_tmp0_);
 
2932
        sql_heavy_database_pragma_set_string (self, "locking_mode", _tmp1_);
2327
2933
        g_object_notify ((GObject *) self, "locking-mode");
2328
2934
}
2329
2935
 
2330
2936
 
2331
2937
gint sql_heavy_database_get_page_size (SQLHeavyDatabase* self) {
2332
2938
        gint result;
2333
 
        gint _tmp0_;
 
2939
        gint _tmp0_ = 0;
2334
2940
        g_return_val_if_fail (self != NULL, 0);
2335
2941
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "page_size");
2336
2942
        result = _tmp0_;
2339
2945
 
2340
2946
 
2341
2947
void sql_heavy_database_set_page_size (SQLHeavyDatabase* self, gint value) {
 
2948
        gint _tmp0_;
 
2949
        gint _tmp1_;
 
2950
        gint _tmp2_;
2342
2951
        g_return_if_fail (self != NULL);
2343
 
        if ((value & (value - 1)) != 0) {
 
2952
        _tmp0_ = value;
 
2953
        _tmp1_ = value;
 
2954
        if ((_tmp0_ & (_tmp1_ - 1)) != 0) {
2344
2955
                g_critical ("sqlheavy-database.vala:632: Page size must be a power of two.");
2345
2956
        }
2346
 
        sql_heavy_database_pragma_set_int (self, "page_size", value);
 
2957
        _tmp2_ = value;
 
2958
        sql_heavy_database_pragma_set_int (self, "page_size", _tmp2_);
2347
2959
        g_object_notify ((GObject *) self, "page-size");
2348
2960
}
2349
2961
 
2350
2962
 
2351
2963
gint sql_heavy_database_get_max_page_count (SQLHeavyDatabase* self) {
2352
2964
        gint result;
2353
 
        gint _tmp0_;
 
2965
        gint _tmp0_ = 0;
2354
2966
        g_return_val_if_fail (self != NULL, 0);
2355
2967
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "max_page_count");
2356
2968
        result = _tmp0_;
2359
2971
 
2360
2972
 
2361
2973
void sql_heavy_database_set_max_page_count (SQLHeavyDatabase* self, gint value) {
 
2974
        gint _tmp0_;
2362
2975
        g_return_if_fail (self != NULL);
2363
 
        sql_heavy_database_pragma_set_int (self, "max_page_count", value);
 
2976
        _tmp0_ = value;
 
2977
        sql_heavy_database_pragma_set_int (self, "max_page_count", _tmp0_);
2364
2978
        g_object_notify ((GObject *) self, "max-page-count");
2365
2979
}
2366
2980
 
2367
2981
 
2368
2982
gboolean sql_heavy_database_get_read_uncommitted (SQLHeavyDatabase* self) {
2369
2983
        gboolean result;
2370
 
        gboolean _tmp0_;
 
2984
        gboolean _tmp0_ = FALSE;
2371
2985
        g_return_val_if_fail (self != NULL, FALSE);
2372
2986
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "read_uncommitted");
2373
2987
        result = _tmp0_;
2376
2990
 
2377
2991
 
2378
2992
void sql_heavy_database_set_read_uncommitted (SQLHeavyDatabase* self, gboolean value) {
 
2993
        gboolean _tmp0_;
2379
2994
        g_return_if_fail (self != NULL);
2380
 
        sql_heavy_database_pragma_set_bool (self, "read_uncommitted", value);
 
2995
        _tmp0_ = value;
 
2996
        sql_heavy_database_pragma_set_bool (self, "read_uncommitted", _tmp0_);
2381
2997
        g_object_notify ((GObject *) self, "read-uncommitted");
2382
2998
}
2383
2999
 
2384
3000
 
2385
3001
gboolean sql_heavy_database_get_recursive_triggers (SQLHeavyDatabase* self) {
2386
3002
        gboolean result;
2387
 
        gboolean _tmp0_;
 
3003
        gboolean _tmp0_ = FALSE;
2388
3004
        g_return_val_if_fail (self != NULL, FALSE);
2389
3005
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "recursive_triggers");
2390
3006
        result = _tmp0_;
2393
3009
 
2394
3010
 
2395
3011
void sql_heavy_database_set_recursive_triggers (SQLHeavyDatabase* self, gboolean value) {
 
3012
        gboolean _tmp0_;
2396
3013
        g_return_if_fail (self != NULL);
2397
 
        sql_heavy_database_pragma_set_bool (self, "recursive_triggers", value);
 
3014
        _tmp0_ = value;
 
3015
        sql_heavy_database_pragma_set_bool (self, "recursive_triggers", _tmp0_);
2398
3016
        g_object_notify ((GObject *) self, "recursive-triggers");
2399
3017
}
2400
3018
 
2401
3019
 
2402
3020
gboolean sql_heavy_database_get_reverse_unordered_selects (SQLHeavyDatabase* self) {
2403
3021
        gboolean result;
2404
 
        gboolean _tmp0_;
 
3022
        gboolean _tmp0_ = FALSE;
2405
3023
        g_return_val_if_fail (self != NULL, FALSE);
2406
3024
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "reverse_unordered_selects");
2407
3025
        result = _tmp0_;
2410
3028
 
2411
3029
 
2412
3030
void sql_heavy_database_set_reverse_unordered_selects (SQLHeavyDatabase* self, gboolean value) {
 
3031
        gboolean _tmp0_;
2413
3032
        g_return_if_fail (self != NULL);
2414
 
        sql_heavy_database_pragma_set_bool (self, "reverse_unordered_selects", value);
 
3033
        _tmp0_ = value;
 
3034
        sql_heavy_database_pragma_set_bool (self, "reverse_unordered_selects", _tmp0_);
2415
3035
        g_object_notify ((GObject *) self, "reverse-unordered-selects");
2416
3036
}
2417
3037
 
2418
3038
 
2419
3039
gboolean sql_heavy_database_get_short_column_names (SQLHeavyDatabase* self) {
2420
3040
        gboolean result;
2421
 
        gboolean _tmp0_;
 
3041
        gboolean _tmp0_ = FALSE;
2422
3042
        g_return_val_if_fail (self != NULL, FALSE);
2423
3043
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "short_column_names");
2424
3044
        result = _tmp0_;
2427
3047
 
2428
3048
 
2429
3049
void sql_heavy_database_set_short_column_names (SQLHeavyDatabase* self, gboolean value) {
 
3050
        gboolean _tmp0_;
2430
3051
        g_return_if_fail (self != NULL);
2431
 
        sql_heavy_database_pragma_set_bool (self, "short_column_names", value);
 
3052
        _tmp0_ = value;
 
3053
        sql_heavy_database_pragma_set_bool (self, "short_column_names", _tmp0_);
2432
3054
        g_object_notify ((GObject *) self, "short-column-names");
2433
3055
}
2434
3056
 
2437
3059
        SQLHeavySynchronousMode result;
2438
3060
        gchar* _tmp0_ = NULL;
2439
3061
        gchar* _tmp1_;
2440
 
        SQLHeavySynchronousMode _tmp2_;
 
3062
        SQLHeavySynchronousMode _tmp2_ = 0;
2441
3063
        SQLHeavySynchronousMode _tmp3_;
2442
3064
        g_return_val_if_fail (self != NULL, 0);
2443
3065
        _tmp0_ = sql_heavy_database_pragma_get_string (self, "synchronous");
2451
3073
 
2452
3074
 
2453
3075
void sql_heavy_database_set_synchronous (SQLHeavyDatabase* self, SQLHeavySynchronousMode value) {
2454
 
        const gchar* _tmp0_ = NULL;
 
3076
        SQLHeavySynchronousMode _tmp0_;
 
3077
        const gchar* _tmp1_ = NULL;
2455
3078
        g_return_if_fail (self != NULL);
2456
 
        _tmp0_ = sql_heavy_synchronous_mode_to_string (value);
2457
 
        sql_heavy_database_pragma_set_string (self, "synchronous", _tmp0_);
 
3079
        _tmp0_ = value;
 
3080
        _tmp1_ = sql_heavy_synchronous_mode_to_string (_tmp0_);
 
3081
        sql_heavy_database_pragma_set_string (self, "synchronous", _tmp1_);
2458
3082
        g_object_notify ((GObject *) self, "synchronous");
2459
3083
}
2460
3084
 
2463
3087
        SQLHeavyTempStoreMode result;
2464
3088
        gchar* _tmp0_ = NULL;
2465
3089
        gchar* _tmp1_;
2466
 
        SQLHeavyTempStoreMode _tmp2_;
 
3090
        SQLHeavyTempStoreMode _tmp2_ = 0;
2467
3091
        SQLHeavyTempStoreMode _tmp3_;
2468
3092
        g_return_val_if_fail (self != NULL, 0);
2469
3093
        _tmp0_ = sql_heavy_database_pragma_get_string (self, "temp_store");
2477
3101
 
2478
3102
 
2479
3103
void sql_heavy_database_set_temp_store (SQLHeavyDatabase* self, SQLHeavyTempStoreMode value) {
2480
 
        const gchar* _tmp0_ = NULL;
 
3104
        SQLHeavyTempStoreMode _tmp0_;
 
3105
        const gchar* _tmp1_ = NULL;
2481
3106
        g_return_if_fail (self != NULL);
2482
 
        _tmp0_ = sql_heavy_temp_store_mode_to_string (value);
2483
 
        sql_heavy_database_pragma_set_string (self, "temp_store", _tmp0_);
 
3107
        _tmp0_ = value;
 
3108
        _tmp1_ = sql_heavy_temp_store_mode_to_string (_tmp0_);
 
3109
        sql_heavy_database_pragma_set_string (self, "temp_store", _tmp1_);
2484
3110
        g_object_notify ((GObject *) self, "temp-store");
2485
3111
}
2486
3112
 
2496
3122
 
2497
3123
 
2498
3124
void sql_heavy_database_set_temp_store_directory (SQLHeavyDatabase* self, const gchar* value) {
 
3125
        const gchar* _tmp0_;
2499
3126
        g_return_if_fail (self != NULL);
2500
 
        sql_heavy_database_pragma_set_string (self, "temp_store_directory", value);
 
3127
        _tmp0_ = value;
 
3128
        sql_heavy_database_pragma_set_string (self, "temp_store_directory", _tmp0_);
2501
3129
        g_object_notify ((GObject *) self, "temp-store-directory");
2502
3130
}
2503
3131
 
2504
3132
 
2505
3133
gint sql_heavy_database_get_free_list_count (SQLHeavyDatabase* self) {
2506
3134
        gint result;
2507
 
        gint _tmp0_;
 
3135
        gint _tmp0_ = 0;
2508
3136
        g_return_val_if_fail (self != NULL, 0);
2509
3137
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "freelist_count");
2510
3138
        result = _tmp0_;
2514
3142
 
2515
3143
gint sql_heavy_database_get_page_count (SQLHeavyDatabase* self) {
2516
3144
        gint result;
2517
 
        gint _tmp0_;
 
3145
        gint _tmp0_ = 0;
2518
3146
        g_return_val_if_fail (self != NULL, 0);
2519
3147
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "page_count");
2520
3148
        result = _tmp0_;
2523
3151
 
2524
3152
 
2525
3153
void sql_heavy_database_set_page_count (SQLHeavyDatabase* self, gint value) {
 
3154
        gint _tmp0_;
2526
3155
        g_return_if_fail (self != NULL);
2527
 
        sql_heavy_database_pragma_set_int (self, "page_count", value);
 
3156
        _tmp0_ = value;
 
3157
        sql_heavy_database_pragma_set_int (self, "page_count", _tmp0_);
2528
3158
        g_object_notify ((GObject *) self, "page-count");
2529
3159
}
2530
3160
 
2531
3161
 
2532
3162
gint sql_heavy_database_get_schema_version (SQLHeavyDatabase* self) {
2533
3163
        gint result;
2534
 
        gint _tmp0_;
 
3164
        gint _tmp0_ = 0;
2535
3165
        g_return_val_if_fail (self != NULL, 0);
2536
3166
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "schema_version");
2537
3167
        result = _tmp0_;
2540
3170
 
2541
3171
 
2542
3172
void sql_heavy_database_set_schema_version (SQLHeavyDatabase* self, gint value) {
 
3173
        gint _tmp0_;
2543
3174
        g_return_if_fail (self != NULL);
2544
 
        sql_heavy_database_pragma_set_int (self, "schema_version", value);
 
3175
        _tmp0_ = value;
 
3176
        sql_heavy_database_pragma_set_int (self, "schema_version", _tmp0_);
2545
3177
        g_object_notify ((GObject *) self, "schema-version");
2546
3178
}
2547
3179
 
2548
3180
 
2549
3181
gboolean sql_heavy_database_get_secure_delete (SQLHeavyDatabase* self) {
2550
3182
        gboolean result;
2551
 
        gboolean _tmp0_;
 
3183
        gboolean _tmp0_ = FALSE;
2552
3184
        g_return_val_if_fail (self != NULL, FALSE);
2553
3185
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "secure_delete");
2554
3186
        result = _tmp0_;
2557
3189
 
2558
3190
 
2559
3191
void sql_heavy_database_set_secure_delete (SQLHeavyDatabase* self, gboolean value) {
 
3192
        gboolean _tmp0_;
2560
3193
        g_return_if_fail (self != NULL);
2561
 
        sql_heavy_database_pragma_set_bool (self, "secure_delete", value);
 
3194
        _tmp0_ = value;
 
3195
        sql_heavy_database_pragma_set_bool (self, "secure_delete", _tmp0_);
2562
3196
        g_object_notify ((GObject *) self, "secure-delete");
2563
3197
}
2564
3198
 
2565
3199
 
2566
3200
gint sql_heavy_database_get_user_version (SQLHeavyDatabase* self) {
2567
3201
        gint result;
2568
 
        gint _tmp0_;
 
3202
        gint _tmp0_ = 0;
2569
3203
        g_return_val_if_fail (self != NULL, 0);
2570
3204
        _tmp0_ = sql_heavy_database_pragma_get_int (self, "user_version");
2571
3205
        result = _tmp0_;
2574
3208
 
2575
3209
 
2576
3210
void sql_heavy_database_set_user_version (SQLHeavyDatabase* self, gint value) {
 
3211
        gint _tmp0_;
2577
3212
        g_return_if_fail (self != NULL);
2578
 
        sql_heavy_database_pragma_set_int (self, "user_version", value);
 
3213
        _tmp0_ = value;
 
3214
        sql_heavy_database_pragma_set_int (self, "user_version", _tmp0_);
2579
3215
        g_object_notify ((GObject *) self, "user-version");
2580
3216
}
2581
3217
 
2582
3218
 
2583
3219
gboolean sql_heavy_database_get_parser_trace (SQLHeavyDatabase* self) {
2584
3220
        gboolean result;
2585
 
        gboolean _tmp0_;
 
3221
        gboolean _tmp0_ = FALSE;
2586
3222
        g_return_val_if_fail (self != NULL, FALSE);
2587
3223
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "parser_trace");
2588
3224
        result = _tmp0_;
2591
3227
 
2592
3228
 
2593
3229
void sql_heavy_database_set_parser_trace (SQLHeavyDatabase* self, gboolean value) {
 
3230
        gboolean _tmp0_;
2594
3231
        g_return_if_fail (self != NULL);
2595
 
        sql_heavy_database_pragma_set_bool (self, "parser_trace", value);
 
3232
        _tmp0_ = value;
 
3233
        sql_heavy_database_pragma_set_bool (self, "parser_trace", _tmp0_);
2596
3234
        g_object_notify ((GObject *) self, "parser-trace");
2597
3235
}
2598
3236
 
2599
3237
 
2600
3238
gboolean sql_heavy_database_get_vdbe_trace (SQLHeavyDatabase* self) {
2601
3239
        gboolean result;
2602
 
        gboolean _tmp0_;
 
3240
        gboolean _tmp0_ = FALSE;
2603
3241
        g_return_val_if_fail (self != NULL, FALSE);
2604
3242
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "vdbe_trace");
2605
3243
        result = _tmp0_;
2608
3246
 
2609
3247
 
2610
3248
void sql_heavy_database_set_vdbe_trace (SQLHeavyDatabase* self, gboolean value) {
 
3249
        gboolean _tmp0_;
2611
3250
        g_return_if_fail (self != NULL);
2612
 
        sql_heavy_database_pragma_set_bool (self, "vdbe_trace", value);
 
3251
        _tmp0_ = value;
 
3252
        sql_heavy_database_pragma_set_bool (self, "vdbe_trace", _tmp0_);
2613
3253
        g_object_notify ((GObject *) self, "vdbe-trace");
2614
3254
}
2615
3255
 
2616
3256
 
2617
3257
gboolean sql_heavy_database_get_vdbe_listing (SQLHeavyDatabase* self) {
2618
3258
        gboolean result;
2619
 
        gboolean _tmp0_;
 
3259
        gboolean _tmp0_ = FALSE;
2620
3260
        g_return_val_if_fail (self != NULL, FALSE);
2621
3261
        _tmp0_ = sql_heavy_database_pragma_get_bool (self, "vdbe_listing");
2622
3262
        result = _tmp0_;
2625
3265
 
2626
3266
 
2627
3267
void sql_heavy_database_set_vdbe_listing (SQLHeavyDatabase* self, gboolean value) {
 
3268
        gboolean _tmp0_;
2628
3269
        g_return_if_fail (self != NULL);
2629
 
        sql_heavy_database_pragma_set_bool (self, "vdbe_listing", value);
 
3270
        _tmp0_ = value;
 
3271
        sql_heavy_database_pragma_set_bool (self, "vdbe_listing", _tmp0_);
2630
3272
        g_object_notify ((GObject *) self, "vdbe-listing");
2631
3273
}
2632
3274
 
2633
3275
 
2634
3276
static void sql_heavy_database_real_wal_committed (SQLHeavyDatabase* self, const gchar* db_name, gint pages) {
2635
3277
        gboolean _tmp0_ = FALSE;
2636
 
        g_return_if_fail (self != NULL);
 
3278
        gint _tmp1_;
 
3279
        gboolean _tmp4_;
2637
3280
        g_return_if_fail (db_name != NULL);
2638
 
        if (self->priv->_wal_auto_checkpoint > 0) {
2639
 
                _tmp0_ = self->priv->_wal_auto_checkpoint <= pages;
 
3281
        _tmp1_ = self->priv->_wal_auto_checkpoint;
 
3282
        if (_tmp1_ > 0) {
 
3283
                gint _tmp2_;
 
3284
                gint _tmp3_;
 
3285
                _tmp2_ = self->priv->_wal_auto_checkpoint;
 
3286
                _tmp3_ = pages;
 
3287
                _tmp0_ = _tmp2_ <= _tmp3_;
2640
3288
        } else {
2641
3289
                _tmp0_ = FALSE;
2642
3290
        }
2643
 
        if (_tmp0_) {
 
3291
        _tmp4_ = _tmp0_;
 
3292
        if (_tmp4_) {
2644
3293
                sql_heavy_database_try_wal_checkpoint (self);
2645
3294
        }
2646
3295
}
2650
3299
        typedef void (*GMarshalFunc_VOID__STRING_INT) (gpointer data1, const char* arg_1, gint arg_2, gpointer data2);
2651
3300
        register GMarshalFunc_VOID__STRING_INT callback;
2652
3301
        register GCClosure * cc;
2653
 
        register gpointer data1, data2;
 
3302
        register gpointer data1;
 
3303
        register gpointer data2;
2654
3304
        cc = (GCClosure *) closure;
2655
3305
        g_return_if_fail (n_param_values == 3);
2656
3306
        if (G_CCLOSURE_SWAP_DATA (closure)) {
2680
3330
        /**
2681
3331
             * {@inheritDoc}
2682
3332
             */
2683
 
        g_object_class_override_property (G_OBJECT_CLASS (klass), SQL_HEAVY_DATABASE_DATABASE, "database");
 
3333
        g_object_class_install_property (G_OBJECT_CLASS (klass), SQL_HEAVY_DATABASE_DATABASE, g_param_spec_object ("database", "database", "database", SQL_HEAVY_TYPE_DATABASE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2684
3334
        /**
2685
3335
             * Database to store profiling data in.
2686
3336
             *
3008
3658
        sql_heavy_database_sql_heavy_queryable_parent_iface = g_type_interface_peek_parent (iface);
3009
3659
        iface->lock = (void (*)(SQLHeavyQueryable*)) sql_heavy_database_real_lock;
3010
3660
        iface->unlock = (void (*)(SQLHeavyQueryable*)) sql_heavy_database_real_unlock;
3011
 
        iface->queue = (void (*)(SQLHeavyQueryable* ,SQLHeavyQuery* ,GError**)) sql_heavy_database_real_queue;
 
3661
        iface->queue = (void (*)(SQLHeavyQueryable*, SQLHeavyQuery*, GError**)) sql_heavy_database_real_queue;
3012
3662
        iface->get_database = sql_heavy_database_real_get_database;
3013
3663
}
3014
3664
 
3015
3665
 
3016
3666
static void sql_heavy_database_g_initable_interface_init (GInitableIface * iface) {
3017
3667
        sql_heavy_database_g_initable_parent_iface = g_type_interface_peek_parent (iface);
3018
 
        iface->init = (gboolean (*)(GInitable* ,GCancellable* ,GError**)) sql_heavy_database_init;
 
3668
        iface->init = (gboolean (*)(GInitable*, GCancellable*, GError**)) sql_heavy_database_init;
3019
3669
}
3020
3670
 
3021
3671
 
3022
3672
static void sql_heavy_database_instance_init (SQLHeavyDatabase * self) {
3023
 
        GHashTable* _tmp0_ = NULL;
3024
 
        sqlite3_mutex* _tmp1_ = NULL;
3025
 
        GSequence* _tmp2_ = NULL;
3026
 
        gchar* _tmp3_;
 
3673
        GHashFunc _tmp0_;
 
3674
        GEqualFunc _tmp1_;
 
3675
        GDestroyNotify _tmp2_;
 
3676
        GDestroyNotify _tmp3_;
 
3677
        GHashTable* _tmp4_;
 
3678
        sqlite3_mutex* _tmp5_;
 
3679
        GSequence* _tmp6_;
 
3680
        gchar* _tmp7_;
3027
3681
        self->priv = SQL_HEAVY_DATABASE_GET_PRIVATE (self);
3028
 
        _tmp0_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
3029
 
        self->priv->user_functions = _tmp0_;
 
3682
        _tmp0_ = g_str_hash;
 
3683
        _tmp1_ = g_str_equal;
 
3684
        _tmp2_ = g_free;
 
3685
        _tmp3_ = g_object_unref;
 
3686
        _tmp4_ = g_hash_table_new_full (_tmp0_, _tmp1_, _tmp2_, _tmp3_);
 
3687
        self->priv->user_functions = _tmp4_;
3030
3688
        g_static_rec_mutex_init (&self->priv->__lock_orm_tables);
3031
3689
        self->priv->orm_tables = NULL;
3032
3690
        self->priv->_wal_auto_checkpoint = 10;
3033
3691
        self->priv->db = NULL;
3034
 
        _tmp1_ = sqlite3_mutex_alloc (SQLITE_MUTEX_FAST);
3035
 
        self->priv->_transaction_lock = _tmp1_;
 
3692
        _tmp5_ = sqlite3_mutex_alloc (SQLITE_MUTEX_FAST);
 
3693
        self->priv->_transaction_lock = _tmp5_;
3036
3694
        g_static_rec_mutex_init (&self->priv->__lock__queue);
3037
3695
        self->priv->_queue = NULL;
3038
3696
        self->priv->_step_lock = NULL;
3039
3697
        g_static_rec_mutex_init (&self->priv->__lock_needs_update_on_step_unlock);
3040
 
        _tmp2_ = g_sequence_new (g_object_unref);
3041
 
        self->priv->needs_update_on_step_unlock = _tmp2_;
 
3698
        _tmp6_ = g_sequence_new (_g_object_unref0_);
 
3699
        self->priv->needs_update_on_step_unlock = _tmp6_;
3042
3700
        self->priv->_profiling_data = NULL;
3043
 
        _tmp3_ = g_strdup (":memory:");
3044
 
        self->priv->_filename = _tmp3_;
 
3701
        _tmp7_ = g_strdup (":memory:");
 
3702
        self->priv->_filename = _tmp7_;
3045
3703
        self->priv->_mode = (SQL_HEAVY_FILE_MODE_READ | SQL_HEAVY_FILE_MODE_WRITE) | SQL_HEAVY_FILE_MODE_CREATE;
3046
3704
}
3047
3705
 
3048
3706
 
3049
3707
static void sql_heavy_database_finalize (GObject* obj) {
3050
3708
        SQLHeavyDatabase * self;
3051
 
        GList* _tmp0_ = NULL;
 
3709
        GHashTable* _tmp0_;
 
3710
        GList* _tmp1_ = NULL;
3052
3711
        self = SQL_HEAVY_DATABASE (obj);
3053
 
        _tmp0_ = g_hash_table_get_values (self->priv->user_functions);
 
3712
        _tmp0_ = self->priv->user_functions;
 
3713
        _tmp1_ = g_hash_table_get_values (_tmp0_);
3054
3714
        {
3055
 
                GList* udf_collection;
3056
 
                GList* udf_it;
3057
 
                udf_collection = _tmp0_;
 
3715
                GList* udf_collection = NULL;
 
3716
                GList* udf_it = NULL;
 
3717
                udf_collection = _tmp1_;
3058
3718
                for (udf_it = udf_collection; udf_it != NULL; udf_it = udf_it->next) {
3059
 
                        SQLHeavyUserFunctionUserFuncData* udf;
 
3719
                        SQLHeavyUserFunctionUserFuncData* udf = NULL;
3060
3720
                        udf = (SQLHeavyUserFunctionUserFuncData*) udf_it->data;
3061
3721
                        {
3062
 
                                sql_heavy_database_unregister_function_context (self, udf);
 
3722
                                SQLHeavyUserFunctionUserFuncData* _tmp2_;
 
3723
                                _tmp2_ = udf;
 
3724
                                sql_heavy_database_unregister_function_context (self, _tmp2_);
3063
3725
                        }
3064
3726
                }
3065
3727
                _g_list_free0 (udf_collection);