aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs31
1 files changed, 15 insertions, 16 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index 46fd1bc..d422687 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -138,13 +138,11 @@ namespace OpenSim.Framework.Data.MySQL
138 string dllName = module.Assembly.ManifestModule.Name; 138 string dllName = module.Assembly.ManifestModule.Name;
139 Version dllVersion = module.Assembly.GetName().Version; 139 Version dllVersion = module.Assembly.GetName().Version;
140 140
141
142 return 141 return
143 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, 142 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
144 dllVersion.Revision); 143 dllVersion.Revision);
145 } 144 }
146 145
147
148 /// <summary> 146 /// <summary>
149 /// Extract a named string resource from the embedded resources 147 /// Extract a named string resource from the embedded resources
150 /// </summary> 148 /// </summary>
@@ -156,7 +154,9 @@ namespace OpenSim.Framework.Data.MySQL
156 string[] names = assem.GetManifestResourceNames(); 154 string[] names = assem.GetManifestResourceNames();
157 155
158 foreach (string s in names) 156 foreach (string s in names)
157 {
159 if (s.EndsWith(name)) 158 if (s.EndsWith(name))
159 {
160 using (Stream resource = assem.GetManifestResourceStream(s)) 160 using (Stream resource = assem.GetManifestResourceStream(s))
161 { 161 {
162 using (StreamReader resourceReader = new StreamReader(resource)) 162 using (StreamReader resourceReader = new StreamReader(resource))
@@ -165,6 +165,8 @@ namespace OpenSim.Framework.Data.MySQL
165 return resourceString; 165 return resourceString;
166 } 166 }
167 } 167 }
168 }
169 }
168 throw new Exception(string.Format("Resource '{0}' was not found", name)); 170 throw new Exception(string.Format("Resource '{0}' was not found", name));
169 } 171 }
170 172
@@ -214,8 +216,7 @@ namespace OpenSim.Framework.Data.MySQL
214 } 216 }
215 } 217 }
216 218
217 219 // TODO: at some time this code should be cleaned up
218 // at some time this code should be cleaned up
219 220
220 /// <summary> 221 /// <summary>
221 /// Runs a query with protection against SQL Injection by using parameterised input. 222 /// Runs a query with protection against SQL Injection by using parameterised input.
@@ -249,7 +250,7 @@ namespace OpenSim.Framework.Data.MySQL
249 { 250 {
250 } 251 }
251 252
252 // Try reopen it 253 // Try to reopen it
253 try 254 try
254 { 255 {
255 dbcon = new MySqlConnection(connectionString); 256 dbcon = new MySqlConnection(connectionString);
@@ -368,7 +369,7 @@ namespace OpenSim.Framework.Data.MySQL
368 retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); 369 retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString());
369 retval.reservationName = (string) reader["resName"]; 370 retval.reservationName = (string) reader["resName"];
370 retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; 371 retval.status = Convert.ToInt32(reader["status"].ToString()) == 1;
371 LLUUID.TryParse((string) reader["userUUID"], out retval.userUUID); 372 LLUUID.TryParse((string) reader["userUUID"], out retval.userUUID);
372 } 373 }
373 else 374 else
374 { 375 {
@@ -458,22 +459,22 @@ namespace OpenSim.Framework.Data.MySQL
458 else 459 else
459 retval.profileAboutText = (string) reader["profileAboutText"]; 460 retval.profileAboutText = (string) reader["profileAboutText"];
460 461
461 if (reader.IsDBNull( reader.GetOrdinal( "profileFirstText" ) ) ) 462 if (reader.IsDBNull(reader.GetOrdinal("profileFirstText")))
462 retval.profileFirstText = ""; 463 retval.profileFirstText = "";
463 else 464 else
464 retval.profileFirstText = (string)reader["profileFirstText"]; 465 retval.profileFirstText = (string)reader["profileFirstText"];
465 466
466 if (reader.IsDBNull( reader.GetOrdinal( "profileImage" ) ) ) 467 if (reader.IsDBNull(reader.GetOrdinal("profileImage")))
467 retval.profileImage = LLUUID.Zero; 468 retval.profileImage = LLUUID.Zero;
468 else 469 else
469 LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage); 470 LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage);
470 471
471 if (reader.IsDBNull( reader.GetOrdinal( "profileFirstImage" ) ) ) 472 if (reader.IsDBNull(reader.GetOrdinal("profileFirstImage")))
472 retval.profileFirstImage = LLUUID.Zero; 473 retval.profileFirstImage = LLUUID.Zero;
473 else 474 else
474 LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage); 475 LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage);
475 476
476 if( reader.IsDBNull( reader.GetOrdinal( "webLoginKey" ) ) ) 477 if(reader.IsDBNull(reader.GetOrdinal("webLoginKey")))
477 { 478 {
478 retval.webLoginKey = LLUUID.Zero; 479 retval.webLoginKey = LLUUID.Zero;
479 } 480 }
@@ -489,7 +490,6 @@ namespace OpenSim.Framework.Data.MySQL
489 return retval; 490 return retval;
490 } 491 }
491 492
492
493 /// <summary> 493 /// <summary>
494 /// Inserts a new row into the log database 494 /// Inserts a new row into the log database
495 /// </summary> 495 /// </summary>
@@ -534,7 +534,6 @@ namespace OpenSim.Framework.Data.MySQL
534 return returnval; 534 return returnval;
535 } 535 }
536 536
537
538 /// <summary> 537 /// <summary>
539 /// Creates a new user and inserts it into the database 538 /// Creates a new user and inserts it into the database
540 /// </summary> 539 /// </summary>
@@ -630,7 +629,7 @@ namespace OpenSim.Framework.Data.MySQL
630 return returnval; 629 return returnval;
631 } 630 }
632 631
633 /// <summary> 632 /// <summary>
634 /// Creates a new user and inserts it into the database 633 /// Creates a new user and inserts it into the database
635 /// </summary> 634 /// </summary>
636 /// <param name="uuid">User ID</param> 635 /// <param name="uuid">User ID</param>
@@ -823,6 +822,7 @@ namespace OpenSim.Framework.Data.MySQL
823 822
824 return returnval; 823 return returnval;
825 } 824 }
825
826 /// <summary> 826 /// <summary>
827 /// Delete a region from the database 827 /// Delete a region from the database
828 /// </summary> 828 /// </summary>
@@ -833,14 +833,13 @@ namespace OpenSim.Framework.Data.MySQL
833 { 833 {
834 bool returnval = false; 834 bool returnval = false;
835 835
836 string sql = 836 string sql = "DELETE FROM regions WHERE uuid = ?uuid;";
837 "DELETE FROM regions WHERE uuid = ?uuid;";
838 837
839 Dictionary<string, string> parameters = new Dictionary<string, string>(); 838 Dictionary<string, string> parameters = new Dictionary<string, string>();
840 839
841 try 840 try
842 { 841 {
843 parameters["?uuid"] = uuid; 842 parameters["?uuid"] = uuid;
844 843
845 IDbCommand result = Query(sql, parameters); 844 IDbCommand result = Query(sql, parameters);
846 845