aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLDataStore.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLDataStore.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLDataStore.cs304
1 files changed, 152 insertions, 152 deletions
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs
index aa4c111..87bce10 100644
--- a/OpenSim/Data/MySQL/MySQLDataStore.cs
+++ b/OpenSim/Data/MySQL/MySQLDataStore.cs
@@ -272,19 +272,19 @@ namespace OpenSim.Data.MySQL
272 /// </summary> 272 /// </summary>
273 /// <param name="oldVersion"></param> 273 /// <param name="oldVersion"></param>
274 /// <param name="dbconn">The database connection handler</param> 274 /// <param name="dbconn">The database connection handler</param>
275 private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn) 275 // private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn)
276 { 276 // {
277 // null as the version, indicates that the table didn't exist 277 // // null as the version, indicates that the table didn't exist
278 if (oldVersion == null) 278 // if (oldVersion == null)
279 { 279 // {
280 ExecuteResourceSql("CreateLandTable.sql",dbconn); 280 // ExecuteResourceSql("CreateLandTable.sql",dbconn);
281 oldVersion = "Rev. 2; InnoDB free: 0 kB"; 281 // oldVersion = "Rev. 2; InnoDB free: 0 kB";
282 } 282 // }
283 if (!oldVersion.Contains("Rev.")) 283 // if (!oldVersion.Contains("Rev."))
284 { 284 // {
285 ExecuteResourceSql("UpgradeLandTableToVersion2.sql", dbconn); 285 // ExecuteResourceSql("UpgradeLandTableToVersion2.sql", dbconn);
286 } 286 // }
287 } 287 // }
288 288
289 /// <summary> 289 /// <summary>
290 /// Adds an object into region storage 290 /// Adds an object into region storage
@@ -534,7 +534,7 @@ namespace OpenSim.Data.MySQL
534 where RegionUUID=?RegionUUID order by Revision desc limit 1" 534 where RegionUUID=?RegionUUID order by Revision desc limit 1"
535 , m_connection); 535 , m_connection);
536 536
537 MySqlParameter param = new MySqlParameter(); 537 // MySqlParameter param = new MySqlParameter();
538 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); 538 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID)));
539 539
540 if (m_connection.State != ConnectionState.Open) 540 if (m_connection.State != ConnectionState.Open)
@@ -1768,30 +1768,30 @@ namespace OpenSim.Data.MySQL
1768 /// </summary> 1768 /// </summary>
1769 /// <param name="dt"></param> 1769 /// <param name="dt"></param>
1770 /// <returns></returns> 1770 /// <returns></returns>
1771 private static string defineTable(DataTable dt) 1771 // private static string defineTable(DataTable dt)
1772 { 1772 // {
1773 string sql = "create table " + dt.TableName + "("; 1773 // string sql = "create table " + dt.TableName + "(";
1774 string subsql = String.Empty; 1774 // string subsql = String.Empty;
1775 foreach (DataColumn col in dt.Columns) 1775 // foreach (DataColumn col in dt.Columns)
1776 { 1776 // {
1777 if (subsql.Length > 0) 1777 // if (subsql.Length > 0)
1778 { 1778 // {
1779 // a map function would rock so much here 1779 // // a map function would rock so much here
1780 subsql += ",\n"; 1780 // subsql += ",\n";
1781 } 1781 // }
1782 subsql += col.ColumnName + " " + MySqlType(col.DataType); 1782 // subsql += col.ColumnName + " " + MySqlType(col.DataType);
1783 if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) 1783 // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0])
1784 { 1784 // {
1785 subsql += " primary key"; 1785 // subsql += " primary key";
1786 } 1786 // }
1787 } 1787 // }
1788 sql += subsql; 1788 // sql += subsql;
1789 sql += ")"; 1789 // sql += ")";
1790 1790
1791 //m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql); 1791 // //m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql);
1792 1792
1793 return sql; 1793 // return sql;
1794 } 1794 // }
1795 1795
1796 /*********************************************************************** 1796 /***********************************************************************
1797 * 1797 *
@@ -1944,93 +1944,93 @@ namespace OpenSim.Data.MySQL
1944 /// 1944 ///
1945 /// </summary> 1945 /// </summary>
1946 /// <param name="conn">MySQL connection handler</param> 1946 /// <param name="conn">MySQL connection handler</param>
1947 private static void InitDB(MySqlConnection conn) 1947 // private static void InitDB(MySqlConnection conn)
1948 { 1948 // {
1949 string createPrims = defineTable(createPrimTable()); 1949 // string createPrims = defineTable(createPrimTable());
1950 string createShapes = defineTable(createShapeTable()); 1950 // string createShapes = defineTable(createShapeTable());
1951 string createItems = defineTable(createItemsTable()); 1951 // string createItems = defineTable(createItemsTable());
1952 string createTerrain = defineTable(createTerrainTable()); 1952 // string createTerrain = defineTable(createTerrainTable());
1953 1953
1954 // Land table is created from the Versionable Test Table routine now. 1954 // // Land table is created from the Versionable Test Table routine now.
1955 //string createLand = defineTable(createLandTable()); 1955 // //string createLand = defineTable(createLandTable());
1956 string createLandAccessList = defineTable(createLandAccessListTable()); 1956 // string createLandAccessList = defineTable(createLandAccessListTable());
1957 1957
1958 MySqlCommand pcmd = new MySqlCommand(createPrims, conn); 1958 // MySqlCommand pcmd = new MySqlCommand(createPrims, conn);
1959 MySqlCommand scmd = new MySqlCommand(createShapes, conn); 1959 // MySqlCommand scmd = new MySqlCommand(createShapes, conn);
1960 MySqlCommand icmd = new MySqlCommand(createItems, conn); 1960 // MySqlCommand icmd = new MySqlCommand(createItems, conn);
1961 MySqlCommand tcmd = new MySqlCommand(createTerrain, conn); 1961 // MySqlCommand tcmd = new MySqlCommand(createTerrain, conn);
1962 //MySqlCommand lcmd = new MySqlCommand(createLand, conn); 1962 // //MySqlCommand lcmd = new MySqlCommand(createLand, conn);
1963 MySqlCommand lalcmd = new MySqlCommand(createLandAccessList, conn); 1963 // MySqlCommand lalcmd = new MySqlCommand(createLandAccessList, conn);
1964 1964
1965 if (conn.State != ConnectionState.Open) 1965 // if (conn.State != ConnectionState.Open)
1966 { 1966 // {
1967 try 1967 // try
1968 { 1968 // {
1969 conn.Open(); 1969 // conn.Open();
1970 } 1970 // }
1971 catch (Exception ex) 1971 // catch (Exception ex)
1972 { 1972 // {
1973 m_log.Error("[REGION DB]: Error connecting to MySQL server: " + ex.Message); 1973 // m_log.Error("[REGION DB]: Error connecting to MySQL server: " + ex.Message);
1974 m_log.Error("[REGION DB]: Application is terminating!"); 1974 // m_log.Error("[REGION DB]: Application is terminating!");
1975 Thread.CurrentThread.Abort(); 1975 // Thread.CurrentThread.Abort();
1976 } 1976 // }
1977 } 1977 // }
1978 1978
1979 try 1979 // try
1980 { 1980 // {
1981 pcmd.ExecuteNonQuery(); 1981 // pcmd.ExecuteNonQuery();
1982 } 1982 // }
1983 catch (MySqlException e) 1983 // catch (MySqlException e)
1984 { 1984 // {
1985 m_log.WarnFormat("[REGION DB]: Primitives Table Already Exists: {0}", e); 1985 // m_log.WarnFormat("[REGION DB]: Primitives Table Already Exists: {0}", e);
1986 } 1986 // }
1987 1987
1988 try 1988 // try
1989 { 1989 // {
1990 scmd.ExecuteNonQuery(); 1990 // scmd.ExecuteNonQuery();
1991 } 1991 // }
1992 catch (MySqlException e) 1992 // catch (MySqlException e)
1993 { 1993 // {
1994 m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e); 1994 // m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e);
1995 } 1995 // }
1996 1996
1997 try 1997 // try
1998 { 1998 // {
1999 icmd.ExecuteNonQuery(); 1999 // icmd.ExecuteNonQuery();
2000 } 2000 // }
2001 catch (MySqlException e) 2001 // catch (MySqlException e)
2002 { 2002 // {
2003 m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e); 2003 // m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e);
2004 } 2004 // }
2005 2005
2006 try 2006 // try
2007 { 2007 // {
2008 tcmd.ExecuteNonQuery(); 2008 // tcmd.ExecuteNonQuery();
2009 } 2009 // }
2010 catch (MySqlException e) 2010 // catch (MySqlException e)
2011 { 2011 // {
2012 m_log.WarnFormat("[REGION DB]: Terrain Table Already Exists: {0}", e); 2012 // m_log.WarnFormat("[REGION DB]: Terrain Table Already Exists: {0}", e);
2013 } 2013 // }
2014 2014
2015 //try 2015 // //try
2016 //{ 2016 // //{
2017 //lcmd.ExecuteNonQuery(); 2017 // //lcmd.ExecuteNonQuery();
2018 //} 2018 // //}
2019 //catch (MySqlException e) 2019 // //catch (MySqlException e)
2020 //{ 2020 // //{
2021 //m_log.WarnFormat("[MySql]: Land Table Already Exists: {0}", e); 2021 // //m_log.WarnFormat("[MySql]: Land Table Already Exists: {0}", e);
2022 //} 2022 // //}
2023 2023
2024 try 2024 // try
2025 { 2025 // {
2026 lalcmd.ExecuteNonQuery(); 2026 // lalcmd.ExecuteNonQuery();
2027 } 2027 // }
2028 catch (MySqlException e) 2028 // catch (MySqlException e)
2029 { 2029 // {
2030 m_log.WarnFormat("[REGION DB]: LandAccessList Table Already Exists: {0}", e); 2030 // m_log.WarnFormat("[REGION DB]: LandAccessList Table Already Exists: {0}", e);
2031 } 2031 // }
2032 conn.Close(); 2032 // conn.Close();
2033 } 2033 // }
2034 2034
2035 /// <summary> 2035 /// <summary>
2036 /// 2036 ///
@@ -2189,32 +2189,32 @@ namespace OpenSim.Data.MySQL
2189 /// <param name="type"></param> 2189 /// <param name="type"></param>
2190 /// <returns></returns> 2190 /// <returns></returns>
2191 /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks> 2191 /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
2192 private static string MySqlType(Type type) 2192 // private static string MySqlType(Type type)
2193 { 2193 // {
2194 if (type == typeof (String)) 2194 // if (type == typeof (String))
2195 { 2195 // {
2196 return "varchar(255)"; 2196 // return "varchar(255)";
2197 } 2197 // }
2198 else if (type == typeof (Int32)) 2198 // else if (type == typeof (Int32))
2199 { 2199 // {
2200 return "integer"; 2200 // return "integer";
2201 } 2201 // }
2202 else if (type == typeof (Int64)) 2202 // else if (type == typeof (Int64))
2203 { 2203 // {
2204 return "bigint"; 2204 // return "bigint";
2205 } 2205 // }
2206 else if (type == typeof (Double)) 2206 // else if (type == typeof (Double))
2207 { 2207 // {
2208 return "float"; 2208 // return "float";
2209 } 2209 // }
2210 else if (type == typeof (Byte[])) 2210 // else if (type == typeof (Byte[]))
2211 { 2211 // {
2212 return "longblob"; 2212 // return "longblob";
2213 } 2213 // }
2214 else 2214 // else
2215 { 2215 // {
2216 return "string"; 2216 // return "string";
2217 } 2217 // }
2218 } 2218 // }
2219 } 2219 }
2220} 2220}