From 748f72326d9a295958bc9ba63bbb1a5d39030ef7 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Fri, 27 Jun 2008 23:03:39 +0000 Subject: last round of warning squashing. calling it a day now. --- OpenSim/Data/MySQL/MySQLAssetData.cs | 20 +-- OpenSim/Data/MySQL/MySQLDataStore.cs | 304 +++++++++++++++++------------------ OpenSim/Data/MySQL/MySQLGridData.cs | 8 +- OpenSim/Data/MySQL/MySQLManager.cs | 26 ++- 4 files changed, 185 insertions(+), 173 deletions(-) (limited to 'OpenSim/Data/MySQL') 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 /// /// /// - private void UpgradeAssetsTable(string oldVersion) - { - // null as the version, indicates that the table didn't exist - if (oldVersion == null) - { - m_log.Info("[ASSETS DB]: Creating new database tables"); - _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql"); - return; - } - } + // private void UpgradeAssetsTable(string oldVersion) + // { + // // null as the version, indicates that the table didn't exist + // if (oldVersion == null) + // { + // m_log.Info("[ASSETS DB]: Creating new database tables"); + // _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql"); + // return; + // } + // } /// /// 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 /// /// /// The database connection handler - private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn) - { - // null as the version, indicates that the table didn't exist - if (oldVersion == null) - { - ExecuteResourceSql("CreateLandTable.sql",dbconn); - oldVersion = "Rev. 2; InnoDB free: 0 kB"; - } - if (!oldVersion.Contains("Rev.")) - { - ExecuteResourceSql("UpgradeLandTableToVersion2.sql", dbconn); - } - } + // private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn) + // { + // // null as the version, indicates that the table didn't exist + // if (oldVersion == null) + // { + // ExecuteResourceSql("CreateLandTable.sql",dbconn); + // oldVersion = "Rev. 2; InnoDB free: 0 kB"; + // } + // if (!oldVersion.Contains("Rev.")) + // { + // ExecuteResourceSql("UpgradeLandTableToVersion2.sql", dbconn); + // } + // } /// /// Adds an object into region storage @@ -534,7 +534,7 @@ namespace OpenSim.Data.MySQL where RegionUUID=?RegionUUID order by Revision desc limit 1" , m_connection); - MySqlParameter param = new MySqlParameter(); + // MySqlParameter param = new MySqlParameter(); cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); if (m_connection.State != ConnectionState.Open) @@ -1768,30 +1768,30 @@ namespace OpenSim.Data.MySQL /// /// /// - private static string defineTable(DataTable dt) - { - string sql = "create table " + dt.TableName + "("; - string subsql = String.Empty; - foreach (DataColumn col in dt.Columns) - { - if (subsql.Length > 0) - { - // a map function would rock so much here - subsql += ",\n"; - } - subsql += col.ColumnName + " " + MySqlType(col.DataType); - if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) - { - subsql += " primary key"; - } - } - sql += subsql; - sql += ")"; - - //m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql); - - return sql; - } + // private static string defineTable(DataTable dt) + // { + // string sql = "create table " + dt.TableName + "("; + // string subsql = String.Empty; + // foreach (DataColumn col in dt.Columns) + // { + // if (subsql.Length > 0) + // { + // // a map function would rock so much here + // subsql += ",\n"; + // } + // subsql += col.ColumnName + " " + MySqlType(col.DataType); + // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) + // { + // subsql += " primary key"; + // } + // } + // sql += subsql; + // sql += ")"; + + // //m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql); + + // return sql; + // } /*********************************************************************** * @@ -1944,93 +1944,93 @@ namespace OpenSim.Data.MySQL /// /// /// MySQL connection handler - private static void InitDB(MySqlConnection conn) - { - string createPrims = defineTable(createPrimTable()); - string createShapes = defineTable(createShapeTable()); - string createItems = defineTable(createItemsTable()); - string createTerrain = defineTable(createTerrainTable()); - - // Land table is created from the Versionable Test Table routine now. - //string createLand = defineTable(createLandTable()); - string createLandAccessList = defineTable(createLandAccessListTable()); - - MySqlCommand pcmd = new MySqlCommand(createPrims, conn); - MySqlCommand scmd = new MySqlCommand(createShapes, conn); - MySqlCommand icmd = new MySqlCommand(createItems, conn); - MySqlCommand tcmd = new MySqlCommand(createTerrain, conn); - //MySqlCommand lcmd = new MySqlCommand(createLand, conn); - MySqlCommand lalcmd = new MySqlCommand(createLandAccessList, conn); - - if (conn.State != ConnectionState.Open) - { - try - { - conn.Open(); - } - catch (Exception ex) - { - m_log.Error("[REGION DB]: Error connecting to MySQL server: " + ex.Message); - m_log.Error("[REGION DB]: Application is terminating!"); - Thread.CurrentThread.Abort(); - } - } - - try - { - pcmd.ExecuteNonQuery(); - } - catch (MySqlException e) - { - m_log.WarnFormat("[REGION DB]: Primitives Table Already Exists: {0}", e); - } - - try - { - scmd.ExecuteNonQuery(); - } - catch (MySqlException e) - { - m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e); - } - - try - { - icmd.ExecuteNonQuery(); - } - catch (MySqlException e) - { - m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e); - } - - try - { - tcmd.ExecuteNonQuery(); - } - catch (MySqlException e) - { - m_log.WarnFormat("[REGION DB]: Terrain Table Already Exists: {0}", e); - } - - //try - //{ - //lcmd.ExecuteNonQuery(); - //} - //catch (MySqlException e) - //{ - //m_log.WarnFormat("[MySql]: Land Table Already Exists: {0}", e); - //} - - try - { - lalcmd.ExecuteNonQuery(); - } - catch (MySqlException e) - { - m_log.WarnFormat("[REGION DB]: LandAccessList Table Already Exists: {0}", e); - } - conn.Close(); - } + // private static void InitDB(MySqlConnection conn) + // { + // string createPrims = defineTable(createPrimTable()); + // string createShapes = defineTable(createShapeTable()); + // string createItems = defineTable(createItemsTable()); + // string createTerrain = defineTable(createTerrainTable()); + + // // Land table is created from the Versionable Test Table routine now. + // //string createLand = defineTable(createLandTable()); + // string createLandAccessList = defineTable(createLandAccessListTable()); + + // MySqlCommand pcmd = new MySqlCommand(createPrims, conn); + // MySqlCommand scmd = new MySqlCommand(createShapes, conn); + // MySqlCommand icmd = new MySqlCommand(createItems, conn); + // MySqlCommand tcmd = new MySqlCommand(createTerrain, conn); + // //MySqlCommand lcmd = new MySqlCommand(createLand, conn); + // MySqlCommand lalcmd = new MySqlCommand(createLandAccessList, conn); + + // if (conn.State != ConnectionState.Open) + // { + // try + // { + // conn.Open(); + // } + // catch (Exception ex) + // { + // m_log.Error("[REGION DB]: Error connecting to MySQL server: " + ex.Message); + // m_log.Error("[REGION DB]: Application is terminating!"); + // Thread.CurrentThread.Abort(); + // } + // } + + // try + // { + // pcmd.ExecuteNonQuery(); + // } + // catch (MySqlException e) + // { + // m_log.WarnFormat("[REGION DB]: Primitives Table Already Exists: {0}", e); + // } + + // try + // { + // scmd.ExecuteNonQuery(); + // } + // catch (MySqlException e) + // { + // m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e); + // } + + // try + // { + // icmd.ExecuteNonQuery(); + // } + // catch (MySqlException e) + // { + // m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e); + // } + + // try + // { + // tcmd.ExecuteNonQuery(); + // } + // catch (MySqlException e) + // { + // m_log.WarnFormat("[REGION DB]: Terrain Table Already Exists: {0}", e); + // } + + // //try + // //{ + // //lcmd.ExecuteNonQuery(); + // //} + // //catch (MySqlException e) + // //{ + // //m_log.WarnFormat("[MySql]: Land Table Already Exists: {0}", e); + // //} + + // try + // { + // lalcmd.ExecuteNonQuery(); + // } + // catch (MySqlException e) + // { + // m_log.WarnFormat("[REGION DB]: LandAccessList Table Already Exists: {0}", e); + // } + // conn.Close(); + // } /// /// @@ -2189,32 +2189,32 @@ namespace OpenSim.Data.MySQL /// /// /// this is something we'll need to implement for each db slightly differently. - private static string MySqlType(Type type) - { - if (type == typeof (String)) - { - return "varchar(255)"; - } - else if (type == typeof (Int32)) - { - return "integer"; - } - else if (type == typeof (Int64)) - { - return "bigint"; - } - else if (type == typeof (Double)) - { - return "float"; - } - else if (type == typeof (Byte[])) - { - return "longblob"; - } - else - { - return "string"; - } - } + // private static string MySqlType(Type type) + // { + // if (type == typeof (String)) + // { + // return "varchar(255)"; + // } + // else if (type == typeof (Int32)) + // { + // return "integer"; + // } + // else if (type == typeof (Int64)) + // { + // return "bigint"; + // } + // else if (type == typeof (Double)) + // { + // return "float"; + // } + // else if (type == typeof (Byte[])) + // { + // return "longblob"; + // } + // else + // { + // return "string"; + // } + // } } } 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 /// public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) { - SHA512Managed HashProvider = new SHA512Managed(); - Encoding TextProvider = new UTF8Encoding(); + // SHA512Managed HashProvider = new SHA512Managed(); + // Encoding TextProvider = new UTF8Encoding(); - byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge); - byte[] hash = HashProvider.ComputeHash(stream); + // byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge); + // byte[] hash = HashProvider.ComputeHash(stream); return false; } 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 public string getVersion() { Module module = GetType().Module; - string dllName = module.Assembly.ManifestModule.Name; + // string dllName = module.Assembly.ManifestModule.Name; Version dllVersion = module.Assembly.GetName().Version; return @@ -916,8 +916,12 @@ namespace OpenSim.Data.MySQL IDbCommand result = Query(sql, parameters); //Console.WriteLine(result.CommandText); - int x; - if ((x = result.ExecuteNonQuery()) > 0) + // int x; + // if ((x = result.ExecuteNonQuery()) > 0) + // { + // returnval = true; + // } + if (result.ExecuteNonQuery() > 0) { returnval = true; } @@ -952,8 +956,12 @@ namespace OpenSim.Data.MySQL IDbCommand result = Query(sql, parameters); - int x; - if ((x = result.ExecuteNonQuery()) > 0) + // int x; + // if ((x = result.ExecuteNonQuery()) > 0) + // { + // returnval = true; + // } + if (result.ExecuteNonQuery() > 0) { returnval = true; } @@ -1000,8 +1008,12 @@ namespace OpenSim.Data.MySQL IDbCommand result = Query(sql, parameters); //Console.WriteLine(result.CommandText); - int x; - if ((x = result.ExecuteNonQuery()) > 0) + // int x; + // if ((x = result.ExecuteNonQuery()) > 0) + // { + // returnval = true; + // } + if (result.ExecuteNonQuery() > 0) { returnval = true; } -- cgit v1.1