コード例 #1
0
        public void Initialise(string connectionString)
        {
            m_connectionString = connectionString;

            try
            {
                m_log.Info("[REGION DB]: MySql - connecting: " + Util.GetDisplayConnectionString(m_connectionString));
            }
            catch (Exception e)
            {
                m_log.Debug("Exception: password not found in connection string\n" + e.ToString());
            }

            using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
            {
                dbcon.Open();

                Migration m = new Migration(dbcon, Assembly, "EstateStore");
                m.Update();

                Type t = typeof(EstateSettings);
                m_Fields = t.GetFields(BindingFlags.NonPublic |
                                       BindingFlags.Instance |
                                       BindingFlags.DeclaredOnly);

                foreach (FieldInfo f in m_Fields)
                {
                    if (f.Name.Substring(0, 2) == "m_")
                        m_FieldMap[f.Name.Substring(2)] = f;
                }
            }
        }
コード例 #2
0
        public void Initialise(string connectionString)
        {
            m_connectionString = connectionString;

            using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
            {
                dbcon.Open();

                // Apply new Migrations
                //
                Assembly assem = GetType().Assembly;
                Migration m = new Migration(dbcon, assem, "RegionStore");
                m.Update();

                // Clean dropped attachments
                //
                try
                {
                    using (MySqlCommand cmd = dbcon.CreateCommand())
                    {
                        cmd.CommandText = "delete from prims, primshapes using prims " +
                                "left join primshapes on prims.uuid = primshapes.uuid " +
                                "where PCode = 9 and State <> 0";
                        ExecuteNonQuery(cmd);
                    }
                }
                catch (MySqlException ex)
                {
                    m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
                }
            }
        }
コード例 #3
0
 void Init()
 {
     using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
     {
         dbcon.Open();
         
         Migration m = new Migration(dbcon, Assembly, "UserProfiles");
         m.Update();
     }
 }
コード例 #4
0
 void Init()
 {
     using (NpgsqlConnection dbcon = new NpgsqlConnection(ConnectionString))
     {
         dbcon.Open();
         
         Migration m = new Migration(dbcon, Assembly, "UserProfiles");
         m.Update();
         m_database = new PGSQLManager(ConnectionString);
     }
 }
コード例 #5
0
        /// <summary>
        /// <para>Initialises Asset interface</para>
        /// <para>
        /// <list type="bullet">
        /// <item>Loads and initialises the MySQL storage plugin.</item>
        /// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
        /// <item>Check for migration</item>
        /// </list>
        /// </para>
        /// </summary>
        /// <param name="connect">connect string</param>
        public override void Initialise(string connect)
        {
            m_connectionString = connect;

            using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
            {
                dbcon.Open();
                Migration m = new Migration(dbcon, Assembly, "AssetStore");
                m.Update();
            }
        }
コード例 #6
0
ファイル: RegionMigration.cs プロジェクト: mattire/ModreX
        public bool Convert()
        {
            try
            {
                SqliteConnection conn = new SqliteConnection(m_connectionString);
                conn.Open();

                Assembly assem = GetType().Assembly;
                Migration m = new Migration(conn, assem, "RegionStore");

                int version = m.Version;

                if (version <= 14)
                {
                    if (version == 0)
                    {
                        //read rex tables and add to rex database
                        m_log.Info("[regionstore] converting rex tables to rexobjectproperties");
                        if (!ConvertLegacyRexDataToModreX())
                        {
                            conn.Close();
                            return false;
                        }

                        m_log.Info("[RegionStore] Update region migrations");
                        //Add new field to Land table
                        SqliteCommand addAuthbyerIDCmd = new SqliteCommand(addAuthbyerID, conn);
                        addAuthbyerIDCmd.ExecuteNonQuery();

                        //Change migration to version 1
                        m.Version = 1;
                    }

                    //Run migrations up to 9
                    //Note: this run migrations only to point nine since only those files exist in application resources.
                    m.Update();

                    //Skip over 10. Change version to 10
                    //This skips adding of the ClickAction since that already exists in 0.4 database
                    //m.Version = 10;
                }

                conn.Close();
                return true;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[RegionStore] Migration failed. Reason: {0}", e);
                return false;
            }
        }
コード例 #7
0
        public void Initialise(string connectionString)
        {
            m_connectionString = connectionString;

            using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
            {
                dbcon.Open();

                // Apply new Migrations
                //
                Migration m = new Migration(dbcon, Assembly, "RegionStore");
                m.Update();
            }
        }
コード例 #8
0
        /// <summary>
        /// <para>Initialises Inventory interface</para>
        /// <para>
        /// <list type="bullet">
        /// <item>Loads and initialises the MySQL storage plugin</item>
        /// <item>warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
        /// <item>Check for migration</item>
        /// </list>
        /// </para>
        /// </summary>
        /// <param name="connect">connect string</param>
        public void Initialise(string connect)
        {
            m_connectionString = connect;

            // This actually does the roll forward assembly stuff
            Assembly assem = GetType().Assembly;

            using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
            {
                dbcon.Open();
                Migration m = new Migration(dbcon, assem, "InventoryStore");
                m.Update();
            }
        }
