aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorfernando2013-10-15 11:55:08 -0500
committerfernando2013-10-15 11:55:08 -0500
commit3e1ca2bd2136a51f23dff0d31f4725b4e05c3f7c (patch)
tree9fb7fd2e5f57862cdd5bfeff1355d7be761e75e6
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
-rw-r--r--OpenSim/Data/PGSQL/PGSQLEstateData.cs14
-rw-r--r--OpenSim/Data/PGSQL/PGSQLSimulationData.cs8
-rw-r--r--OpenSim/Data/PGSQL/Resources/InventoryStore.migrations9
-rw-r--r--OpenSim/Data/PGSQL/Resources/RegionStore.migrations18
4 files changed, 40 insertions, 9 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
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
index 5753ae3..69b0beb 100644
--- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
@@ -727,7 +727,7 @@ namespace OpenSim.Data.PGSQL
727 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) 727 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
728 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) 728 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
729 { 729 {
730 cmd.Parameters.Add(_Database.CreateParameter("regionID", regionUUID)); 730 cmd.Parameters.Add(_Database.CreateParameter("regionID", regionUUID.ToString() ));
731 conn.Open(); 731 conn.Open();
732 using (NpgsqlDataReader result = cmd.ExecuteReader()) 732 using (NpgsqlDataReader result = cmd.ExecuteReader())
733 { 733 {
@@ -817,7 +817,7 @@ namespace OpenSim.Data.PGSQL
817 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) 817 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
818 { 818 {
819 conn.Open(); 819 conn.Open();
820 cmd.Parameters.Add(_Database.CreateParameter("region_id", regionID)); 820 cmd.Parameters.Add(_Database.CreateParameter("region_id", regionID.ToString()));
821 cmd.ExecuteNonQuery(); 821 cmd.ExecuteNonQuery();
822 } 822 }
823 } 823 }
@@ -831,8 +831,8 @@ namespace OpenSim.Data.PGSQL
831 conn.Open(); 831 conn.Open();
832 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) 832 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
833 { 833 {
834 cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID)); 834 cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString() ));
835 exists = (int)cmd.ExecuteScalar() > 0; 835 exists = cmd.ExecuteNonQuery() > 0;
836 } 836 }
837 } 837 }
838 if (exists) 838 if (exists)
diff --git a/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations b/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations
index b61e1f8..8f7982a 100644
--- a/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations
+++ b/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations
@@ -209,3 +209,12 @@ alter table inventoryitems
209 alter column "creatorID" type varchar(255); 209 alter column "creatorID" type varchar(255);
210 210
211Commit; 211Commit;
212
213:VERSION 10
214
215BEGIN TRANSACTION;
216
217Alter table inventoryitems Rename Column "SaleType" to "saleType";
218
219Commit;
220
diff --git a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
index 65eb011..1e33027 100644
--- a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations
@@ -1134,3 +1134,21 @@ ALTER TABLE prims ADD "Friction" double precision NOT NULL default '0.6';
1134ALTER TABLE prims ADD "Restitution" double precision NOT NULL default '0.5'; 1134ALTER TABLE prims ADD "Restitution" double precision NOT NULL default '0.5';
1135 1135
1136COMMIT; 1136COMMIT;
1137
1138:VERSION 40 #-- regionwindlight changed type from smallint to bool
1139
1140BEGIN TRANSACTION;
1141
1142ALTER TABLE regionwindlight ALTER COLUMN cloud_scroll_x_lock DROP DEFAULT;
1143ALTER TABLE regionwindlight ALTER cloud_scroll_x_lock TYPE bool USING CASE WHEN cloud_scroll_x_lock=0 THEN FALSE ELSE TRUE END;
1144ALTER TABLE regionwindlight ALTER COLUMN cloud_scroll_x_lock SET DEFAULT FALSE;
1145
1146ALTER TABLE regionwindlight ALTER COLUMN cloud_scroll_y_lock DROP DEFAULT;
1147ALTER TABLE regionwindlight ALTER cloud_scroll_y_lock TYPE bool USING CASE WHEN cloud_scroll_y_lock=0 THEN FALSE ELSE TRUE END;
1148ALTER TABLE regionwindlight ALTER COLUMN cloud_scroll_y_lock SET DEFAULT FALSE;
1149
1150ALTER TABLE regionwindlight ALTER COLUMN draw_classic_clouds DROP DEFAULT;
1151ALTER TABLE regionwindlight ALTER draw_classic_clouds TYPE bool USING CASE WHEN draw_classic_clouds=0 THEN FALSE ELSE TRUE END;
1152ALTER TABLE regionwindlight ALTER COLUMN draw_classic_clouds SET DEFAULT FALSE;
1153
1154COMMIT;