| 45 } |
45 } |
| 46 |
46 |
| 47 DBUConnection *conn = dbuSQLiteConnectionFromDB(db, true); |
47 DBUConnection *conn = dbuSQLiteConnectionFromDB(db, true); |
| 48 if(!conn) { |
48 if(!conn) { |
| 49 sqlite3_close(db); |
49 sqlite3_close(db); |
| 50 } |
50 } else { |
| |
51 if(dbuSqlExec(conn, "PRAGMA foreign_keys = ON;")) { |
| |
52 dbuConnectionFree(conn); |
| |
53 return NULL; |
| |
54 } |
| |
55 } |
| |
56 |
| 51 return conn; |
57 return conn; |
| 52 } |
58 } |
| 53 |
59 |
| 54 DBUConnection* dbuSQLiteConnectionFromDB(sqlite3 *db, bool autoclose) { |
60 DBUConnection* dbuSQLiteConnectionFromDB(sqlite3 *db, bool autoclose) { |
| 55 DBUSQLiteConnection *connection = malloc(sizeof(DBUSQLiteConnection)); |
61 DBUSQLiteConnection *connection = malloc(sizeof(DBUSQLiteConnection)); |