| 44 | |
| 45 | |
| 46 | sqlite3* SMSCBConnectDatabase(const char* path, sqlite3 **DB) |
| 47 | { |
| 48 | int rc = sqlite3_open(path,DB); |
| 49 | if (rc) { |
| 50 | LOG(EMERG) << "Cannot open SMSCB database on path " << path << ": " << sqlite3_errmsg(*DB); |
| 51 | sqlite3_close(*DB); |
| 52 | *DB = NULL; |
| 53 | return NULL; |
| 54 | } |
| 55 | if (!sqlite3_command(*DB,createSMSCBTable)) { |
| 56 | LOG(EMERG) << "Cannot create SMSCB table"; |
| 57 | return NULL; |
| 58 | } |
| 59 | // Set high-concurrency WAL mode. |
| 60 | if (!sqlite3_command(*DB,enableWAL)) { |
| 61 | LOG(EMERG) << "Cannot enable WAL mode on database at " << path << ", error message: " << sqlite3_errmsg(*DB); |
| 62 | } |
| 63 | return *DB; |
| 64 | } |
| 65 | |
| 66 | |
| 67 | void encode7(char mc, int &shift, unsigned int &dp, int &buf, char *thisPage) |