can't successfully call sqlite3_config

Hey guys,

I'm using SQLite.net and I'm trying to configure SQlite3 to access DB in serialized mode. I try and call SQLite3.Config(SQLite3.ConfigOption.Serialized); very early on in the piece...but no matter where I call it I get (21) misuse at line 112748.

Can anybody offer any advice on why this call fails and how to get it to succeed? I understand I need to call this before "initialize", but I'm not sure if the os is calling that for me already? No matter where I put the call it fails :(.

Thanks,
Dave

Posts

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    Supposedly the default mode is already Serialized, so is there any need for you to change it?

  • PaulTurnerPaulTurner AUMember

    Yeah...I saw that post while trying to understand what the problem is, but I'm not 100% buying it. We have a syncMgr that gives us no issues under Monotouch after setting sqlite3 to serialized (previously I did have some random problems).

    The same SyncMgr when running under Mono for Android is giving us those original random exceptions. Then I noticed the call to config was failing.

  • PaulTurnerPaulTurner AUMember

    I think this only pertains to whether the java is locking on when you use their SqliteDatabase connection object to access the DB (the connection from SQLiteOpenHelper.

    I don't think it configures the sqlite3 db.

  • PatrikPatrik USMember

    Hmr. I cant get this to work either (& not on on Xamarin.iOS either).

  • PatrikPatrik USMember
    edited June 2013

    I was able to get by the issue by calling sqlite3_shutdown() before the config call, then after the config, call sqllite3_initalize(). Atleast this appears appears to be necessary on ICS as well as iOS6.

    To do so you need to add the following to the SQLite3 class, as it has no binding for initalize/shutdown.

    [DllImport("sqlite3", EntryPoint = "sqlite3_initialize", CallingConvention=CallingConvention.Cdecl)]
    public static extern int Initialize();

    [DllImport("sqlite3", EntryPoint = "sqlite3_shutdown", CallingConvention=CallingConvention.Cdecl)]
    public static extern int Shutdown();

Sign In or Register to comment.