/// <summary> /// Initialises the estatedata class. /// </summary> /// <param name="connectionString">connectionString.</param> public void Initialise(string connectionString) { if (!string.IsNullOrEmpty(connectionString)) { m_connectionString = connectionString; _Database = new PGSQLManager(connectionString); } //Migration settings using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) { conn.Open(); Migration m = new Migration(conn, GetType().Assembly, "EstateStore"); m.Update(); } //Interesting way to get parameters! Maybe implement that also with other types Type t = typeof(EstateSettings); _Fields = t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach (FieldInfo f in _Fields) { if (f.Name.Substring(0, 2) == "m_") { _FieldMap[f.Name.Substring(2)] = f; } } }
/// <summary> /// Initialises the estatedata class. /// </summary> /// <param name="connectionString">connectionString.</param> public void Initialise(string connectionString) { if (!string.IsNullOrEmpty(connectionString)) { m_connectionString = connectionString; _Database = new PGSQLManager(connectionString); } //Migration settings using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) { conn.Open(); Migration m = new Migration(conn, GetType().Assembly, "EstateStore"); m.Update(); } //Interesting way to get parameters! Maybe implement that also with other types Type t = typeof(EstateSettings); _Fields = t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach (FieldInfo f in _Fields) { if (f.Name.Substring(0, 2) == "m_") _FieldMap[f.Name.Substring(2)] = f; } }
/// <summary> /// Loads and initialises the PGSQL inventory storage interface /// </summary> /// <param name="connectionString">connect string</param> /// <remarks>use PGSQL_connection.ini</remarks> public void Initialise(string connectionString) { m_connectionString = connectionString; database = new PGSQLManager(connectionString); //New migrations check of store database.CheckMigration(_migrationStore); }
/// <summary> /// Initialises asset interface /// </summary> /// <para> /// a string instead of file, if someone writes the support /// </para> /// <param name="connectionString">connect string</param> override public void Initialise(string connectionString) { m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks; m_database = new PGSQLManager(connectionString); m_connectionString = connectionString; //New migration to check for DB changes m_database.CheckMigration(_migrationStore); }
void Init() { using (NpgsqlConnection dbcon = new NpgsqlConnection(ConnectionString)) { dbcon.Open(); Migration m = new Migration(dbcon, Assembly, "UserProfiles"); m.Update(); m_database = new PGSQLManager(ConnectionString); } }
public PGSQLAuthenticationData(string connectionString, string realm) { m_Realm = realm; m_ConnectionString = connectionString; using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) { conn.Open(); Migration m = new Migration(conn, GetType().Assembly, "AuthStore"); m_database = new PGSQLManager(m_ConnectionString); m.Update(); } }
public void Initialise(string connect, string realm, int UpdateAccessTime) { DaysBetweenAccessTimeUpdates = UpdateAccessTime; m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks; m_connectionString = connect; m_database = new PGSQLManager(m_connectionString); //New migration to check for DB changes m_database.CheckMigration(_migrationStore); }
/// <summary> /// Initialises the region datastore /// </summary> /// <param name="connectionString">The connection string.</param> public void Initialise(string connectionString) { m_connectionString = connectionString; _Database = new PGSQLManager(connectionString); using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) { conn.Open(); //New Migration settings Migration m = new Migration(conn, Assembly, "RegionStore"); m.Update(); } }
public PGSQLRegionData(string connectionString, string realm) { m_Realm = realm; m_ConnectionString = connectionString; m_database = new PGSQLManager(connectionString); using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) { conn.Open(); Migration m = new Migration(conn, GetType().Assembly, "GridStore"); m.Update(); } LoadFieldTypes(); }
public PGSQLGenericTableHandler(string connectionString, string realm, string storeName) : base(connectionString) { m_Realm = realm; m_ConnectionString = connectionString; if (storeName != String.Empty) { using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) { conn.Open(); Migration m = new Migration(conn, GetType().Assembly, storeName); m.Update(); } } m_database = new PGSQLManager(m_ConnectionString); Type t = typeof(T); FieldInfo[] fields = t.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); LoadFieldTypes(); if (fields.Length == 0) { return; } foreach (FieldInfo f in fields) { if (f.Name != "Data") { m_Fields[f.Name] = f; } else { m_DataField = f; } } }
/// <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; m_database = new PGSQLManager(m_connectionString); using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString)) { dbcon.Open(); Migration m = new Migration(dbcon, Assembly, "XAssetStore"); m.Update(); } }
/// <summary> /// Closes this DB provider /// </summary> public void Dispose() { database = null; }