1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
|
/* orm.c generated by valac 0.16.0, the Vala compiler
* generated from orm.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <SQLHeavy.h>
#include <float.h>
#include <math.h>
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_rand_free0(var) ((var == NULL) ? NULL : (var = (g_rand_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
gint _vala_main (gchar** args, int args_length1);
static void ___lambda2_ (const gchar* sql);
static void ____lambda2__sql_heavy_database_sql_executed (SQLHeavyDatabase* _sender, const gchar* sql, gpointer self);
static void ___lambda2_ (const gchar* sql) {
const gchar* _tmp0_;
g_return_if_fail (sql != NULL);
_tmp0_ = sql;
g_debug ("orm.vala:4: :: %s", _tmp0_);
}
static void ____lambda2__sql_heavy_database_sql_executed (SQLHeavyDatabase* _sender, const gchar* sql, gpointer self) {
___lambda2_ (sql);
}
gint _vala_main (gchar** args, int args_length1) {
gint result = 0;
GError * _inner_error_ = NULL;
{
SQLHeavyDatabase* _tmp0_;
SQLHeavyDatabase* db;
SQLHeavyDatabase* _tmp1_;
SQLHeavyDatabase* _tmp2_;
SQLHeavyQueryResult* _tmp3_ = NULL;
SQLHeavyQueryResult* _tmp4_;
SQLHeavyDatabase* _tmp5_;
SQLHeavyTable* _tmp6_;
SQLHeavyTable* table;
SQLHeavyTable* _tmp7_;
SQLHeavyRow* _tmp8_;
SQLHeavyRow* row;
GRand* _tmp9_;
GRand* prng;
SQLHeavyRow* _tmp10_;
GRand* _tmp11_;
gdouble _tmp12_ = 0.0;
SQLHeavyRow* _tmp13_;
SQLHeavyRow* _tmp14_;
gdouble _tmp15_ = 0.0;
gdouble _tmp16_;
SQLHeavyRow* _tmp17_;
GRand* _tmp18_;
gdouble _tmp19_ = 0.0;
GValue _tmp20_ = {0};
SQLHeavyRow* _tmp21_;
gdouble _tmp22_ = 0.0;
gdouble _tmp23_;
SQLHeavyRow* _tmp24_;
SQLHeavyRow* _tmp25_;
GValue* _tmp26_ = NULL;
GValue* _tmp27_;
SQLHeavyRow* _tmp28_;
gint64 _tmp29_;
gint64 _tmp30_;
gint64 row_id;
SQLHeavyTable* _tmp31_;
gint64 _tmp32_;
SQLHeavyRow* _tmp33_ = NULL;
SQLHeavyRow* _tmp34_;
SQLHeavyRow* _tmp35_;
GRand* _tmp36_;
gdouble _tmp37_ = 0.0;
GValue _tmp38_ = {0};
SQLHeavyTable* _tmp39_;
gint64 _tmp40_;
SQLHeavyRow* _tmp41_ = NULL;
SQLHeavyRow* _tmp42_;
SQLHeavyRow* _tmp43_;
GValue* _tmp44_ = NULL;
GValue* _tmp45_;
GValue* _tmp46_;
_tmp0_ = sql_heavy_database_new (NULL, (SQL_HEAVY_FILE_MODE_READ | SQL_HEAVY_FILE_MODE_WRITE) | SQL_HEAVY_FILE_MODE_CREATE, &_inner_error_);
db = _tmp0_;
if (_inner_error_ != NULL) {
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp1_ = db;
g_signal_connect (_tmp1_, "sql-executed", (GCallback) ____lambda2__sql_heavy_database_sql_executed, NULL);
_tmp2_ = db;
_tmp3_ = sql_heavy_queryable_execute ((SQLHeavyQueryable*) _tmp2_, "CREATE TABLE `foo` ( `bar` FLOAT );", &_inner_error_, NULL);
_tmp4_ = _tmp3_;
_g_object_unref0 (_tmp4_);
if (_inner_error_ != NULL) {
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp5_ = db;
_tmp6_ = sql_heavy_table_new ((SQLHeavyQueryable*) _tmp5_, "foo", &_inner_error_);
table = _tmp6_;
if (_inner_error_ != NULL) {
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp7_ = table;
_tmp8_ = sql_heavy_row_new (_tmp7_, (gint64) 0);
row = _tmp8_;
_tmp9_ = g_rand_new ();
prng = _tmp9_;
_tmp10_ = row;
_tmp11_ = prng;
_tmp12_ = g_rand_double (_tmp11_);
sql_heavy_mutable_record_set_double ((SQLHeavyMutableRecord*) _tmp10_, "bar", _tmp12_, &_inner_error_);
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp13_ = row;
sql_heavy_mutable_record_save ((SQLHeavyMutableRecord*) _tmp13_, &_inner_error_);
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp14_ = row;
_tmp15_ = sql_heavy_record_get_double ((SQLHeavyRecord*) _tmp14_, "bar", &_inner_error_);
_tmp16_ = _tmp15_;
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
g_debug ("orm.vala:14: bar = %g", _tmp16_);
_tmp17_ = row;
_tmp18_ = prng;
_tmp19_ = g_rand_double (_tmp18_);
g_value_init (&_tmp20_, G_TYPE_DOUBLE);
g_value_set_double (&_tmp20_, _tmp19_);
sql_heavy_mutable_record_set ((SQLHeavyMutableRecord*) _tmp17_, "bar", &_tmp20_, &_inner_error_);
G_IS_VALUE (&_tmp20_) ? (g_value_unset (&_tmp20_), NULL) : NULL;
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp21_ = row;
_tmp22_ = sql_heavy_record_get_double ((SQLHeavyRecord*) _tmp21_, "bar", &_inner_error_);
_tmp23_ = _tmp22_;
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
g_debug ("orm.vala:19: bar = %g", _tmp23_);
_tmp24_ = row;
sql_heavy_mutable_record_save ((SQLHeavyMutableRecord*) _tmp24_, &_inner_error_);
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp25_ = row;
_tmp26_ = sql_heavy_record_get ((SQLHeavyRecord*) _tmp25_, "bar", &_inner_error_);
_tmp27_ = _tmp26_;
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
g_debug ("orm.vala:22: bar = %g", g_value_get_double (_tmp27_));
_tmp28_ = row;
_tmp29_ = sql_heavy_row_get_id (_tmp28_);
_tmp30_ = _tmp29_;
row_id = _tmp30_;
_tmp31_ = table;
_tmp32_ = row_id;
_tmp33_ = sql_heavy_table_get (_tmp31_, _tmp32_, &_inner_error_);
_tmp34_ = _tmp33_;
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp35_ = _tmp34_;
_tmp36_ = prng;
_tmp37_ = g_rand_double (_tmp36_);
g_value_init (&_tmp38_, G_TYPE_DOUBLE);
g_value_set_double (&_tmp38_, _tmp37_);
sql_heavy_mutable_record_set ((SQLHeavyMutableRecord*) _tmp35_, "bar", &_tmp38_, &_inner_error_);
G_IS_VALUE (&_tmp38_) ? (g_value_unset (&_tmp38_), NULL) : NULL;
_g_object_unref0 (_tmp35_);
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp39_ = table;
_tmp40_ = row_id;
_tmp41_ = sql_heavy_table_get (_tmp39_, _tmp40_, &_inner_error_);
_tmp42_ = _tmp41_;
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
_tmp43_ = _tmp42_;
_tmp44_ = sql_heavy_record_get ((SQLHeavyRecord*) _tmp43_, "bar", &_inner_error_);
_tmp45_ = _tmp44_;
_g_object_unref0 (_tmp43_);
_tmp46_ = _tmp45_;
if (_inner_error_ != NULL) {
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
if (_inner_error_->domain == SQL_HEAVY_ERROR) {
goto __catch0_sql_heavy_error;
}
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
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);
g_clear_error (&_inner_error_);
return 0;
}
g_debug ("orm.vala:26: bar = %g", g_value_get_double (_tmp46_));
_g_rand_free0 (prng);
_g_object_unref0 (row);
_g_object_unref0 (table);
_g_object_unref0 (db);
}
goto __finally0;
__catch0_sql_heavy_error:
{
GError* e = NULL;
const gchar* _tmp47_;
e = _inner_error_;
_inner_error_ = NULL;
_tmp47_ = e->message;
g_error ("orm.vala:28: %s", _tmp47_);
_g_error_free0 (e);
}
__finally0:
if (_inner_error_ != NULL) {
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);
g_clear_error (&_inner_error_);
return 0;
}
result = 0;
return result;
}
int main (int argc, char ** argv) {
g_type_init ();
return _vala_main (argv, argc);
}
|