diff options
author | Dr Scofield | 2008-06-27 23:03:39 +0000 |
---|---|---|
committer | Dr Scofield | 2008-06-27 23:03:39 +0000 |
commit | 748f72326d9a295958bc9ba63bbb1a5d39030ef7 (patch) | |
tree | 58f2c9a5f6b8ffab5ad3621070aa17cb1c1e3e6b /OpenSim/Data/MySQL | |
parent | more warnings to go. (diff) | |
download | opensim-SC-748f72326d9a295958bc9ba63bbb1a5d39030ef7.zip opensim-SC-748f72326d9a295958bc9ba63bbb1a5d39030ef7.tar.gz opensim-SC-748f72326d9a295958bc9ba63bbb1a5d39030ef7.tar.bz2 opensim-SC-748f72326d9a295958bc9ba63bbb1a5d39030ef7.tar.xz |
last round of warning squashing. calling it a day now.
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 20 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLDataStore.cs | 304 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGridData.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLManager.cs | 26 |
4 files changed, 185 insertions, 173 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index ac7fa1d..fc331cd 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -120,16 +120,16 @@ namespace OpenSim.Data.MySQL | |||
120 | /// </list> | 120 | /// </list> |
121 | /// </summary> | 121 | /// </summary> |
122 | /// <param name="oldVersion"></param> | 122 | /// <param name="oldVersion"></param> |
123 | private void UpgradeAssetsTable(string oldVersion) | 123 | // private void UpgradeAssetsTable(string oldVersion) |
124 | { | 124 | // { |
125 | // null as the version, indicates that the table didn't exist | 125 | // // null as the version, indicates that the table didn't exist |
126 | if (oldVersion == null) | 126 | // if (oldVersion == null) |
127 | { | 127 | // { |
128 | m_log.Info("[ASSETS DB]: Creating new database tables"); | 128 | // m_log.Info("[ASSETS DB]: Creating new database tables"); |
129 | _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql"); | 129 | // _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql"); |
130 | return; | 130 | // return; |
131 | } | 131 | // } |
132 | } | 132 | // } |
133 | 133 | ||
134 | /// <summary> | 134 | /// <summary> |
135 | /// Ensure that the assets related tables exists and are at the latest version | 135 | /// Ensure that the assets related tables exists and are at the latest version |
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 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index 7abc85a..bb71c99 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs | |||
@@ -402,11 +402,11 @@ namespace OpenSim.Data.MySQL | |||
402 | /// <returns></returns> | 402 | /// <returns></returns> |
403 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) | 403 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) |
404 | { | 404 | { |
405 | SHA512Managed HashProvider = new SHA512Managed(); | 405 | // SHA512Managed HashProvider = new SHA512Managed(); |
406 | Encoding TextProvider = new UTF8Encoding(); | 406 | // Encoding TextProvider = new UTF8Encoding(); |
407 | 407 | ||
408 | byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge); | 408 | // byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge); |
409 | byte[] hash = HashProvider.ComputeHash(stream); | 409 | // byte[] hash = HashProvider.ComputeHash(stream); |
410 | 410 | ||
411 | return false; | 411 | return false; |
412 | } | 412 | } |
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index 7c3ed28..61fd039 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Data.MySQL | |||
156 | public string getVersion() | 156 | public string getVersion() |
157 | { | 157 | { |
158 | Module module = GetType().Module; | 158 | Module module = GetType().Module; |
159 | string dllName = module.Assembly.ManifestModule.Name; | 159 | // string dllName = module.Assembly.ManifestModule.Name; |
160 | Version dllVersion = module.Assembly.GetName().Version; | 160 | Version dllVersion = module.Assembly.GetName().Version; |
161 | 161 | ||
162 | return | 162 | return |
@@ -916,8 +916,12 @@ namespace OpenSim.Data.MySQL | |||
916 | IDbCommand result = Query(sql, parameters); | 916 | IDbCommand result = Query(sql, parameters); |
917 | 917 | ||
918 | //Console.WriteLine(result.CommandText); | 918 | //Console.WriteLine(result.CommandText); |
919 | int x; | 919 | // int x; |
920 | if ((x = result.ExecuteNonQuery()) > 0) | 920 | // if ((x = result.ExecuteNonQuery()) > 0) |
921 | // { | ||
922 | // returnval = true; | ||
923 | // } | ||
924 | if (result.ExecuteNonQuery() > 0) | ||
921 | { | 925 | { |
922 | returnval = true; | 926 | returnval = true; |
923 | } | 927 | } |
@@ -952,8 +956,12 @@ namespace OpenSim.Data.MySQL | |||
952 | 956 | ||
953 | IDbCommand result = Query(sql, parameters); | 957 | IDbCommand result = Query(sql, parameters); |
954 | 958 | ||
955 | int x; | 959 | // int x; |
956 | if ((x = result.ExecuteNonQuery()) > 0) | 960 | // if ((x = result.ExecuteNonQuery()) > 0) |
961 | // { | ||
962 | // returnval = true; | ||
963 | // } | ||
964 | if (result.ExecuteNonQuery() > 0) | ||
957 | { | 965 | { |
958 | returnval = true; | 966 | returnval = true; |
959 | } | 967 | } |
@@ -1000,8 +1008,12 @@ namespace OpenSim.Data.MySQL | |||
1000 | IDbCommand result = Query(sql, parameters); | 1008 | IDbCommand result = Query(sql, parameters); |
1001 | 1009 | ||
1002 | //Console.WriteLine(result.CommandText); | 1010 | //Console.WriteLine(result.CommandText); |
1003 | int x; | 1011 | // int x; |
1004 | if ((x = result.ExecuteNonQuery()) > 0) | 1012 | // if ((x = result.ExecuteNonQuery()) > 0) |
1013 | // { | ||
1014 | // returnval = true; | ||
1015 | // } | ||
1016 | if (result.ExecuteNonQuery() > 0) | ||
1005 | { | 1017 | { |
1006 | returnval = true; | 1018 | returnval = true; |
1007 | } | 1019 | } |