diff options
author | Teravus Ovares | 2008-09-18 17:47:29 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-09-18 17:47:29 +0000 |
commit | e6f3181d3a5f0e5ecd0c813c4f375f16285ddebe (patch) | |
tree | 928693aecbc50e4e38222569ebc2b0511e6c4f9d /OpenSim/Data | |
parent | Remove redundant permissions check in OSSL_Api.cs (diff) | |
download | opensim-SC_OLD-e6f3181d3a5f0e5ecd0c813c4f375f16285ddebe.zip opensim-SC_OLD-e6f3181d3a5f0e5ecd0c813c4f375f16285ddebe.tar.gz opensim-SC_OLD-e6f3181d3a5f0e5ecd0c813c4f375f16285ddebe.tar.bz2 opensim-SC_OLD-e6f3181d3a5f0e5ecd0c813c4f375f16285ddebe.tar.xz |
* Updates the SQLite region database to support the same properties that the MySQL version does for the table, prims.
* If this causes any unit tests to fail, the tests need to be updated.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/SQLite/Resources/011_RegionStore.sql | 28 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 152 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 11 |
3 files changed, 190 insertions, 1 deletions
diff --git a/OpenSim/Data/SQLite/Resources/011_RegionStore.sql b/OpenSim/Data/SQLite/Resources/011_RegionStore.sql new file mode 100644 index 0000000..42bef89 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/011_RegionStore.sql | |||
@@ -0,0 +1,28 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE prims ADD COLUMN PayPrice INTEGER NOT NULL default 0; | ||
4 | ALTER TABLE prims ADD COLUMN PayButton1 INTEGER NOT NULL default 0; | ||
5 | ALTER TABLE prims ADD COLUMN PayButton2 INTEGER NOT NULL default 0; | ||
6 | ALTER TABLE prims ADD COLUMN PayButton3 INTEGER NOT NULL default 0; | ||
7 | ALTER TABLE prims ADD COLUMN PayButton4 INTEGER NOT NULL default 0; | ||
8 | ALTER TABLE prims ADD COLUMN LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; | ||
9 | ALTER TABLE prims ADD COLUMN LoopedSoundGain float NOT NULL default 0; | ||
10 | ALTER TABLE prims ADD COLUMN TextureAnimation string; | ||
11 | ALTER TABLE prims ADD COLUMN ParticleSystem string; | ||
12 | ALTER TABLE prims ADD COLUMN OmegaX float NOT NULL default 0; | ||
13 | ALTER TABLE prims ADD COLUMN OmegaY float NOT NULL default 0; | ||
14 | ALTER TABLE prims ADD COLUMN OmegaZ float NOT NULL default 0; | ||
15 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float NOT NULL default 0; | ||
16 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float NOT NULL default 0; | ||
17 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float NOT NULL default 0; | ||
18 | ALTER TABLE prims ADD COLUMN CameraAtOffsetX float NOT NULL default 0; | ||
19 | ALTER TABLE prims ADD COLUMN CameraAtOffsetY float NOT NULL default 0; | ||
20 | ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float NOT NULL default 0; | ||
21 | ALTER TABLE prims ADD COLUMN ForceMouselook string NOT NULL default 0; | ||
22 | ALTER TABLE prims ADD COLUMN ScriptAccessPin INTEGER NOT NULL default 0; | ||
23 | ALTER TABLE prims ADD COLUMN AllowedDrop INTEGER NOT NULL default 0; | ||
24 | ALTER TABLE prims ADD COLUMN DieAtEdge string NOT NULL default 0; | ||
25 | ALTER TABLE prims ADD COLUMN SalePrice INTEGER NOT NULL default 0; | ||
26 | ALTER TABLE prims ADD COLUMN SaleType string NOT NULL default 0; | ||
27 | |||
28 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index fef5e3b..36b3d2f 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -774,6 +774,39 @@ namespace OpenSim.Data.SQLite | |||
774 | createCol(prims, "SitTargetOrientY", typeof (Double)); | 774 | createCol(prims, "SitTargetOrientY", typeof (Double)); |
775 | createCol(prims, "SitTargetOrientZ", typeof (Double)); | 775 | createCol(prims, "SitTargetOrientZ", typeof (Double)); |
776 | 776 | ||
777 | createCol(prims, "PayPrice", typeof(Int32)); | ||
778 | createCol(prims, "PayButton1", typeof(Int32)); | ||
779 | createCol(prims, "PayButton2", typeof(Int32)); | ||
780 | createCol(prims, "PayButton3", typeof(Int32)); | ||
781 | createCol(prims, "PayButton4", typeof(Int32)); | ||
782 | |||
783 | createCol(prims, "LoopedSound", typeof(String)); | ||
784 | createCol(prims, "LoopedSoundGain", typeof(Double)); | ||
785 | createCol(prims, "TextureAnimation", typeof(String)); | ||
786 | createCol(prims, "ParticleSystem", typeof(String)); | ||
787 | |||
788 | createCol(prims, "OmegaX", typeof(Double)); | ||
789 | createCol(prims, "OmegaY", typeof(Double)); | ||
790 | createCol(prims, "OmegaZ", typeof(Double)); | ||
791 | |||
792 | createCol(prims, "CameraEyeOffsetX", typeof(Double)); | ||
793 | createCol(prims, "CameraEyeOffsetY", typeof(Double)); | ||
794 | createCol(prims, "CameraEyeOffsetZ", typeof(Double)); | ||
795 | |||
796 | createCol(prims, "CameraAtOffsetX", typeof(Double)); | ||
797 | createCol(prims, "CameraAtOffsetY", typeof(Double)); | ||
798 | createCol(prims, "CameraAtOffsetZ", typeof(Double)); | ||
799 | |||
800 | createCol(prims, "ForceMouselook", typeof(Int16)); | ||
801 | |||
802 | createCol(prims, "ScriptAccessPin", typeof(Int32)); | ||
803 | |||
804 | createCol(prims, "AllowedDrop", typeof(Int16)); | ||
805 | createCol(prims, "DieAtEdge", typeof(Int16)); | ||
806 | |||
807 | createCol(prims, "SalePrice", typeof(Int32)); | ||
808 | createCol(prims, "SaleType", typeof(Int16)); | ||
809 | |||
777 | // click action | 810 | // click action |
778 | createCol(prims, "ClickAction", typeof (Byte)); | 811 | createCol(prims, "ClickAction", typeof (Byte)); |
779 | 812 | ||
@@ -984,9 +1017,29 @@ namespace OpenSim.Data.SQLite | |||
984 | /// <returns></returns> | 1017 | /// <returns></returns> |
985 | private SceneObjectPart buildPrim(DataRow row) | 1018 | private SceneObjectPart buildPrim(DataRow row) |
986 | { | 1019 | { |
1020 | // Code commented. Uncomment to test the unit test inline. | ||
1021 | |||
1022 | // The unit test mentions this commented code for the purposes | ||
1023 | // of debugging a unit test failure | ||
1024 | |||
1025 | // SceneObjectGroup sog = new SceneObjectGroup(); | ||
1026 | // SceneObjectPart sop = new SceneObjectPart(); | ||
1027 | // sop.LocalId = 1; | ||
1028 | // sop.Name = "object1"; | ||
1029 | // sop.Description = "object1"; | ||
1030 | // sop.Text = ""; | ||
1031 | // sop.SitName = ""; | ||
1032 | // sop.TouchName = ""; | ||
1033 | // sop.UUID = UUID.Random(); | ||
1034 | // sop.Shape = PrimitiveBaseShape.Default; | ||
1035 | // sog.AddPart(sop); | ||
1036 | // sog.RootPart = sop; | ||
1037 | // Add breakpoint in above line. Check sop fields. | ||
1038 | |||
987 | // TODO: this doesn't work yet because something more | 1039 | // TODO: this doesn't work yet because something more |
988 | // interesting has to be done to actually get these values | 1040 | // interesting has to be done to actually get these values |
989 | // back out. Not enough time to figure it out yet. | 1041 | // back out. Not enough time to figure it out yet. |
1042 | |||
990 | SceneObjectPart prim = new SceneObjectPart(); | 1043 | SceneObjectPart prim = new SceneObjectPart(); |
991 | prim.UUID = new UUID((String) row["UUID"]); | 1044 | prim.UUID = new UUID((String) row["UUID"]); |
992 | // explicit conversion of integers is required, which sort | 1045 | // explicit conversion of integers is required, which sort |
@@ -1093,6 +1146,52 @@ namespace OpenSim.Data.SQLite | |||
1093 | prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorR"]), Convert.ToInt32(row["ColorB"]), Convert.ToInt32(row["ColorG"])); | 1146 | prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorR"]), Convert.ToInt32(row["ColorB"]), Convert.ToInt32(row["ColorG"])); |
1094 | 1147 | ||
1095 | prim.ClickAction = Convert.ToByte(row["ClickAction"]); | 1148 | prim.ClickAction = Convert.ToByte(row["ClickAction"]); |
1149 | prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); | ||
1150 | prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); | ||
1151 | prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]); | ||
1152 | prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]); | ||
1153 | prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]); | ||
1154 | |||
1155 | prim.Sound = new UUID(row["LoopedSound"].ToString()); | ||
1156 | prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); | ||
1157 | prim.SoundFlags = 1; // If it's persisted at all, it's looped | ||
1158 | |||
1159 | if (!row.IsNull("TextureAnimation")) | ||
1160 | prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString()); | ||
1161 | if (!row.IsNull("ParticleSystem")) | ||
1162 | prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString()); | ||
1163 | |||
1164 | prim.RotationalVelocity = new Vector3( | ||
1165 | Convert.ToSingle(row["OmegaX"]), | ||
1166 | Convert.ToSingle(row["OmegaY"]), | ||
1167 | Convert.ToSingle(row["OmegaZ"]) | ||
1168 | ); | ||
1169 | |||
1170 | prim.SetCameraEyeOffset(new Vector3( | ||
1171 | Convert.ToSingle(row["CameraEyeOffsetX"]), | ||
1172 | Convert.ToSingle(row["CameraEyeOffsetY"]), | ||
1173 | Convert.ToSingle(row["CameraEyeOffsetZ"]) | ||
1174 | )); | ||
1175 | |||
1176 | prim.SetCameraAtOffset(new Vector3( | ||
1177 | Convert.ToSingle(row["CameraAtOffsetX"]), | ||
1178 | Convert.ToSingle(row["CameraAtOffsetY"]), | ||
1179 | Convert.ToSingle(row["CameraAtOffsetZ"]) | ||
1180 | )); | ||
1181 | |||
1182 | if (Convert.ToInt16(row["ForceMouselook"]) != 0) | ||
1183 | prim.SetForceMouselook(true); | ||
1184 | |||
1185 | prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]); | ||
1186 | |||
1187 | if (Convert.ToInt16(row["AllowedDrop"]) != 0) | ||
1188 | prim.AllowedDrop = true; | ||
1189 | |||
1190 | if (Convert.ToInt16(row["DieAtEdge"]) != 0) | ||
1191 | prim.DIE_AT_EDGE = true; | ||
1192 | |||
1193 | prim.SalePrice = Convert.ToInt32(row["SalePrice"]); | ||
1194 | prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); | ||
1096 | return prim; | 1195 | return prim; |
1097 | } | 1196 | } |
1098 | 1197 | ||
@@ -1383,6 +1482,59 @@ namespace OpenSim.Data.SQLite | |||
1383 | row["ColorG"] = Convert.ToInt32(prim.Color.G); | 1482 | row["ColorG"] = Convert.ToInt32(prim.Color.G); |
1384 | row["ColorB"] = Convert.ToInt32(prim.Color.B); | 1483 | row["ColorB"] = Convert.ToInt32(prim.Color.B); |
1385 | row["ColorA"] = Convert.ToInt32(prim.Color.A); | 1484 | row["ColorA"] = Convert.ToInt32(prim.Color.A); |
1485 | row["PayPrice"] = prim.PayPrice[0]; | ||
1486 | row["PayButton1"] = prim.PayPrice[1]; | ||
1487 | row["PayButton2"] = prim.PayPrice[2]; | ||
1488 | row["PayButton3"] = prim.PayPrice[3]; | ||
1489 | row["PayButton4"] = prim.PayPrice[4]; | ||
1490 | |||
1491 | |||
1492 | row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); | ||
1493 | row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); | ||
1494 | |||
1495 | row["OmegaX"] = prim.RotationalVelocity.X; | ||
1496 | row["OmegaY"] = prim.RotationalVelocity.Y; | ||
1497 | row["OmegaZ"] = prim.RotationalVelocity.Z; | ||
1498 | |||
1499 | row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X; | ||
1500 | row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y; | ||
1501 | row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z; | ||
1502 | |||
1503 | row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X; | ||
1504 | row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y; | ||
1505 | row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z; | ||
1506 | |||
1507 | |||
1508 | if ((prim.SoundFlags & 1) != 0) // Looped | ||
1509 | { | ||
1510 | row["LoopedSound"] = prim.Sound.ToString(); | ||
1511 | row["LoopedSoundGain"] = prim.SoundGain; | ||
1512 | } | ||
1513 | else | ||
1514 | { | ||
1515 | row["LoopedSound"] = UUID.Zero.ToString(); | ||
1516 | row["LoopedSoundGain"] = 0.0f; | ||
1517 | } | ||
1518 | |||
1519 | if (prim.GetForceMouselook()) | ||
1520 | row["ForceMouselook"] = 1; | ||
1521 | else | ||
1522 | row["ForceMouselook"] = 0; | ||
1523 | |||
1524 | row["ScriptAccessPin"] = prim.ScriptAccessPin; | ||
1525 | |||
1526 | if (prim.AllowedDrop) | ||
1527 | row["AllowedDrop"] = 1; | ||
1528 | else | ||
1529 | row["AllowedDrop"] = 0; | ||
1530 | |||
1531 | if (prim.DIE_AT_EDGE) | ||
1532 | row["DieAtEdge"] = 1; | ||
1533 | else | ||
1534 | row["DieAtEdge"] = 0; | ||
1535 | |||
1536 | row["SalePrice"] = prim.SalePrice; | ||
1537 | row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType); | ||
1386 | 1538 | ||
1387 | // click action | 1539 | // click action |
1388 | row["ClickAction"] = prim.ClickAction; | 1540 | row["ClickAction"] = prim.ClickAction; |
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index b5e9ed4..05e3827 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -205,6 +205,14 @@ namespace OpenSim.Data.Tests | |||
205 | // common failure case is people adding new fields that aren't | 205 | // common failure case is people adding new fields that aren't |
206 | // initialized, but have non-null db constraints. We should | 206 | // initialized, but have non-null db constraints. We should |
207 | // honestly be passing more and more null things in here. | 207 | // honestly be passing more and more null things in here. |
208 | // | ||
209 | // Please note that in Sqlite.BuildPrim there is a commented out inline version | ||
210 | // of this so you can debug and step through the build process and check the fields | ||
211 | // | ||
212 | // Real World Value: Tests for situation where extending a SceneObjectGroup/SceneObjectPart | ||
213 | // causes the application to crash at the database layer because of null values | ||
214 | // in NOT NULL fields | ||
215 | // | ||
208 | private SceneObjectGroup NewSOG(string name) | 216 | private SceneObjectGroup NewSOG(string name) |
209 | { | 217 | { |
210 | SceneObjectGroup sog = new SceneObjectGroup(); | 218 | SceneObjectGroup sog = new SceneObjectGroup(); |
@@ -218,7 +226,8 @@ namespace OpenSim.Data.Tests | |||
218 | sop.UUID = UUID.Random(); | 226 | sop.UUID = UUID.Random(); |
219 | sop.Shape = PrimitiveBaseShape.Default; | 227 | sop.Shape = PrimitiveBaseShape.Default; |
220 | sog.AddPart(sop); | 228 | sog.AddPart(sop); |
221 | sog.RootPart = sop; | 229 | sog.RootPart = sop; |
230 | |||
222 | return sog; | 231 | return sog; |
223 | } | 232 | } |
224 | 233 | ||