Add Sqlite_Busy_Timeout

This commit is contained in:
Andrew Pamment
2017-03-22 11:51:04 +10:00
parent 04fdc083ec
commit a16735e27c
10 changed files with 36 additions and 15 deletions

View File

@@ -187,6 +187,7 @@ int main(int argc, char **argv) {
// populate scroll list
rc = sqlite3_open(CDKparamString (&params, 'd'), &db);
if (rc != SQLITE_OK) {
fprintf(stderr, "Cannot open database: %s", sqlite3_errmsg(db));
@@ -195,6 +196,7 @@ int main(int argc, char **argv) {
endCDK();
exit(1);
}
sqlite3_busy_timeout(db, 5000);
rc = sqlite3_prepare_v2(db, sql_read, -1, &res, 0);
if (rc != SQLITE_OK) {

View File

@@ -55,11 +55,12 @@ int main(int argc, char **argv) {
rc = sqlite3_open(argv[3], &db);
if (rc != SQLITE_OK) {
printf("Cannot open database: %s\n", sqlite3_errmsg(db));
exit(1);
}
sqlite3_busy_timeout(db, 5000);
rc = sqlite3_exec(db, create_sql, 0, 0, &err_msg);
if (rc != SQLITE_OK ) {
printf("SQL error: %s\n", err_msg);

View File

@@ -553,10 +553,12 @@ void handle_PASS(struct ftpserver *cfg, struct ftpclient *client, char *password
send_msg(client, "230 User Logged in, Proceed.\r\n");
} else {
rc = sqlite3_open(cfg->userdb, &db);
if (rc != SQLITE_OK) {
fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
exit(-1);
}
sqlite3_busy_timeout(db, 5000);
rc = sqlite3_prepare_v2(db, sql, -1, &res, 0);
if (rc == SQLITE_OK) {

View File

@@ -156,11 +156,12 @@ int add_file(struct ticfile_t *ticfile) {
}
rc = sqlite3_open(conf.file_areas[i]->database, &db);
if (rc != SQLITE_OK) {
fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
return -1;
}
sqlite3_busy_timeout(db, 5000);
rc = sqlite3_exec(db, create_sql, 0, 0, &err_msg);
if (rc != SQLITE_OK) {

View File

@@ -77,7 +77,7 @@ int main(int argc, char **argv) {
printf("Error opening database\n");
return -1;
}
sqlite3_busy_timeout(db, 5000);
rc = sqlite3_exec(db, alter_table_sql, 0, 0, &err_msg);
if (rc != SQLITE_OK ) {