aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/PGSQLEstateData.cs
diff options
context:
space:
mode:
authorfernando2013-10-15 11:55:08 -0500
committerfernando2013-10-15 11:55:08 -0500
commit3e1ca2bd2136a51f23dff0d31f4725b4e05c3f7c (patch)
tree9fb7fd2e5f57862cdd5bfeff1355d7be761e75e6 /OpenSim/Data/PGSQL/PGSQLEstateData.cs
parentMade terrain uploads thread-safe (diff)
downloadopensim-SC-3e1ca2bd2136a51f23dff0d31f4725b4e05c3f7c.zip
opensim-SC-3e1ca2bd2136a51f23dff0d31f4725b4e05c3f7c.tar.gz
opensim-SC-3e1ca2bd2136a51f23dff0d31f4725b4e05c3f7c.tar.bz2
opensim-SC-3e1ca2bd2136a51f23dff0d31f4725b4e05c3f7c.tar.xz
* Fixes mantis #6802 Simulator crashes whist loading (lighshare enabled)
* Please test
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLEstateData.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLEstateData.cs b/OpenSim/Data/PGSQL/PGSQLEstateData.cs
index 347baf3..141b8ed 100644
--- a/OpenSim/Data/PGSQL/PGSQLEstateData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLEstateData.cs
@@ -201,11 +201,10 @@ namespace OpenSim.Data.PGSQL
201 201
202 string sql = string.Format("insert into estate_settings (\"{0}\") values ( :{1} )", String.Join("\",\"", names.ToArray()), String.Join(", :", names.ToArray())); 202 string sql = string.Format("insert into estate_settings (\"{0}\") values ( :{1} )", String.Join("\",\"", names.ToArray()), String.Join(", :", names.ToArray()));
203 203
204 m_log.Debug("[DB ESTATE]: SQL: " + sql);
205 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) 204 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
206 using (NpgsqlCommand insertCommand = new NpgsqlCommand(sql, conn)) 205 using (NpgsqlCommand insertCommand = new NpgsqlCommand(sql, conn))
207 { 206 {
208 insertCommand.CommandText = sql + "; Select cast(lastval() as int) as ID ;"; 207 insertCommand.CommandText = sql;
209 208
210 foreach (string name in names) 209 foreach (string name in names)
211 { 210 {
@@ -218,11 +217,16 @@ namespace OpenSim.Data.PGSQL
218 217
219 es.EstateID = 100; 218 es.EstateID = 100;
220 219
221 using (NpgsqlDataReader result = insertCommand.ExecuteReader()) 220 if (insertCommand.ExecuteNonQuery() > 0)
222 { 221 {
223 if (result.Read()) 222 insertCommand.CommandText = "Select cast(lastval() as int) as ID ;";
223
224 using (NpgsqlDataReader result = insertCommand.ExecuteReader())
224 { 225 {
225 es.EstateID = (uint)result.GetInt32(0); 226 if (result.Read())
227 {
228 es.EstateID = (uint)result.GetInt32(0);
229 }
226 } 230 }
227 } 231 }
228 232