26
26
gboolean sql_heavy_error_if_not_ok (gint ec, SQLHeavyQueryable* queryable, GError** error) {
27
27
gboolean result = FALSE;
28
const gchar* _tmp0_ = NULL;
30
const gchar* _tmp2_ = NULL;
31
34
GError * _inner_error_ = NULL;
32
if (ec == SQLITE_OK) {
36
if (_tmp0_ == SQLITE_OK) {
36
_tmp0_ = sql_heavy_sqlite_errstr (ec);
37
_tmp1_ = g_strdup (_tmp0_);
41
_tmp2_ = sql_heavy_sqlite_errstr (_tmp1_);
42
_tmp3_ = g_strdup (_tmp2_);
42
GError* _tmp2_ = NULL;
43
_tmp2_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ERROR, msg);
44
_inner_error_ = _tmp2_;
45
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
46
g_propagate_error (error, _inner_error_);
51
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);
52
g_clear_error (&_inner_error_);
58
GError* _tmp3_ = NULL;
59
_tmp3_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_INTERNAL, msg);
60
_inner_error_ = _tmp3_;
61
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
62
g_propagate_error (error, _inner_error_);
67
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);
68
g_clear_error (&_inner_error_);
74
GError* _tmp4_ = NULL;
75
_tmp4_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ACCESS_DENIED, msg);
76
_inner_error_ = _tmp4_;
77
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
78
g_propagate_error (error, _inner_error_);
83
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);
84
g_clear_error (&_inner_error_);
90
GError* _tmp5_ = NULL;
91
_tmp5_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ABORTED, msg);
92
_inner_error_ = _tmp5_;
93
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
94
g_propagate_error (error, _inner_error_);
99
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);
100
g_clear_error (&_inner_error_);
106
GError* _tmp6_ = NULL;
107
_tmp6_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_BUSY, msg);
51
_tmp6_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ERROR, _tmp5_);
108
52
_inner_error_ = _tmp6_;
109
53
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
110
54
g_propagate_error (error, _inner_error_);
246
const gchar* _tmp27_;
249
_tmp28_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_FULL, _tmp27_);
250
_inner_error_ = _tmp28_;
251
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
252
g_propagate_error (error, _inner_error_);
257
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);
258
g_clear_error (&_inner_error_);
262
case SQLITE_CANTOPEN:
264
const gchar* _tmp29_;
267
_tmp30_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CAN_NOT_OPEN, _tmp29_);
268
_inner_error_ = _tmp30_;
269
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
270
g_propagate_error (error, _inner_error_);
275
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);
276
g_clear_error (&_inner_error_);
282
const gchar* _tmp31_;
285
_tmp32_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_EMPTY, _tmp31_);
286
_inner_error_ = _tmp32_;
287
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
288
g_propagate_error (error, _inner_error_);
293
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);
294
g_clear_error (&_inner_error_);
300
const gchar* _tmp33_;
303
_tmp34_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_SCHEMA, _tmp33_);
304
_inner_error_ = _tmp34_;
305
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
306
g_propagate_error (error, _inner_error_);
311
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);
312
g_clear_error (&_inner_error_);
318
const gchar* _tmp35_;
321
_tmp36_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_TOO_BIG, _tmp35_);
322
_inner_error_ = _tmp36_;
323
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
324
g_propagate_error (error, _inner_error_);
329
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);
330
g_clear_error (&_inner_error_);
334
case SQLITE_CONSTRAINT:
336
const gchar* _tmp37_;
339
_tmp38_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CONSTRAINT, _tmp37_);
340
_inner_error_ = _tmp38_;
341
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
342
g_propagate_error (error, _inner_error_);
347
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);
348
g_clear_error (&_inner_error_);
352
case SQLITE_MISMATCH:
354
const gchar* _tmp39_;
357
_tmp40_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_MISMATCH, _tmp39_);
358
_inner_error_ = _tmp40_;
359
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
360
g_propagate_error (error, _inner_error_);
365
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);
366
g_clear_error (&_inner_error_);
372
const gchar* _tmp41_;
375
_tmp42_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_MISUSE, _tmp41_);
376
_inner_error_ = _tmp42_;
377
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
378
g_propagate_error (error, _inner_error_);
383
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);
384
g_clear_error (&_inner_error_);
390
const gchar* _tmp43_;
393
_tmp44_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NOLFS, _tmp43_);
394
_inner_error_ = _tmp44_;
395
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
396
g_propagate_error (error, _inner_error_);
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);
402
g_clear_error (&_inner_error_);
408
const gchar* _tmp45_;
411
_tmp46_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_AUTH, _tmp45_);
412
_inner_error_ = _tmp46_;
413
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
414
g_propagate_error (error, _inner_error_);
419
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);
420
g_clear_error (&_inner_error_);
426
const gchar* _tmp47_;
429
_tmp48_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_FORMAT, _tmp47_);
430
_inner_error_ = _tmp48_;
431
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
432
g_propagate_error (error, _inner_error_);
437
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);
438
g_clear_error (&_inner_error_);
444
const gchar* _tmp49_;
447
_tmp50_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_RANGE, _tmp49_);
448
_inner_error_ = _tmp50_;
449
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
450
g_propagate_error (error, _inner_error_);
455
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);
456
g_clear_error (&_inner_error_);
462
const gchar* _tmp51_;
465
_tmp52_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NOTADB, _tmp51_);
466
_inner_error_ = _tmp52_;
467
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
468
g_propagate_error (error, _inner_error_);
473
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);
474
g_clear_error (&_inner_error_);
480
const gchar* _tmp53_;
483
_tmp54_ = g_error_new_literal (SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_UNKNOWN, _tmp53_);
484
_inner_error_ = _tmp54_;
485
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
486
g_propagate_error (error, _inner_error_);
491
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);
492
g_clear_error (&_inner_error_);
456
512
gint sql_heavy_sqlite_code_from_error (GError* e) {
458
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_INTERNAL)) {
516
if (g_error_matches (_tmp0_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_INTERNAL)) {
459
517
result = SQLITE_INTERNAL;
462
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ACCESS_DENIED)) {
522
if (g_error_matches (_tmp1_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ACCESS_DENIED)) {
463
523
result = SQLITE_PERM;
466
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ERROR)) {
528
if (g_error_matches (_tmp2_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ERROR)) {
467
529
result = SQLITE_ERROR;
470
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ABORTED)) {
534
if (g_error_matches (_tmp3_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_ABORTED)) {
471
535
result = SQLITE_ABORT;
474
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_BUSY)) {
540
if (g_error_matches (_tmp4_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_BUSY)) {
475
541
result = SQLITE_BUSY;
478
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_LOCKED)) {
546
if (g_error_matches (_tmp5_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_LOCKED)) {
479
547
result = SQLITE_LOCKED;
482
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NO_MEMORY)) {
552
if (g_error_matches (_tmp6_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NO_MEMORY)) {
483
553
result = SQLITE_NOMEM;
486
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_READ_ONLY)) {
558
if (g_error_matches (_tmp7_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_READ_ONLY)) {
487
559
result = SQLITE_READONLY;
490
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_INTERRUPTED)) {
564
if (g_error_matches (_tmp8_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_INTERRUPTED)) {
491
565
result = SQLITE_INTERRUPT;
494
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_IO)) {
570
if (g_error_matches (_tmp9_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_IO)) {
495
571
result = SQLITE_IOERR;
498
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CORRUPT)) {
576
if (g_error_matches (_tmp10_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CORRUPT)) {
499
577
result = SQLITE_CORRUPT;
502
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_FULL)) {
582
if (g_error_matches (_tmp11_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_FULL)) {
503
583
result = SQLITE_FULL;
506
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CAN_NOT_OPEN)) {
588
if (g_error_matches (_tmp12_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CAN_NOT_OPEN)) {
507
589
result = SQLITE_CANTOPEN;
510
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_EMPTY)) {
594
if (g_error_matches (_tmp13_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_EMPTY)) {
511
595
result = SQLITE_EMPTY;
514
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_SCHEMA)) {
600
if (g_error_matches (_tmp14_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_SCHEMA)) {
515
601
result = SQLITE_SCHEMA;
518
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_TOO_BIG)) {
606
if (g_error_matches (_tmp15_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_TOO_BIG)) {
519
607
result = SQLITE_TOOBIG;
522
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CONSTRAINT)) {
612
if (g_error_matches (_tmp16_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_CONSTRAINT)) {
523
613
result = SQLITE_CONSTRAINT;
526
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_MISMATCH)) {
618
if (g_error_matches (_tmp17_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_MISMATCH)) {
527
619
result = SQLITE_MISMATCH;
530
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_MISUSE)) {
624
if (g_error_matches (_tmp18_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_MISUSE)) {
531
625
result = SQLITE_MISUSE;
534
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NOLFS)) {
630
if (g_error_matches (_tmp19_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NOLFS)) {
535
631
result = SQLITE_NOLFS;
538
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_AUTH)) {
636
if (g_error_matches (_tmp20_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_AUTH)) {
539
637
result = SQLITE_AUTH;
542
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_FORMAT)) {
642
if (g_error_matches (_tmp21_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_FORMAT)) {
543
643
result = SQLITE_FORMAT;
546
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_RANGE)) {
648
if (g_error_matches (_tmp22_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_RANGE)) {
547
649
result = SQLITE_RANGE;
550
if (g_error_matches (e, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NOTADB)) {
654
if (g_error_matches (_tmp23_, SQL_HEAVY_ERROR, SQL_HEAVY_ERROR_NOTADB)) {
551
655
result = SQLITE_NOTADB;