aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLManager.cs
diff options
context:
space:
mode:
authorlbsa712007-09-27 13:25:45 +0000
committerlbsa712007-09-27 13:25:45 +0000
commit8143c597fc5f62ec0d931d2d5b887730e06aec04 (patch)
treeae67873a5f801b2b7bdf9a7b088db98beb97b5ac /OpenSim/Framework/Data.MySQL/MySQLManager.cs
parentTerrain: (diff)
downloadopensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.zip
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.gz
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.bz2
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.xz
* Tleiades grid mode inventory (#444) - thanx Tleiades!
* updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423)
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLManager.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs58
1 files changed, 35 insertions, 23 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index 5037f98..e55606e 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Data.MySQL
41 /// <summary> 41 /// <summary>
42 /// The database connection object 42 /// The database connection object
43 /// </summary> 43 /// </summary>
44 IDbConnection dbcon; 44 MySqlConnection dbcon;
45 /// <summary> 45 /// <summary>
46 /// Connection string for ADO.net 46 /// Connection string for ADO.net
47 /// </summary> 47 /// </summary>
@@ -115,10 +115,11 @@ namespace OpenSim.Framework.Data.MySQL
115 { 115 {
116 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 116 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
117 dbcommand.CommandText = sql; 117 dbcommand.CommandText = sql;
118 foreach (KeyValuePair<string, string> param in parameters) 118 if(parameters != null)
119 { 119 foreach (KeyValuePair<string, string> param in parameters)
120 dbcommand.Parameters.Add(param.Key, param.Value); 120 {
121 } 121 dbcommand.Parameters.Add(param.Key, param.Value);
122 }
122 123
123 return (IDbCommand)dbcommand; 124 return (IDbCommand)dbcommand;
124 } 125 }
@@ -149,10 +150,11 @@ namespace OpenSim.Framework.Data.MySQL
149 { 150 {
150 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 151 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
151 dbcommand.CommandText = sql; 152 dbcommand.CommandText = sql;
152 foreach (KeyValuePair<string, string> param in parameters) 153 if(parameters != null)
153 { 154 foreach (KeyValuePair<string, string> param in parameters)
154 dbcommand.Parameters.Add(param.Key, param.Value); 155 {
155 } 156 dbcommand.Parameters.Add(param.Key, param.Value);
157 }
156 158
157 return (IDbCommand)dbcommand; 159 return (IDbCommand)dbcommand;
158 } 160 }
@@ -370,6 +372,8 @@ namespace OpenSim.Framework.Data.MySQL
370 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 372 folder.parentID = new LLUUID((string)reader["parentFolderID"]);
371 folder.folderID = new LLUUID((string)reader["folderID"]); 373 folder.folderID = new LLUUID((string)reader["folderID"]);
372 folder.name = (string)reader["folderName"]; 374 folder.name = (string)reader["folderName"];
375 folder.category = (InventoryCategory)((Int16)reader["category"]);
376 folder.type = (Int16)reader["folderType"];
373 377
374 rows.Add(folder); 378 rows.Add(folder);
375 } 379 }
@@ -509,24 +513,32 @@ namespace OpenSim.Framework.Data.MySQL
509 /// <returns>Success?</returns> 513 /// <returns>Success?</returns>
510 public bool insertFolder(InventoryFolderBase folder) 514 public bool insertFolder(InventoryFolderBase folder)
511 { 515 {
512 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; 516 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, category, folderType) VALUES ";
513 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)"; 517 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?category, ?folderType)";
514 518
515 Dictionary<string, string> parameters = new Dictionary<string, string>(); 519 MySqlCommand dbcmd = dbcon.CreateCommand();
516 parameters["?folderID"] = folder.folderID.ToStringHyphenated(); 520 dbcmd.CommandText = sql;
517 parameters["?agentID"] = folder.agentID.ToStringHyphenated(); 521
518 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated(); 522 LLUUID tmpID = folder.folderID;
519 parameters["?folderName"] = folder.name; 523 dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
520 524 dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
525 tmpID = folder.agentID;
526 dbcmd.Parameters.Add(new MySqlParameter("?agentID", tmpID.ToStringHyphenated()));
527 tmpID = folder.parentID;
528 dbcmd.Parameters.Add(new MySqlParameter("?parentFolderID", tmpID.ToStringHyphenated()));
529 dbcmd.Parameters.Add(new MySqlParameter("?folderName", folder.name));
530 MySqlParameter p = dbcmd.Parameters.Add(new MySqlParameter("?category", MySqlDbType.Byte));
531 p.Value = (byte)folder.category;
532
533 p = dbcmd.Parameters.Add(new MySqlParameter("?folderType", MySqlDbType.Byte));
534 p.Value = (byte)folder.type;
535
536
521 bool returnval = false; 537 bool returnval = false;
522 try 538 try
523 { 539 {
524 IDbCommand result = Query(sql, parameters); 540 if (dbcmd.ExecuteNonQuery() == 1)
525
526 if (result.ExecuteNonQuery() == 1)
527 returnval = true; 541 returnval = true;
528
529 result.Dispose();
530 } 542 }
531 catch (Exception e) 543 catch (Exception e)
532 { 544 {