diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | 250 |
1 files changed, 83 insertions, 167 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index 5c3e94f..26e8eb9 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Framework.Data.MSSQL | |||
40 | /// <summary> | 40 | /// <summary> |
41 | /// A management class for the MS SQL Storage Engine | 41 | /// A management class for the MS SQL Storage Engine |
42 | /// </summary> | 42 | /// </summary> |
43 | internal class MSSQLManager | 43 | public class MSSQLManager |
44 | { | 44 | { |
45 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
@@ -57,63 +57,56 @@ namespace OpenSim.Framework.Data.MSSQL | |||
57 | public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, | 57 | public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, |
58 | string password) | 58 | string password) |
59 | { | 59 | { |
60 | try | 60 | connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog + |
61 | { | ||
62 | connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog + | ||
63 | ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + | 61 | ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + |
64 | password + ";"; | 62 | password + ";"; |
65 | dbcon = new SqlConnection(connectionString); | 63 | dbcon = new SqlConnection(connectionString); |
66 | dbcon.Open(); | 64 | dbcon.Open(); |
67 | } | ||
68 | catch (Exception e) | ||
69 | { | ||
70 | throw new Exception("Error initialising Sql Database: " + e.ToString()); | ||
71 | } | ||
72 | } | 65 | } |
73 | 66 | ||
74 | private DataTable createRegionsTable() | 67 | //private DataTable createRegionsTable() |
75 | { | 68 | //{ |
76 | DataTable regions = new DataTable("regions"); | 69 | // DataTable regions = new DataTable("regions"); |
77 | 70 | ||
78 | createCol(regions, "regionHandle", typeof (ulong)); | 71 | // createCol(regions, "regionHandle", typeof (ulong)); |
79 | createCol(regions, "regionName", typeof (String)); | 72 | // createCol(regions, "regionName", typeof (String)); |
80 | createCol(regions, "uuid", typeof (String)); | 73 | // createCol(regions, "uuid", typeof (String)); |
81 | 74 | ||
82 | createCol(regions, "regionRecvKey", typeof (String)); | 75 | // createCol(regions, "regionRecvKey", typeof (String)); |
83 | createCol(regions, "regionSecret", typeof (String)); | 76 | // createCol(regions, "regionSecret", typeof (String)); |
84 | createCol(regions, "regionSendKey", typeof (String)); | 77 | // createCol(regions, "regionSendKey", typeof (String)); |
85 | 78 | ||
86 | createCol(regions, "regionDataURI", typeof (String)); | 79 | // createCol(regions, "regionDataURI", typeof (String)); |
87 | createCol(regions, "serverIP", typeof (String)); | 80 | // createCol(regions, "serverIP", typeof (String)); |
88 | createCol(regions, "serverPort", typeof (String)); | 81 | // createCol(regions, "serverPort", typeof (String)); |
89 | createCol(regions, "serverURI", typeof (String)); | 82 | // createCol(regions, "serverURI", typeof (String)); |
90 | 83 | ||
91 | 84 | ||
92 | createCol(regions, "locX", typeof (uint)); | 85 | // createCol(regions, "locX", typeof (uint)); |
93 | createCol(regions, "locY", typeof (uint)); | 86 | // createCol(regions, "locY", typeof (uint)); |
94 | createCol(regions, "locZ", typeof (uint)); | 87 | // createCol(regions, "locZ", typeof (uint)); |
95 | 88 | ||
96 | createCol(regions, "eastOverrideHandle", typeof (ulong)); | 89 | // createCol(regions, "eastOverrideHandle", typeof (ulong)); |
97 | createCol(regions, "westOverrideHandle", typeof (ulong)); | 90 | // createCol(regions, "westOverrideHandle", typeof (ulong)); |
98 | createCol(regions, "southOverrideHandle", typeof (ulong)); | 91 | // createCol(regions, "southOverrideHandle", typeof (ulong)); |
99 | createCol(regions, "northOverrideHandle", typeof (ulong)); | 92 | // createCol(regions, "northOverrideHandle", typeof (ulong)); |
100 | 93 | ||
101 | createCol(regions, "regionAssetURI", typeof (String)); | 94 | // createCol(regions, "regionAssetURI", typeof (String)); |
102 | createCol(regions, "regionAssetRecvKey", typeof (String)); | 95 | // createCol(regions, "regionAssetRecvKey", typeof (String)); |
103 | createCol(regions, "regionAssetSendKey", typeof (String)); | 96 | // createCol(regions, "regionAssetSendKey", typeof (String)); |
104 | 97 | ||
105 | createCol(regions, "regionUserURI", typeof (String)); | 98 | // createCol(regions, "regionUserURI", typeof (String)); |
106 | createCol(regions, "regionUserRecvKey", typeof (String)); | 99 | // createCol(regions, "regionUserRecvKey", typeof (String)); |
107 | createCol(regions, "regionUserSendKey", typeof (String)); | 100 | // createCol(regions, "regionUserSendKey", typeof (String)); |
108 | 101 | ||
109 | createCol(regions, "regionMapTexture", typeof (String)); | 102 | // createCol(regions, "regionMapTexture", typeof (String)); |
110 | createCol(regions, "serverHttpPort", typeof (String)); | 103 | // createCol(regions, "serverHttpPort", typeof (String)); |
111 | createCol(regions, "serverRemotingPort", typeof (uint)); | 104 | // createCol(regions, "serverRemotingPort", typeof (uint)); |
112 | 105 | ||
113 | // Add in contraints | 106 | // // Add in contraints |
114 | regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]}; | 107 | // regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]}; |
115 | return regions; | 108 | // return regions; |
116 | } | 109 | //} |
117 | 110 | ||
118 | protected static void createCol(DataTable dt, string name, Type type) | 111 | protected static void createCol(DataTable dt, string name, Type type) |
119 | { | 112 | { |
@@ -149,19 +142,19 @@ namespace OpenSim.Framework.Data.MSSQL | |||
149 | // slightly differently. | 142 | // slightly differently. |
150 | private static string SqlType(Type type) | 143 | private static string SqlType(Type type) |
151 | { | 144 | { |
152 | if (type == typeof (String)) | 145 | if (type == typeof(String)) |
153 | { | 146 | { |
154 | return "varchar(255)"; | 147 | return "varchar(255)"; |
155 | } | 148 | } |
156 | else if (type == typeof (Int32)) | 149 | else if (type == typeof(Int32)) |
157 | { | 150 | { |
158 | return "integer"; | 151 | return "integer"; |
159 | } | 152 | } |
160 | else if (type == typeof (Double)) | 153 | else if (type == typeof(Double)) |
161 | { | 154 | { |
162 | return "float"; | 155 | return "float"; |
163 | } | 156 | } |
164 | else if (type == typeof (Byte[])) | 157 | else if (type == typeof(Byte[])) |
165 | { | 158 | { |
166 | return "image"; | 159 | return "image"; |
167 | } | 160 | } |
@@ -210,14 +203,14 @@ namespace OpenSim.Framework.Data.MSSQL | |||
210 | /// <returns>A Sql DB Command</returns> | 203 | /// <returns>A Sql DB Command</returns> |
211 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 204 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) |
212 | { | 205 | { |
213 | SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand(); | 206 | SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); |
214 | dbcommand.CommandText = sql; | 207 | dbcommand.CommandText = sql; |
215 | foreach (KeyValuePair<string, string> param in parameters) | 208 | foreach (KeyValuePair<string, string> param in parameters) |
216 | { | 209 | { |
217 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 210 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
218 | } | 211 | } |
219 | 212 | ||
220 | return (IDbCommand) dbcommand; | 213 | return (IDbCommand)dbcommand; |
221 | } | 214 | } |
222 | 215 | ||
223 | /// <summary> | 216 | /// <summary> |
@@ -233,20 +226,20 @@ namespace OpenSim.Framework.Data.MSSQL | |||
233 | { | 226 | { |
234 | // Region Main | 227 | // Region Main |
235 | regionprofile.regionHandle = Convert.ToUInt64(reader["regionHandle"]); | 228 | regionprofile.regionHandle = Convert.ToUInt64(reader["regionHandle"]); |
236 | regionprofile.regionName = (string) reader["regionName"]; | 229 | regionprofile.regionName = (string)reader["regionName"]; |
237 | regionprofile.UUID = new LLUUID((string) reader["uuid"]); | 230 | regionprofile.UUID = new LLUUID((string)reader["uuid"]); |
238 | 231 | ||
239 | // Secrets | 232 | // Secrets |
240 | regionprofile.regionRecvKey = (string) reader["regionRecvKey"]; | 233 | regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; |
241 | regionprofile.regionSecret = (string) reader["regionSecret"]; | 234 | regionprofile.regionSecret = (string)reader["regionSecret"]; |
242 | regionprofile.regionSendKey = (string) reader["regionSendKey"]; | 235 | regionprofile.regionSendKey = (string)reader["regionSendKey"]; |
243 | 236 | ||
244 | // Region Server | 237 | // Region Server |
245 | regionprofile.regionDataURI = (string) reader["regionDataURI"]; | 238 | regionprofile.regionDataURI = (string)reader["regionDataURI"]; |
246 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. | 239 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. |
247 | regionprofile.serverIP = (string) reader["serverIP"]; | 240 | regionprofile.serverIP = (string)reader["serverIP"]; |
248 | regionprofile.serverPort = Convert.ToUInt32(reader["serverPort"]); | 241 | regionprofile.serverPort = Convert.ToUInt32(reader["serverPort"]); |
249 | regionprofile.serverURI = (string) reader["serverURI"]; | 242 | regionprofile.serverURI = (string)reader["serverURI"]; |
250 | regionprofile.httpPort = Convert.ToUInt32(reader["serverHttpPort"]); | 243 | regionprofile.httpPort = Convert.ToUInt32(reader["serverHttpPort"]); |
251 | regionprofile.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"]); | 244 | regionprofile.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"]); |
252 | 245 | ||
@@ -263,14 +256,14 @@ namespace OpenSim.Framework.Data.MSSQL | |||
263 | regionprofile.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"]); | 256 | regionprofile.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"]); |
264 | 257 | ||
265 | // Assets | 258 | // Assets |
266 | regionprofile.regionAssetURI = (string) reader["regionAssetURI"]; | 259 | regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; |
267 | regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; | 260 | regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; |
268 | regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"]; | 261 | regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; |
269 | 262 | ||
270 | // Userserver | 263 | // Userserver |
271 | regionprofile.regionUserURI = (string) reader["regionUserURI"]; | 264 | regionprofile.regionUserURI = (string)reader["regionUserURI"]; |
272 | regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"]; | 265 | regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; |
273 | regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"]; | 266 | regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; |
274 | 267 | ||
275 | // World Map Addition | 268 | // World Map Addition |
276 | string tempRegionMap = reader["regionMapTexture"].ToString(); | 269 | string tempRegionMap = reader["regionMapTexture"].ToString(); |
@@ -302,12 +295,12 @@ namespace OpenSim.Framework.Data.MSSQL | |||
302 | 295 | ||
303 | if (reader.Read()) | 296 | if (reader.Read()) |
304 | { | 297 | { |
305 | retval.UUID = new LLUUID((string) reader["UUID"]); | 298 | retval.UUID = new LLUUID((string)reader["UUID"]); |
306 | retval.username = (string) reader["username"]; | 299 | retval.username = (string)reader["username"]; |
307 | retval.surname = (string) reader["lastname"]; | 300 | retval.surname = (string)reader["lastname"]; |
308 | 301 | ||
309 | retval.passwordHash = (string) reader["passwordHash"]; | 302 | retval.passwordHash = (string)reader["passwordHash"]; |
310 | retval.passwordSalt = (string) reader["passwordSalt"]; | 303 | retval.passwordSalt = (string)reader["passwordSalt"]; |
311 | 304 | ||
312 | retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); | 305 | retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); |
313 | retval.homeLocation = new LLVector3( | 306 | retval.homeLocation = new LLVector3( |
@@ -322,17 +315,17 @@ namespace OpenSim.Framework.Data.MSSQL | |||
322 | retval.created = Convert.ToInt32(reader["created"].ToString()); | 315 | retval.created = Convert.ToInt32(reader["created"].ToString()); |
323 | retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); | 316 | retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); |
324 | 317 | ||
325 | retval.userInventoryURI = (string) reader["userInventoryURI"]; | 318 | retval.userInventoryURI = (string)reader["userInventoryURI"]; |
326 | retval.userAssetURI = (string) reader["userAssetURI"]; | 319 | retval.userAssetURI = (string)reader["userAssetURI"]; |
327 | 320 | ||
328 | retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); | 321 | retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); |
329 | retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); | 322 | retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); |
330 | 323 | ||
331 | retval.profileAboutText = (string) reader["profileAboutText"]; | 324 | retval.profileAboutText = (string)reader["profileAboutText"]; |
332 | retval.profileFirstText = (string) reader["profileFirstText"]; | 325 | retval.profileFirstText = (string)reader["profileFirstText"]; |
333 | 326 | ||
334 | retval.profileImage = new LLUUID((string) reader["profileImage"]); | 327 | retval.profileImage = new LLUUID((string)reader["profileImage"]); |
335 | retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]); | 328 | retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); |
336 | retval.webLoginKey = new LLUUID((string)reader["webLoginKey"]); | 329 | retval.webLoginKey = new LLUUID((string)reader["webLoginKey"]); |
337 | } | 330 | } |
338 | else | 331 | else |
@@ -354,12 +347,12 @@ namespace OpenSim.Framework.Data.MSSQL | |||
354 | if (reader.Read()) | 347 | if (reader.Read()) |
355 | { | 348 | { |
356 | // Agent IDs | 349 | // Agent IDs |
357 | retval.UUID = new LLUUID((string) reader["UUID"]); | 350 | retval.UUID = new LLUUID((string)reader["UUID"]); |
358 | retval.sessionID = new LLUUID((string) reader["sessionID"]); | 351 | retval.sessionID = new LLUUID((string)reader["sessionID"]); |
359 | retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]); | 352 | retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); |
360 | 353 | ||
361 | // Agent Who? | 354 | // Agent Who? |
362 | retval.agentIP = (string) reader["agentIP"]; | 355 | retval.agentIP = (string)reader["agentIP"]; |
363 | retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); | 356 | retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); |
364 | retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); | 357 | retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); |
365 | 358 | ||
@@ -368,9 +361,9 @@ namespace OpenSim.Framework.Data.MSSQL | |||
368 | retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); | 361 | retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); |
369 | 362 | ||
370 | // Current position | 363 | // Current position |
371 | retval.currentRegion = (string) reader["currentRegion"]; | 364 | retval.currentRegion = (string)reader["currentRegion"]; |
372 | retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); | 365 | retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); |
373 | LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos); | 366 | LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); |
374 | } | 367 | } |
375 | else | 368 | else |
376 | { | 369 | { |
@@ -387,12 +380,12 @@ namespace OpenSim.Framework.Data.MSSQL | |||
387 | // Region Main | 380 | // Region Main |
388 | 381 | ||
389 | asset = new AssetBase(); | 382 | asset = new AssetBase(); |
390 | asset.Data = (byte[]) reader["data"]; | 383 | asset.Data = (byte[])reader["data"]; |
391 | asset.Description = (string) reader["description"]; | 384 | asset.Description = (string)reader["description"]; |
392 | asset.FullID = new LLUUID((string) reader["id"]); | 385 | asset.FullID = new LLUUID((string)reader["id"]); |
393 | asset.InvType = Convert.ToSByte(reader["invType"]); | 386 | asset.InvType = Convert.ToSByte(reader["invType"]); |
394 | asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; | 387 | asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; |
395 | asset.Name = (string) reader["name"]; | 388 | asset.Name = (string)reader["name"]; |
396 | asset.Type = Convert.ToSByte(reader["assetType"]); | 389 | asset.Type = Convert.ToSByte(reader["assetType"]); |
397 | } | 390 | } |
398 | else | 391 | else |
@@ -402,76 +395,6 @@ namespace OpenSim.Framework.Data.MSSQL | |||
402 | return asset; | 395 | return asset; |
403 | } | 396 | } |
404 | 397 | ||
405 | /// <summary> | ||
406 | /// Creates a new region in the database | ||
407 | /// </summary> | ||
408 | /// <param name="profile">The region profile to insert</param> | ||
409 | /// <returns>Successful?</returns> | ||
410 | public bool insertRegionRow(RegionProfileData profile) | ||
411 | { | ||
412 | //Insert new region | ||
413 | string sql = | ||
414 | "INSERT INTO regions ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], "; | ||
415 | sql += | ||
416 | "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], "; | ||
417 | sql += | ||
418 | "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES "; | ||
419 | |||
420 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | ||
421 | sql += | ||
422 | "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | ||
423 | sql += | ||
424 | "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);"; | ||
425 | |||
426 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
427 | |||
428 | parameters["regionHandle"] = profile.regionHandle.ToString(); | ||
429 | parameters["regionName"] = profile.regionName; | ||
430 | parameters["uuid"] = profile.UUID.ToString(); | ||
431 | parameters["regionRecvKey"] = profile.regionRecvKey; | ||
432 | parameters["regionSecret"] = profile.regionSecret; | ||
433 | parameters["regionSendKey"] = profile.regionSendKey; | ||
434 | parameters["regionDataURI"] = profile.regionDataURI; | ||
435 | parameters["serverIP"] = profile.serverIP; | ||
436 | parameters["serverPort"] = profile.serverPort.ToString(); | ||
437 | parameters["serverURI"] = profile.serverURI; | ||
438 | parameters["locX"] = profile.regionLocX.ToString(); | ||
439 | parameters["locY"] = profile.regionLocY.ToString(); | ||
440 | parameters["locZ"] = profile.regionLocZ.ToString(); | ||
441 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); | ||
442 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); | ||
443 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); | ||
444 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); | ||
445 | parameters["regionAssetURI"] = profile.regionAssetURI; | ||
446 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; | ||
447 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; | ||
448 | parameters["regionUserURI"] = profile.regionUserURI; | ||
449 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; | ||
450 | parameters["regionUserSendKey"] = profile.regionUserSendKey; | ||
451 | parameters["regionMapTexture"] = profile.regionMapTextureID.ToString(); | ||
452 | parameters["serverHttpPort"] = profile.httpPort.ToString(); | ||
453 | parameters["serverRemotingPort"] = profile.remotingPort.ToString(); | ||
454 | |||
455 | |||
456 | bool returnval = false; | ||
457 | |||
458 | try | ||
459 | { | ||
460 | IDbCommand result = Query(sql, parameters); | ||
461 | |||
462 | if (result.ExecuteNonQuery() == 1) | ||
463 | returnval = true; | ||
464 | |||
465 | result.Dispose(); | ||
466 | } | ||
467 | catch (Exception e) | ||
468 | { | ||
469 | m_log.Error("MSSQLManager : " + e.ToString()); | ||
470 | } | ||
471 | |||
472 | return returnval; | ||
473 | } | ||
474 | |||
475 | 398 | ||
476 | /// <summary> | 399 | /// <summary> |
477 | /// Inserts a new row into the log database | 400 | /// Inserts a new row into the log database |
@@ -617,21 +540,14 @@ namespace OpenSim.Framework.Data.MSSQL | |||
617 | /// <param name="name"></param> | 540 | /// <param name="name"></param> |
618 | public void ExecuteResourceSql(string name) | 541 | public void ExecuteResourceSql(string name) |
619 | { | 542 | { |
620 | try | 543 | SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon); |
621 | { | 544 | cmd.ExecuteNonQuery(); |
622 | SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection) dbcon); | 545 | cmd.Dispose(); |
623 | cmd.ExecuteNonQuery(); | ||
624 | cmd.Dispose(); | ||
625 | } | ||
626 | catch (Exception e) | ||
627 | { | ||
628 | m_log.Error("Unable to execute query " + e.ToString()); | ||
629 | } | ||
630 | } | 546 | } |
631 | 547 | ||
632 | public SqlConnection getConnection() | 548 | public SqlConnection getConnection() |
633 | { | 549 | { |
634 | return (SqlConnection) dbcon; | 550 | return (SqlConnection)dbcon; |
635 | } | 551 | } |
636 | 552 | ||
637 | /// <summary> | 553 | /// <summary> |
@@ -652,7 +568,7 @@ namespace OpenSim.Framework.Data.MSSQL | |||
652 | { | 568 | { |
653 | try | 569 | try |
654 | { | 570 | { |
655 | string tableName = (string) tables["TABLE_NAME"]; | 571 | string tableName = (string)tables["TABLE_NAME"]; |
656 | if (tableList.ContainsKey(tableName)) | 572 | if (tableList.ContainsKey(tableName)) |
657 | tableList[tableName] = tableName; | 573 | tableList[tableName] = tableName; |
658 | } | 574 | } |