SQLiteDatabase Plugin for MP2 (2 Viewers)

MJGraf

Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    @morpheus_xx looks like we have to take care about our installer anyway over the next weeks. I already tried to understand a bit about the WiX toolset, but to be honest, this XML-stuff is killing me :D
    Is there any kind of a visual config tool?
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    There is no Visual Designer unfortunately :(
    (I have worked with WIX, but currently really limited time)
     

    breese

    Retired Team Member
  • Premium Supporter
  • July 11, 2011
    3,902
    770
    66
    Arlington Heights, Illinois
    Home Country
    United States of America United States of America
    I can confirm 2 things
    1- The Database folder is installed/created on a Fresh Install
    2- Stopping, renaming, and restarting MP2_Server recreates
    MP2-Server in it
    Config
    Log
    TheMovieDB
    TvDB
    Datastore.s3db
    Datastore.s3db-wall
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I already stumbled over the "Database" subfolder before. In principle it would be the right location to store DB files.

    Only issue I see would be "migration" of former installations, as the expected folder is no longer the same.
     

    chefkoch

    Retired Team Member
  • Premium Supporter
  • October 5, 2004
    3,129
    1,634
    Dresden / Munich / Maastricht
    Home Country
    Germany Germany
    Hi.
    stopping MP2 Server, rename your ProgramData\Team MediaPortal\MP2-Server\ folder
    Done. And then no "Database" folder was there.
    So it would be created by installer, not by running the server only
    This is done by design here: https://github.com/MediaPortal/Medi...l/Setup/MP2-Setup/Features/Server.wxs#L31-L35
    because of:
    https://github.com/MediaPortal/Medi...aPortal/Source/Base/Server/Defaults/Paths.xml
    http://wiki.team-mediaportal.com/2_...velopment/4_Modules/Core_Services/PathManager

    If the database plugins don't use it, then these might need a change or we get rid of database subfolder.

    I prefer using the subfolder.

    Only issue I see would be "migration" of former installations, as the expected folder is no longer the same.
    For the migration: Could the database plugins check for the database subfolder first and use the other one as a fallback?
    Or if in database folder is no file, check the other path and copy /move it over?

    Or simply put it into the release news. We are in "alpha" ;) if caring too much about those things we also can call the releases final/stable.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Absolutely!
    But I think it is not only the InitializationCommand. We have to do two things:

    In SQLiteSettings just delete the part about locking_mode (normal is standard) so that it looks like:
    private const string DEFAULT_INITIALIZATION_COMMAND = "PRAGMA wal_autocheckpoint=32768;PRAGMA temp_store=MEMORY;";

    And in SQliteDatabase's Constructor comment out the following:
    connBuilder.JournalMode = SQLiteJournalModeEnum.Off;
    using (var connection = new SQLiteConnection(connBuilder.ToString()))
    {
    connection.Open();
    using (var command = new SQLiteCommand("PRAGMA locking_mode=EXCLUSIVE;", connection))
    command.ExecuteNonQuery();
    connection.Close();
    }
    The latter is a workaround to avoid storing the shared memory used for different connections from different processes to disk in a SHM-File, since this is not necessary in exclusive mode. But as you see it also opens an exclusive connection independent from the InitializationCommand. Just commenting it out should do the trick.

    If you want to do a new build, please feel free to make the amendments. Have to do some real live work today and am not sure, whether I find the time to do this myself today...

    Michael
    Are those changes the ones you proposed? https://github.com/MediaPortal/MediaPortal-2/commit/9f05459ae6e62fa483842fe84d85d1bc6fb7c410
    I introduced a "const USE_EXCLUSIVE_MODE" to be able to use both ways (at compile time)
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Actually both, SQLCEDatabase and SQLiteDatabase only use what is stored in Paths.xml - but the value in paths.xml is wrong then :D
    Is currently is
    <Path name="DATABASE" value="&lt;DATA&gt;" />
    and if we want the database to be in a subdirectory it should be
    <Path name="DATABASE" value="&lt;DATA&gt;\Database" />
    So in general no need to change anything in the database plugins - only in paths.xml

    Or simply put it into the release news. We are in "alpha" ;) if caring too much about those things we also can call the releases final/stable.
    Completely agree with this one (y) We are still in alpha state and there must be a reason for that (the reason is not stability :D )
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Should work perfectly (y) Thanks!
    And also thanks for all the formatting corrections. We definitely need to put more of those into our wiki....

    I introduced a "const USE_EXCLUSIVE_MODE" to be able to use both ways (at compile time)
    Maybe I will later on change the DEFAULT_INITIALIZATION_COMMAND to always be "PRAGMA wal_autocheckpoint=32768;PRAGMA temp_store=MEMORY;" and in the respective getter depending on the value of USE_EXCLUSIVE_MODE return "locking_mode=EXCLUSIVE;" + DEFAULT_INITIALIZATION_COMMAND
    That way it should not only work at compile time but also on a running system by just changing USE_EXCLUSIVE_MODE from true to false...
     

    Users who are viewing this thread

    Top Bottom