From 863195612bdef56165f2b4354bab280c371618b9 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Thu, 27 Sep 2007 14:57:43 +0000
Subject: Reverting back to 2017 since 2018 were causing Linux breakage;
reopening Tleiades patch 444 and 445.
---
OpenSim/Framework/Data.MySQL/MySQLManager.cs | 58 +++++++++++-----------------
1 file changed, 23 insertions(+), 35 deletions(-)
(limited to 'OpenSim/Framework/Data.MySQL/MySQLManager.cs')
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index e55606e..5037f98 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// The database connection object
///
- MySqlConnection dbcon;
+ IDbConnection dbcon;
///
/// Connection string for ADO.net
///
@@ -115,11 +115,10 @@ namespace OpenSim.Framework.Data.MySQL
{
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
dbcommand.CommandText = sql;
- if(parameters != null)
- foreach (KeyValuePair param in parameters)
- {
- dbcommand.Parameters.Add(param.Key, param.Value);
- }
+ foreach (KeyValuePair param in parameters)
+ {
+ dbcommand.Parameters.Add(param.Key, param.Value);
+ }
return (IDbCommand)dbcommand;
}
@@ -150,11 +149,10 @@ namespace OpenSim.Framework.Data.MySQL
{
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
dbcommand.CommandText = sql;
- if(parameters != null)
- foreach (KeyValuePair param in parameters)
- {
- dbcommand.Parameters.Add(param.Key, param.Value);
- }
+ foreach (KeyValuePair param in parameters)
+ {
+ dbcommand.Parameters.Add(param.Key, param.Value);
+ }
return (IDbCommand)dbcommand;
}
@@ -372,8 +370,6 @@ namespace OpenSim.Framework.Data.MySQL
folder.parentID = new LLUUID((string)reader["parentFolderID"]);
folder.folderID = new LLUUID((string)reader["folderID"]);
folder.name = (string)reader["folderName"];
- folder.category = (InventoryCategory)((Int16)reader["category"]);
- folder.type = (Int16)reader["folderType"];
rows.Add(folder);
}
@@ -513,32 +509,24 @@ namespace OpenSim.Framework.Data.MySQL
/// Success?
public bool insertFolder(InventoryFolderBase folder)
{
- string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, category, folderType) VALUES ";
- sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?category, ?folderType)";
-
- MySqlCommand dbcmd = dbcon.CreateCommand();
- dbcmd.CommandText = sql;
-
- LLUUID tmpID = folder.folderID;
- dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
- dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
- tmpID = folder.agentID;
- dbcmd.Parameters.Add(new MySqlParameter("?agentID", tmpID.ToStringHyphenated()));
- tmpID = folder.parentID;
- dbcmd.Parameters.Add(new MySqlParameter("?parentFolderID", tmpID.ToStringHyphenated()));
- dbcmd.Parameters.Add(new MySqlParameter("?folderName", folder.name));
- MySqlParameter p = dbcmd.Parameters.Add(new MySqlParameter("?category", MySqlDbType.Byte));
- p.Value = (byte)folder.category;
-
- p = dbcmd.Parameters.Add(new MySqlParameter("?folderType", MySqlDbType.Byte));
- p.Value = (byte)folder.type;
-
-
+ string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
+ sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
+
+ Dictionary parameters = new Dictionary();
+ parameters["?folderID"] = folder.folderID.ToStringHyphenated();
+ parameters["?agentID"] = folder.agentID.ToStringHyphenated();
+ parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
+ parameters["?folderName"] = folder.name;
+
bool returnval = false;
try
{
- if (dbcmd.ExecuteNonQuery() == 1)
+ IDbCommand result = Query(sql, parameters);
+
+ if (result.ExecuteNonQuery() == 1)
returnval = true;
+
+ result.Dispose();
}
catch (Exception e)
{
--
cgit v1.1