aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLManager.cs
diff options
context:
space:
mode:
authorMW2007-06-27 15:28:52 +0000
committerMW2007-06-27 15:28:52 +0000
commit646bbbc84b8010e0dacbeed5342cdb045f46cc49 (patch)
tree770b34d19855363c3c113ab9a0af9a56d821d887 /OpenSim/Framework/Data.MySQL/MySQLManager.cs
downloadopensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.zip
opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.gz
opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.bz2
opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.xz
Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces.
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLManager.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs609
1 files changed, 609 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
new file mode 100644
index 0000000..53b3bdd
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -0,0 +1,609 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using System.Data;
32
33// MySQL Native
34using MySql;
35using MySql.Data;
36using MySql.Data.Types;
37using MySql.Data.MySqlClient;
38
39using OpenGrid.Framework.Data;
40
41namespace OpenGrid.Framework.Data.MySQL
42{
43 /// <summary>
44 /// A MySQL Database manager
45 /// </summary>
46 class MySQLManager
47 {
48 /// <summary>
49 /// The database connection object
50 /// </summary>
51 IDbConnection dbcon;
52 /// <summary>
53 /// Connection string for ADO.net
54 /// </summary>
55 string connectionString;
56
57 /// <summary>
58 /// Initialises and creates a new MySQL connection and maintains it.
59 /// </summary>
60 /// <param name="hostname">The MySQL server being connected to</param>
61 /// <param name="database">The name of the MySQL database being used</param>
62 /// <param name="username">The username logging into the database</param>
63 /// <param name="password">The password for the user logging in</param>
64 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
65 public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port)
66 {
67 try
68 {
69 connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
70 dbcon = new MySqlConnection(connectionString);
71
72 dbcon.Open();
73
74 System.Console.WriteLine("MySQL connection established");
75 }
76 catch (Exception e)
77 {
78 throw new Exception("Error initialising MySql Database: " + e.ToString());
79 }
80 }
81
82 /// <summary>
83 /// Shuts down the database connection
84 /// </summary>
85 public void Close()
86 {
87 dbcon.Close();
88 dbcon = null;
89 }
90
91 /// <summary>
92 /// Reconnects to the database
93 /// </summary>
94 public void Reconnect()
95 {
96 lock (dbcon)
97 {
98 try
99 {
100 // Close the DB connection
101 dbcon.Close();
102 // Try reopen it
103 dbcon = new MySqlConnection(connectionString);
104 dbcon.Open();
105 }
106 catch (Exception e)
107 {
108 Console.WriteLine("Unable to reconnect to database " + e.ToString());
109 }
110 }
111 }
112
113 /// <summary>
114 /// Runs a query with protection against SQL Injection by using parameterised input.
115 /// </summary>
116 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
117 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
118 /// <returns>A MySQL DB Command</returns>
119 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
120 {
121 try
122 {
123 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
124 dbcommand.CommandText = sql;
125 foreach (KeyValuePair<string, string> param in parameters)
126 {
127 dbcommand.Parameters.Add(param.Key, param.Value);
128 }
129
130 return (IDbCommand)dbcommand;
131 }
132 catch
133 {
134 lock (dbcon)
135 {
136 // Close the DB connection
137 try
138 {
139 dbcon.Close();
140 }
141 catch { }
142
143 // Try reopen it
144 try
145 {
146 dbcon = new MySqlConnection(connectionString);
147 dbcon.Open();
148 }
149 catch (Exception e)
150 {
151 Console.WriteLine("Unable to reconnect to database " + e.ToString());
152 }
153
154 // Run the query again
155 try
156 {
157 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
158 dbcommand.CommandText = sql;
159 foreach (KeyValuePair<string, string> param in parameters)
160 {
161 dbcommand.Parameters.Add(param.Key, param.Value);
162 }
163
164 return (IDbCommand)dbcommand;
165 }
166 catch (Exception e)
167 {
168 // Return null if it fails.
169 Console.WriteLine("Failed during Query generation: " + e.ToString());
170 return null;
171 }
172 }
173 }
174 }
175
176 /// <summary>
177 /// Reads a region row from a database reader
178 /// </summary>
179 /// <param name="reader">An active database reader</param>
180 /// <returns>A region profile</returns>
181 public SimProfileData readSimRow(IDataReader reader)
182 {
183 SimProfileData retval = new SimProfileData();
184
185 if (reader.Read())
186 {
187 // Region Main
188 retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString());
189 retval.regionName = (string)reader["regionName"];
190 retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]);
191
192 // Secrets
193 retval.regionRecvKey = (string)reader["regionRecvKey"];
194 retval.regionSecret = (string)reader["regionSecret"];
195 retval.regionSendKey = (string)reader["regionSendKey"];
196
197 // Region Server
198 retval.regionDataURI = (string)reader["regionDataURI"];
199 retval.regionOnline = false; // Needs to be pinged before this can be set.
200 retval.serverIP = (string)reader["serverIP"];
201 retval.serverPort = (uint)reader["serverPort"];
202 retval.serverURI = (string)reader["serverURI"];
203
204 // Location
205 retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString());
206 retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString());
207 retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString());
208
209 // Neighbours - 0 = No Override
210 retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString());
211 retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString());
212 retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString());
213 retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
214
215 // Assets
216 retval.regionAssetURI = (string)reader["regionAssetURI"];
217 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
218 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
219
220 // Userserver
221 retval.regionUserURI = (string)reader["regionUserURI"];
222 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
223 retval.regionUserSendKey = (string)reader["regionUserSendKey"];
224
225 // World Map Addition
226 string tempRegionMap = reader["regionMapTexture"].ToString();
227 if (tempRegionMap != "")
228 {
229 retval.regionMapTextureID = new libsecondlife.LLUUID(tempRegionMap);
230 }
231 else
232 {
233 retval.regionMapTextureID = new libsecondlife.LLUUID();
234 }
235 }
236 else
237 {
238 return null;
239 }
240 return retval;
241 }
242
243 /// <summary>
244 /// Reads a reservation row from a database reader
245 /// </summary>
246 /// <param name="reader">An active database reader</param>
247 /// <returns>A reservation data object</returns>
248 public ReservationData readReservationRow(IDataReader reader)
249 {
250 ReservationData retval = new ReservationData();
251 if (reader.Read())
252 {
253 retval.gridRecvKey = (string)reader["gridRecvKey"];
254 retval.gridSendKey = (string)reader["gridSendKey"];
255 retval.reservationCompany = (string)reader["resCompany"];
256 retval.reservationMaxX = (int)reader["resXMax"];
257 retval.reservationMaxY = (int)reader["resYMax"];
258 retval.reservationMinX = (int)reader["resXMin"];
259 retval.reservationMinY = (int)reader["resYMin"];
260 retval.reservationName = (string)reader["resName"];
261 retval.status = (bool)reader["status"];
262 retval.userUUID = new libsecondlife.LLUUID((string)reader["userUUID"]);
263
264 }
265 else
266 {
267 return null;
268 }
269 return retval;
270 }
271 /// <summary>
272 /// Reads an agent row from a database reader
273 /// </summary>
274 /// <param name="reader">An active database reader</param>
275 /// <returns>A user session agent</returns>
276 public UserAgentData readAgentRow(IDataReader reader)
277 {
278 UserAgentData retval = new UserAgentData();
279
280 if (reader.Read())
281 {
282 // Agent IDs
283 retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
284 retval.sessionID = new libsecondlife.LLUUID((string)reader["sessionID"]);
285 retval.secureSessionID = new libsecondlife.LLUUID((string)reader["secureSessionID"]);
286
287 // Agent Who?
288 retval.agentIP = (string)reader["agentIP"];
289 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
290 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
291
292 // Login/Logout times (UNIX Epoch)
293 retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString());
294 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
295
296 // Current position
297 retval.currentRegion = (string)reader["currentRegion"];
298 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
299 libsecondlife.LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
300 }
301 else
302 {
303 return null;
304 }
305 return retval;
306 }
307
308 /// <summary>
309 /// Reads a user profile from an active data reader
310 /// </summary>
311 /// <param name="reader">An active database reader</param>
312 /// <returns>A user profile</returns>
313 public UserProfileData readUserRow(IDataReader reader)
314 {
315 UserProfileData retval = new UserProfileData();
316
317 if (reader.Read())
318 {
319 retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
320 retval.username = (string)reader["username"];
321 retval.surname = (string)reader["lastname"];
322
323 retval.passwordHash = (string)reader["passwordHash"];
324 retval.passwordSalt = (string)reader["passwordSalt"];
325
326 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
327 retval.homeLocation = new libsecondlife.LLVector3(
328 Convert.ToSingle(reader["homeLocationX"].ToString()),
329 Convert.ToSingle(reader["homeLocationY"].ToString()),
330 Convert.ToSingle(reader["homeLocationZ"].ToString()));
331 retval.homeLookAt = new libsecondlife.LLVector3(
332 Convert.ToSingle(reader["homeLookAtX"].ToString()),
333 Convert.ToSingle(reader["homeLookAtY"].ToString()),
334 Convert.ToSingle(reader["homeLookAtZ"].ToString()));
335
336 retval.created = Convert.ToInt32(reader["created"].ToString());
337 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
338
339 retval.userInventoryURI = (string)reader["userInventoryURI"];
340 retval.userAssetURI = (string)reader["userAssetURI"];
341
342 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
343 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
344
345 retval.profileAboutText = (string)reader["profileAboutText"];
346 retval.profileFirstText = (string)reader["profileFirstText"];
347
348 retval.profileImage = new libsecondlife.LLUUID((string)reader["profileImage"]);
349 retval.profileFirstImage = new libsecondlife.LLUUID((string)reader["profileFirstImage"]);
350
351 }
352 else
353 {
354 return null;
355 }
356 return retval;
357 }
358
359 /// <summary>
360 /// Reads a list of inventory folders returned by a query.
361 /// </summary>
362 /// <param name="reader">A MySQL Data Reader</param>
363 /// <returns>A List containing inventory folders</returns>
364 public List<InventoryFolderBase> readInventoryFolders(IDataReader reader)
365 {
366 List<InventoryFolderBase> rows = new List<InventoryFolderBase>();
367
368 while(reader.Read())
369 {
370 try
371 {
372 InventoryFolderBase folder = new InventoryFolderBase();
373
374 folder.agentID = new libsecondlife.LLUUID((string)reader["agentID"]);
375 folder.parentID = new libsecondlife.LLUUID((string)reader["parentFolderID"]);
376 folder.folderID = new libsecondlife.LLUUID((string)reader["folderID"]);
377 folder.name = (string)reader["folderName"];
378
379 rows.Add(folder);
380 }
381 catch (Exception e)
382 {
383 Console.WriteLine(e.ToString());
384 }
385 }
386
387 return rows;
388 }
389
390 /// <summary>
391 /// Reads a collection of items from an SQL result
392 /// </summary>
393 /// <param name="reader">The SQL Result</param>
394 /// <returns>A List containing Inventory Items</returns>
395 public List<InventoryItemBase> readInventoryItems(IDataReader reader)
396 {
397 List<InventoryItemBase> rows = new List<InventoryItemBase>();
398
399 while (reader.Read())
400 {
401 try
402 {
403 InventoryItemBase item = new InventoryItemBase();
404
405 item.assetID = new libsecondlife.LLUUID((string)reader["assetID"]);
406 item.avatarID = new libsecondlife.LLUUID((string)reader["avatarID"]);
407 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString());
408 item.inventoryDescription = (string)reader["inventoryDescription"];
409 item.inventoryID = new libsecondlife.LLUUID((string)reader["inventoryID"]);
410 item.inventoryName = (string)reader["inventoryName"];
411 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString());
412 item.parentFolderID = new libsecondlife.LLUUID((string)reader["parentFolderID"]);
413 item.type = Convert.ToInt32(reader["type"].ToString());
414
415 rows.Add(item);
416 }
417 catch (Exception e)
418 {
419 Console.WriteLine(e.ToString());
420 }
421 }
422
423 return rows;
424 }
425
426 /// <summary>
427 /// Inserts a new row into the log database
428 /// </summary>
429 /// <param name="serverDaemon">The daemon which triggered this event</param>
430 /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param>
431 /// <param name="methodCall">The method call where the problem occured</param>
432 /// <param name="arguments">The arguments passed to the method</param>
433 /// <param name="priority">How critical is this?</param>
434 /// <param name="logMessage">Extra message info</param>
435 /// <returns>Saved successfully?</returns>
436 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
437 {
438 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
439 sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)";
440
441 Dictionary<string, string> parameters = new Dictionary<string, string>();
442 parameters["?server"] = serverDaemon;
443 parameters["?target"] = target;
444 parameters["?method"] = methodCall;
445 parameters["?arguments"] = arguments;
446 parameters["?priority"] = priority.ToString();
447 parameters["?message"] = logMessage;
448
449 bool returnval = false;
450
451 try
452 {
453 IDbCommand result = Query(sql, parameters);
454
455 if (result.ExecuteNonQuery() == 1)
456 returnval = true;
457
458 result.Dispose();
459 }
460 catch (Exception e)
461 {
462 Console.WriteLine(e.ToString());
463 return false;
464 }
465
466 return returnval;
467 }
468
469 /// <summary>
470 /// Inserts a new item into the database
471 /// </summary>
472 /// <param name="item">The item</param>
473 /// <returns>Success?</returns>
474 public bool insertItem(InventoryItemBase item)
475 {
476 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES ";
477 sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)";
478
479 Dictionary<string, string> parameters = new Dictionary<string, string>();
480 parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated();
481 parameters["?assetID"] = item.assetID.ToStringHyphenated();
482 parameters["?type"] = item.type.ToString();
483 parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated();
484 parameters["?avatarID"] = item.avatarID.ToStringHyphenated();
485 parameters["?inventoryName"] = item.inventoryName;
486 parameters["?inventoryDescription"] = item.inventoryDescription;
487 parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString();
488 parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString();
489
490 bool returnval = false;
491
492 try
493 {
494 IDbCommand result = Query(sql, parameters);
495
496 if (result.ExecuteNonQuery() == 1)
497 returnval = true;
498
499 result.Dispose();
500 }
501 catch (Exception e)
502 {
503 Console.WriteLine(e.ToString());
504 return false;
505 }
506
507 return returnval;
508 }
509
510 /// <summary>
511 /// Inserts a new folder into the database
512 /// </summary>
513 /// <param name="folder">The folder</param>
514 /// <returns>Success?</returns>
515 public bool insertFolder(InventoryFolderBase folder)
516 {
517 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
518 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
519
520 Dictionary<string, string> parameters = new Dictionary<string, string>();
521 parameters["?folderID"] = folder.folderID.ToStringHyphenated();
522 parameters["?agentID"] = folder.agentID.ToStringHyphenated();
523 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
524 parameters["?folderName"] = folder.name;
525
526 bool returnval = false;
527 try
528 {
529 IDbCommand result = Query(sql, parameters);
530
531 if (result.ExecuteNonQuery() == 1)
532 returnval = true;
533
534 result.Dispose();
535 }
536 catch (Exception e)
537 {
538 Console.WriteLine(e.ToString());
539 return false;
540 }
541 return returnval;
542 }
543
544 /// <summary>
545 /// Inserts a new region into the database
546 /// </summary>
547 /// <param name="profile">The region to insert</param>
548 /// <returns>Success?</returns>
549 public bool insertRegion(SimProfileData regiondata)
550 {
551 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
552 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
553 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture) VALUES ";
554
555 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
556 sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
557 sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture);";
558
559 Dictionary<string, string> parameters = new Dictionary<string, string>();
560
561 parameters["?regionHandle"] = regiondata.regionHandle.ToString();
562 parameters["?regionName"] = regiondata.regionName.ToString();
563 parameters["?uuid"] = regiondata.UUID.ToStringHyphenated();
564 parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString();
565 parameters["?regionSecret"] = regiondata.regionSecret.ToString();
566 parameters["?regionSendKey"] = regiondata.regionSendKey.ToString();
567 parameters["?regionDataURI"] = regiondata.regionDataURI.ToString();
568 parameters["?serverIP"] = regiondata.serverIP.ToString();
569 parameters["?serverPort"] = regiondata.serverPort.ToString();
570 parameters["?serverURI"] = regiondata.serverURI.ToString();
571 parameters["?locX"] = regiondata.regionLocX.ToString();
572 parameters["?locY"] = regiondata.regionLocY.ToString();
573 parameters["?locZ"] = regiondata.regionLocZ.ToString();
574 parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString();
575 parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString();
576 parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString();
577 parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString();
578 parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString();
579 parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString();
580 parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString();
581 parameters["?regionUserURI"] = regiondata.regionUserURI.ToString();
582 parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString();
583 parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString();
584 parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated();
585
586 bool returnval = false;
587
588 try
589 {
590
591 IDbCommand result = Query(sql, parameters);
592
593 //Console.WriteLine(result.CommandText);
594
595 if (result.ExecuteNonQuery() == 1)
596 returnval = true;
597
598 result.Dispose();
599 }
600 catch (Exception e)
601 {
602 Console.WriteLine(e.ToString());
603 return false;
604 }
605
606 return returnval;
607 }
608 }
609}