diff options
author | Jeff Ames | 2008-08-18 00:39:10 +0000 |
---|---|---|
committer | Jeff Ames | 2008-08-18 00:39:10 +0000 |
commit | 6ef9d4da901a346c232458317cca6268da888e2e (patch) | |
tree | dd1d935b10f34f261839da9f9879c02322e8ede7 /OpenSim/Data/MySQL/MySQLEstateData.cs | |
parent | Update svn properties, minor formatting cleanup. (diff) | |
download | opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.zip opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.gz opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.bz2 opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLEstateData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 8991e02..2ab7d40 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Data.MySQL | |||
51 | private string m_connectionString; | 51 | private string m_connectionString; |
52 | private long m_waitTimeout; | 52 | private long m_waitTimeout; |
53 | private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond; | 53 | private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond; |
54 | private long m_lastConnectionUse; | 54 | private long m_lastConnectionUse; |
55 | 55 | ||
56 | private FieldInfo[] m_Fields; | 56 | private FieldInfo[] m_Fields; |
57 | private Dictionary<string, FieldInfo> m_FieldMap = | 57 | private Dictionary<string, FieldInfo> m_FieldMap = |
@@ -83,13 +83,13 @@ namespace OpenSim.Data.MySQL | |||
83 | } | 83 | } |
84 | 84 | ||
85 | m_log.Info("[REGION DB]: MySql - connecting: " + displayConnectionString); | 85 | m_log.Info("[REGION DB]: MySql - connecting: " + displayConnectionString); |
86 | 86 | ||
87 | //m_log.Info("[ESTATE DB]: MySql - connecting: "+m_connectionString); | 87 | //m_log.Info("[ESTATE DB]: MySql - connecting: "+m_connectionString); |
88 | 88 | ||
89 | m_connection = new MySqlConnection(m_connectionString); | 89 | m_connection = new MySqlConnection(m_connectionString); |
90 | m_connection.Open(); | 90 | m_connection.Open(); |
91 | 91 | ||
92 | GetWaitTimeout(); | 92 | GetWaitTimeout(); |
93 | 93 | ||
94 | Assembly assem = GetType().Assembly; | 94 | Assembly assem = GetType().Assembly; |
95 | Migration m = new Migration(m_connection, assem, "EstateStore"); | 95 | Migration m = new Migration(m_connection, assem, "EstateStore"); |
@@ -106,7 +106,7 @@ namespace OpenSim.Data.MySQL | |||
106 | m_FieldMap[f.Name.Substring(2)] = f; | 106 | m_FieldMap[f.Name.Substring(2)] = f; |
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | private string[] FieldList | 110 | private string[] FieldList |
111 | { | 111 | { |
112 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } | 112 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } |
@@ -116,28 +116,28 @@ namespace OpenSim.Data.MySQL | |||
116 | { | 116 | { |
117 | MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, | 117 | MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, |
118 | m_connection); | 118 | m_connection); |
119 | 119 | ||
120 | using (MySqlDataReader dbReader = | 120 | using (MySqlDataReader dbReader = |
121 | cmd.ExecuteReader(CommandBehavior.SingleRow)) | 121 | cmd.ExecuteReader(CommandBehavior.SingleRow)) |
122 | { | 122 | { |
123 | if (dbReader.Read()) | 123 | if (dbReader.Read()) |
124 | { | 124 | { |
125 | m_waitTimeout | 125 | m_waitTimeout |
126 | = Convert.ToInt32(dbReader["@@wait_timeout"]) * | 126 | = Convert.ToInt32(dbReader["@@wait_timeout"]) * |
127 | TimeSpan.TicksPerSecond + m_waitTimeoutLeeway; | 127 | TimeSpan.TicksPerSecond + m_waitTimeoutLeeway; |
128 | } | 128 | } |
129 | 129 | ||
130 | dbReader.Close(); | 130 | dbReader.Close(); |
131 | cmd.Dispose(); | 131 | cmd.Dispose(); |
132 | } | 132 | } |
133 | 133 | ||
134 | m_lastConnectionUse = System.DateTime.Now.Ticks; | 134 | m_lastConnectionUse = System.DateTime.Now.Ticks; |
135 | 135 | ||
136 | m_log.DebugFormat( | 136 | m_log.DebugFormat( |
137 | "[REGION DB]: Connection wait timeout {0} seconds", | 137 | "[REGION DB]: Connection wait timeout {0} seconds", |
138 | m_waitTimeout / TimeSpan.TicksPerSecond); | 138 | m_waitTimeout / TimeSpan.TicksPerSecond); |
139 | } | 139 | } |
140 | 140 | ||
141 | protected void CheckConnection() | 141 | protected void CheckConnection() |
142 | { | 142 | { |
143 | long timeNow = System.DateTime.Now.Ticks; | 143 | long timeNow = System.DateTime.Now.Ticks; |
@@ -145,17 +145,17 @@ namespace OpenSim.Data.MySQL | |||
145 | m_connection.State != ConnectionState.Open) | 145 | m_connection.State != ConnectionState.Open) |
146 | { | 146 | { |
147 | m_log.DebugFormat("[REGION DB]: Database connection has gone away - reconnecting"); | 147 | m_log.DebugFormat("[REGION DB]: Database connection has gone away - reconnecting"); |
148 | 148 | ||
149 | lock (m_connection) | 149 | lock (m_connection) |
150 | { | 150 | { |
151 | m_connection.Close(); | 151 | m_connection.Close(); |
152 | m_connection = new MySqlConnection(m_connectionString); | 152 | m_connection = new MySqlConnection(m_connectionString); |
153 | m_connection.Open(); | 153 | m_connection.Open(); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | m_lastConnectionUse = timeNow; | 157 | m_lastConnectionUse = timeNow; |
158 | } | 158 | } |
159 | 159 | ||
160 | public EstateSettings LoadEstateSettings(LLUUID regionID) | 160 | public EstateSettings LoadEstateSettings(LLUUID regionID) |
161 | { | 161 | { |
@@ -210,7 +210,7 @@ namespace OpenSim.Data.MySQL | |||
210 | names.Remove("EstateID"); | 210 | names.Remove("EstateID"); |
211 | 211 | ||
212 | sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( ?"+String.Join(", ?", names.ToArray())+")"; | 212 | sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( ?"+String.Join(", ?", names.ToArray())+")"; |
213 | 213 | ||
214 | cmd.CommandText = sql; | 214 | cmd.CommandText = sql; |
215 | cmd.Parameters.Clear(); | 215 | cmd.Parameters.Clear(); |
216 | 216 | ||
@@ -318,7 +318,7 @@ namespace OpenSim.Data.MySQL | |||
318 | es.ClearBans(); | 318 | es.ClearBans(); |
319 | 319 | ||
320 | CheckConnection(); | 320 | CheckConnection(); |
321 | 321 | ||
322 | MySqlCommand cmd = m_connection.CreateCommand(); | 322 | MySqlCommand cmd = m_connection.CreateCommand(); |
323 | 323 | ||
324 | cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID"; | 324 | cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID"; |
@@ -344,18 +344,18 @@ namespace OpenSim.Data.MySQL | |||
344 | private void SaveBanList(EstateSettings es) | 344 | private void SaveBanList(EstateSettings es) |
345 | { | 345 | { |
346 | CheckConnection(); | 346 | CheckConnection(); |
347 | 347 | ||
348 | MySqlCommand cmd = m_connection.CreateCommand(); | 348 | MySqlCommand cmd = m_connection.CreateCommand(); |
349 | 349 | ||
350 | cmd.CommandText = "delete from estateban where EstateID = ?EstateID"; | 350 | cmd.CommandText = "delete from estateban where EstateID = ?EstateID"; |
351 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | 351 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); |
352 | 352 | ||
353 | cmd.ExecuteNonQuery(); | 353 | cmd.ExecuteNonQuery(); |
354 | 354 | ||
355 | cmd.Parameters.Clear(); | 355 | cmd.Parameters.Clear(); |
356 | 356 | ||
357 | cmd.CommandText = "insert into estateban (EstateID, bannedUUID) values ( ?EstateID, ?bannedUUID )"; | 357 | cmd.CommandText = "insert into estateban (EstateID, bannedUUID) values ( ?EstateID, ?bannedUUID )"; |
358 | 358 | ||
359 | foreach (EstateBan b in es.EstateBans) | 359 | foreach (EstateBan b in es.EstateBans) |
360 | { | 360 | { |
361 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | 361 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); |
@@ -369,18 +369,18 @@ namespace OpenSim.Data.MySQL | |||
369 | void SaveUUIDList(uint EstateID, string table, LLUUID[] data) | 369 | void SaveUUIDList(uint EstateID, string table, LLUUID[] data) |
370 | { | 370 | { |
371 | CheckConnection(); | 371 | CheckConnection(); |
372 | 372 | ||
373 | MySqlCommand cmd = m_connection.CreateCommand(); | 373 | MySqlCommand cmd = m_connection.CreateCommand(); |
374 | 374 | ||
375 | cmd.CommandText = "delete from "+table+" where EstateID = ?EstateID"; | 375 | cmd.CommandText = "delete from "+table+" where EstateID = ?EstateID"; |
376 | cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString()); | 376 | cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString()); |
377 | 377 | ||
378 | cmd.ExecuteNonQuery(); | 378 | cmd.ExecuteNonQuery(); |
379 | 379 | ||
380 | cmd.Parameters.Clear(); | 380 | cmd.Parameters.Clear(); |
381 | 381 | ||
382 | cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( ?EstateID, ?uuid )"; | 382 | cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( ?EstateID, ?uuid )"; |
383 | 383 | ||
384 | foreach (LLUUID uuid in data) | 384 | foreach (LLUUID uuid in data) |
385 | { | 385 | { |
386 | cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString()); | 386 | cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString()); |
@@ -396,7 +396,7 @@ namespace OpenSim.Data.MySQL | |||
396 | List<LLUUID> uuids = new List<LLUUID>(); | 396 | List<LLUUID> uuids = new List<LLUUID>(); |
397 | 397 | ||
398 | CheckConnection(); | 398 | CheckConnection(); |
399 | 399 | ||
400 | MySqlCommand cmd = m_connection.CreateCommand(); | 400 | MySqlCommand cmd = m_connection.CreateCommand(); |
401 | 401 | ||
402 | cmd.CommandText = "select uuid from "+table+" where EstateID = ?EstateID"; | 402 | cmd.CommandText = "select uuid from "+table+" where EstateID = ?EstateID"; |
@@ -414,7 +414,7 @@ namespace OpenSim.Data.MySQL | |||
414 | uuids.Add(uuid); | 414 | uuids.Add(uuid); |
415 | } | 415 | } |
416 | r.Close(); | 416 | r.Close(); |
417 | 417 | ||
418 | return uuids.ToArray(); | 418 | return uuids.ToArray(); |
419 | } | 419 | } |
420 | } | 420 | } |