コード例 #9
0
        public bool Convert()
        {
            try
            {
                SqliteConnection conn = new SqliteConnection(m_connectionString);
                conn.Open();

                Assembly assem = GetType().Assembly;
                Migration m = new Migration(conn, assem, "InventoryStore");
                if (m.Version == 0)
                {
                    //Apply all changes to db
                    SqliteCommand addSalePriceCmd = new SqliteCommand(addSalePrice, conn);
                    addSalePriceCmd.ExecuteNonQuery();

                    SqliteCommand addSaleTypeCmd = new SqliteCommand(addSaleType, conn);
                    addSaleTypeCmd.ExecuteNonQuery();

                    SqliteCommand addCreationDateCmd = new SqliteCommand(addCreationDate, conn);
                    addCreationDateCmd.ExecuteNonQuery();

                    SqliteCommand addGroupIDCmd = new SqliteCommand(addGroupID, conn);
                    addGroupIDCmd.ExecuteNonQuery();

                    SqliteCommand addGroupOwnedCmd = new SqliteCommand(addGroupOwned, conn);
                    addGroupOwnedCmd.ExecuteNonQuery();

                    SqliteCommand addFlagsCmd = new SqliteCommand(addFlags, conn);
                    addFlagsCmd.ExecuteNonQuery();

                    //then change version number
                    m.Version = 1;
                }
                return true;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[InventoryStore] Migration failed. Reason: {0}", e);
                return false;
            }
        }
コード例 #10
0
        public void Initialise(string connectionString)
        {
            m_connectionString = connectionString;
            m_log.DebugFormat("[UserLogModule]: Mssql - connecting: {0}", m_connectionString);

            try
            {
                m_database = new MSSQLManager(connectionString);
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    Migration m = new Migration(conn, Assembly, "mssql");
                    m.Update();
                }
            }
            catch (Exception ex)
            {
                m_log.ErrorFormat("[UserLogModule]: Initial mssql exception for URI '{0}', Exception: {1}", m_connectionString, ex.Message);
                Environment.Exit(-1);
            }
        }
コード例 #11
0
        public bool Convert()
        {
            try
            {
                SqliteConnection conn = new SqliteConnection(m_connectionString);
                conn.Open();

                Assembly assem = GetType().Assembly;
                Migration m = new Migration(conn, assem, "UserStore");

                if (m.Version == 0)
                {
                    m.Version = 1;
                }

                conn.Close();
                return true;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[UserStore] Migration failed. Reason: {0}", e);
                return false;
            }
        }
コード例 #12
0
        /// <summary>
        /// <para>Initialises Asset interface</para>
        /// <para>
        /// <list type="bullet">
        /// <item>Loads and initialises the PGSQL storage plugin.</item>
        /// <item>Warns and uses the obsolete pgsql_connection.ini if connect string is empty.</item>
        /// <item>Check for migration</item>
        /// </list>
        /// </para>
        /// </summary>
        /// <param name="connect">connect string</param>
        public void Initialise(string connect)
        {
            m_log.ErrorFormat("[PGSQL XASSETDATA]: ***********************************************************");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: ***********************************************************");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: ***********************************************************");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: THIS PLUGIN IS STRICTLY EXPERIMENTAL.");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: DO NOT USE FOR ANY DATA THAT YOU DO NOT MIND LOSING.");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: DATABASE TABLES CAN CHANGE AT ANY TIME, CAUSING EXISTING DATA TO BE LOST.");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: ***********************************************************");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: ***********************************************************");
            m_log.ErrorFormat("[PGSQL XASSETDATA]: ***********************************************************");

            m_connectionString = connect;

            using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
            {
                dbcon.Open();
                Migration m = new Migration(dbcon, Assembly, "XAssetStore");
                m.Update();
            }
        }
コード例 #13
0
ファイル: AssetMigration.cs プロジェクト: jonnenauha/ModreX
        public bool Convert()
        {
            try
            {
                SqliteConnection conn = new SqliteConnection(m_assetConnectionString);
                conn.Open();

                Assembly assem = GetType().Assembly;
                Migration m = new Migration(conn, assem, "AssetStore");

                if (m.Version == 0)
                {
                    //fetch all assets with mediaurl and construct RexAssetData objects
                    List<RexAssetData> rexAssets = new List<RexAssetData>();

                    using (SqliteCommand cmd = new SqliteCommand(assetSelect, conn))
                    {
                        using (IDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                if (((String)reader["MediaURL"]) != "")
                                {
                                    UUID id = new UUID((String) reader["UUID"]);
                                    string mediaUrl = (String)reader["MediaURL"];
                                    byte refreshRate = 0;
                                    object refRate = reader["RefreshRate"];
                                    if (refRate is byte)
                                    {
                                        refreshRate = (byte)refRate;
                                    }
                                    RexAssetData data = new RexAssetData(id, mediaUrl,refreshRate);
                                    rexAssets.Add(data);
                                }
                            }
                        }
                    }
                    conn.Close();

                    //Now add them to ModreX database
                    NHibernateRexAssetData rexAssetManager = new NHibernateRexAssetData();
                    rexAssetManager.Initialise(m_rexConnectionString);
                    foreach (RexAssetData data in rexAssets)
                    {
                        rexAssetManager.StoreObject(data);
                    }

                    //finally remove realXtend properties and update version number
                    conn.Open();
                    //TODO: remove realXtend properties
                    // this is not done yet because SQLite is missing drop column feature
                    m.Version = 1;
                }

                conn.Close();
                return true;
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[AssetStore] Migration failed. Reason: {0}", e);
                return false;
            }
        }
コード例 #14
0
        public void Initialise(string connectionString)
        {
            m_connectionString = connectionString;
            m_log.DebugFormat("[UserLogModule]: Mssql - connecting: {0}", m_connectionString);

            try
            {

                m_database = new MSSQLManager(connectionString);
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    Migration m = new Migration(conn, Assembly, "mssql");
                    m.Update();
                }
            }
            catch (Exception ex)
            {
                m_log.ErrorFormat("[UserLogModule]: Initial mssql exception for URI '{0}', Exception: {1}", m_connectionString, ex.Message);
                Environment.Exit(-1);
            }
        }