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