Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set connection parameters #805

Open
JamesMcIntosh opened this issue Oct 22, 2020 · 0 comments
Open

Set connection parameters #805

JamesMcIntosh opened this issue Oct 22, 2020 · 0 comments

Comments

@JamesMcIntosh
Copy link

I am having problems updating the sqlite_master table. My app is built using XCode 12.1 and deployed on iOS 14, in this scenario SQLite has the connection parameter SQLITE_DBCONFIG_DEFENSIVE is enabled by default.

https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive

I need to run the following after a connection has been established to disable the defensive mode.

    int result;
    sqlite3_db_config(_db, SQLITE_DBCONFIG_DEFENSIVE, 0, &result);

Could something similar (I don't know objC well) be added into the library, there are different types of values which can be set depending on the parameter being set as the API is int sqlite3_db_config(sqlite3*, int op, ...).

- (BOOL)setConnectionParameter:(int)parameter value:(...)value {
    int result;
    sqlite3_db_config(_db, parameter, value, &result);
    if( result == SQLITE_OK ){
        NSLog(@"Connection parameter %d updated to %d\n", parameter, result);
        return YES;
    } else {
        NSLog(@"Connection parameter %d NOT updated to %d\n", parameter, result);
        return NO;
    }
}

Example:

[db setConnectionParameter:SQLITE_DBCONFIG_DEFENSIVE value:0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant