diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-18 11:09:43 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-18 11:09:43 -0400 |
commit | 311b51a1843f43daa7796a46961b65fe702e1b85 (patch) | |
tree | 756554b330c8bdd970f319c3af0327efb9017673 /OpenSim/Data/MySQL | |
parent | * Some Physics Scene Changes to prepare for larger regions (diff) | |
parent | Fixes mantis #4020 (http://opensimulator.org/mantis/view.php?id=4020) (diff) | |
download | opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.zip opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.tar.gz opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.tar.bz2 opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.tar.xz |
*remove conflicts
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 13 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 17 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Tests/MySQLGridTest.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs | 12 |
5 files changed, 36 insertions, 24 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 26cdd06..0865083 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -168,6 +168,7 @@ namespace OpenSim.Data.MySQL | |||
168 | } | 168 | } |
169 | asset.Name = (string) dbReader["name"]; | 169 | asset.Name = (string) dbReader["name"]; |
170 | asset.Type = (sbyte) dbReader["assetType"]; | 170 | asset.Type = (sbyte) dbReader["assetType"]; |
171 | asset.Temporary = (bool)dbReader["temporary"]; | ||
171 | } | 172 | } |
172 | dbReader.Close(); | 173 | dbReader.Close(); |
173 | cmd.Dispose(); | 174 | cmd.Dispose(); |
@@ -195,18 +196,11 @@ namespace OpenSim.Data.MySQL | |||
195 | { | 196 | { |
196 | lock (_dbConnection) | 197 | lock (_dbConnection) |
197 | { | 198 | { |
198 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID); | ||
199 | if (ExistsAsset(asset.FullID)) | ||
200 | { | ||
201 | //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); | ||
202 | return; | ||
203 | } | ||
204 | |||
205 | _dbConnection.CheckConnection(); | 199 | _dbConnection.CheckConnection(); |
206 | 200 | ||
207 | MySqlCommand cmd = | 201 | MySqlCommand cmd = |
208 | new MySqlCommand( | 202 | new MySqlCommand( |
209 | "insert INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" + | 203 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" + |
210 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)", | 204 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)", |
211 | _dbConnection.Connection); | 205 | _dbConnection.Connection); |
212 | 206 | ||
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index a4b8663..4521a0f 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -342,7 +342,7 @@ namespace OpenSim.Data.MySQL | |||
342 | item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; | 342 | item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; |
343 | item.GroupPermissions = (uint) reader["inventoryGroupPermissions"]; | 343 | item.GroupPermissions = (uint) reader["inventoryGroupPermissions"]; |
344 | item.SalePrice = (int) reader["salePrice"]; | 344 | item.SalePrice = (int) reader["salePrice"]; |
345 | item.SaleType = Convert.ToByte(reader["saleType"]); | 345 | item.SaleType = unchecked((byte)(Convert.ToSByte(reader["saleType"]))); |
346 | item.CreationDate = (int) reader["creationDate"]; | 346 | item.CreationDate = (int) reader["creationDate"]; |
347 | item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); | 347 | item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); |
348 | item.Flags = (uint) reader["flags"]; | 348 | item.Flags = (uint) reader["flags"]; |
@@ -423,7 +423,7 @@ namespace OpenSim.Data.MySQL | |||
423 | /// <summary> | 423 | /// <summary> |
424 | /// Returns a specified inventory folder | 424 | /// Returns a specified inventory folder |
425 | /// </summary> | 425 | /// </summary> |
426 | /// <param name="folder">The folder to return</param> | 426 | /// <param name="folderID">The folder to return</param> |
427 | /// <returns>A folder class</returns> | 427 | /// <returns>A folder class</returns> |
428 | public InventoryFolderBase getInventoryFolder(UUID folderID) | 428 | public InventoryFolderBase getInventoryFolder(UUID folderID) |
429 | { | 429 | { |
@@ -438,8 +438,9 @@ namespace OpenSim.Data.MySQL | |||
438 | result.Parameters.AddWithValue("?uuid", folderID.ToString()); | 438 | result.Parameters.AddWithValue("?uuid", folderID.ToString()); |
439 | MySqlDataReader reader = result.ExecuteReader(); | 439 | MySqlDataReader reader = result.ExecuteReader(); |
440 | 440 | ||
441 | reader.Read(); | 441 | InventoryFolderBase folder = null; |
442 | InventoryFolderBase folder = readInventoryFolder(reader); | 442 | if (reader.Read()) |
443 | folder = readInventoryFolder(reader); | ||
443 | reader.Close(); | 444 | reader.Close(); |
444 | result.Dispose(); | 445 | result.Dispose(); |
445 | 446 | ||
@@ -506,7 +507,7 @@ namespace OpenSim.Data.MySQL | |||
506 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); | 507 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); |
507 | result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); | 508 | result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); |
508 | result.Parameters.AddWithValue("?salePrice", item.SalePrice); | 509 | result.Parameters.AddWithValue("?salePrice", item.SalePrice); |
509 | result.Parameters.AddWithValue("?saleType", item.SaleType); | 510 | result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType)); |
510 | result.Parameters.AddWithValue("?creationDate", item.CreationDate); | 511 | result.Parameters.AddWithValue("?creationDate", item.CreationDate); |
511 | result.Parameters.AddWithValue("?groupID", item.GroupID); | 512 | result.Parameters.AddWithValue("?groupID", item.GroupID); |
512 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); | 513 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); |
@@ -603,7 +604,7 @@ namespace OpenSim.Data.MySQL | |||
603 | cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString()); | 604 | cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString()); |
604 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); | 605 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); |
605 | cmd.Parameters.AddWithValue("?folderName", folderName); | 606 | cmd.Parameters.AddWithValue("?folderName", folderName); |
606 | cmd.Parameters.AddWithValue("?type", (short) folder.Type); | 607 | cmd.Parameters.AddWithValue("?type", folder.Type); |
607 | cmd.Parameters.AddWithValue("?version", folder.Version); | 608 | cmd.Parameters.AddWithValue("?version", folder.Version); |
608 | 609 | ||
609 | try | 610 | try |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 2166845..9c2ee4a 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -834,7 +834,10 @@ namespace OpenSim.Data.MySQL | |||
834 | // explicit conversion of integers is required, which sort | 834 | // explicit conversion of integers is required, which sort |
835 | // of sucks. No idea if there is a shortcut here or not. | 835 | // of sucks. No idea if there is a shortcut here or not. |
836 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | 836 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); |
837 | prim.Name = (String) row["Name"]; | 837 | if (row["Name"] != DBNull.Value) |
838 | prim.Name = (String)row["Name"]; | ||
839 | else | ||
840 | prim.Name = string.Empty; | ||
838 | // various text fields | 841 | // various text fields |
839 | prim.Text = (String) row["Text"]; | 842 | prim.Text = (String) row["Text"]; |
840 | prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), | 843 | prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), |
@@ -945,12 +948,12 @@ namespace OpenSim.Data.MySQL | |||
945 | prim.DIE_AT_EDGE = true; | 948 | prim.DIE_AT_EDGE = true; |
946 | 949 | ||
947 | prim.SalePrice = Convert.ToInt32(row["SalePrice"]); | 950 | prim.SalePrice = Convert.ToInt32(row["SalePrice"]); |
948 | prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); | 951 | prim.ObjectSaleType = unchecked((byte)Convert.ToSByte(row["SaleType"])); |
949 | 952 | ||
950 | prim.Material = Convert.ToByte(row["Material"]); | 953 | prim.Material = unchecked((byte)Convert.ToSByte(row["Material"])); |
951 | 954 | ||
952 | if (!(row["ClickAction"] is DBNull)) | 955 | if (!(row["ClickAction"] is DBNull)) |
953 | prim.ClickAction = (byte)Convert.ToByte(row["ClickAction"]); | 956 | prim.ClickAction = unchecked((byte)Convert.ToSByte(row["ClickAction"])); |
954 | 957 | ||
955 | prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); | 958 | prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); |
956 | prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); | 959 | prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); |
@@ -1277,12 +1280,12 @@ namespace OpenSim.Data.MySQL | |||
1277 | cmd.Parameters.AddWithValue("DieAtEdge", 0); | 1280 | cmd.Parameters.AddWithValue("DieAtEdge", 0); |
1278 | 1281 | ||
1279 | cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice); | 1282 | cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice); |
1280 | cmd.Parameters.AddWithValue("SaleType", Convert.ToInt16(prim.ObjectSaleType)); | 1283 | cmd.Parameters.AddWithValue("SaleType", unchecked((sbyte)(prim.ObjectSaleType))); |
1281 | 1284 | ||
1282 | byte clickAction = prim.ClickAction; | 1285 | byte clickAction = prim.ClickAction; |
1283 | cmd.Parameters.AddWithValue("ClickAction", clickAction); | 1286 | cmd.Parameters.AddWithValue("ClickAction", unchecked((sbyte)(clickAction))); |
1284 | 1287 | ||
1285 | cmd.Parameters.AddWithValue("Material", prim.Material); | 1288 | cmd.Parameters.AddWithValue("Material", unchecked((sbyte)(prim.Material))); |
1286 | 1289 | ||
1287 | cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString()); | 1290 | cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString()); |
1288 | cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume); | 1291 | cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume); |
diff --git a/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs b/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs index 7c36375..d1d5c2a 100644 --- a/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs +++ b/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs | |||
@@ -62,11 +62,18 @@ namespace OpenSim.Data.MySQL.Tests | |||
62 | m_log.Error("Exception {0}", e); | 62 | m_log.Error("Exception {0}", e); |
63 | Assert.Ignore(); | 63 | Assert.Ignore(); |
64 | } | 64 | } |
65 | |||
66 | // This actually does the roll forward assembly stuff | ||
67 | Assembly assem = GetType().Assembly; | ||
68 | Migration m = new Migration(database.Connection, assem, "GridStore"); | ||
69 | |||
70 | m.Update(); | ||
65 | } | 71 | } |
66 | 72 | ||
67 | [TestFixtureTearDown] | 73 | [TestFixtureTearDown] |
68 | public void Cleanup() | 74 | public void Cleanup() |
69 | { | 75 | { |
76 | m_log.Warn("Cleaning up."); | ||
70 | if (db != null) | 77 | if (db != null) |
71 | { | 78 | { |
72 | db.Dispose(); | 79 | db.Dispose(); |
@@ -74,6 +81,7 @@ namespace OpenSim.Data.MySQL.Tests | |||
74 | // if a new table is added, it has to be dropped here | 81 | // if a new table is added, it has to be dropped here |
75 | if (database != null) | 82 | if (database != null) |
76 | { | 83 | { |
84 | database.ExecuteSql("drop table migrations"); | ||
77 | database.ExecuteSql("drop table regions"); | 85 | database.ExecuteSql("drop table regions"); |
78 | } | 86 | } |
79 | } | 87 | } |
diff --git a/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs b/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs index 23c1ec5..a3a32dc 100644 --- a/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs +++ b/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Data.MySQL.Tests | |||
53 | try | 53 | try |
54 | { | 54 | { |
55 | database = new MySQLManager(connect); | 55 | database = new MySQLManager(connect); |
56 | DropTables(); | ||
56 | db = new MySQLInventoryData(); | 57 | db = new MySQLInventoryData(); |
57 | db.Initialise(connect); | 58 | db.Initialise(connect); |
58 | } | 59 | } |
@@ -72,10 +73,15 @@ namespace OpenSim.Data.MySQL.Tests | |||
72 | } | 73 | } |
73 | if (database != null) | 74 | if (database != null) |
74 | { | 75 | { |
75 | database.ExecuteSql("drop table inventoryitems"); | 76 | DropTables(); |
76 | database.ExecuteSql("drop table inventoryfolders"); | ||
77 | database.ExecuteSql("drop table migrations"); | ||
78 | } | 77 | } |
79 | } | 78 | } |
79 | |||
80 | private void DropTables() | ||
81 | { | ||
82 | database.ExecuteSql("drop table IF EXISTS inventoryitems"); | ||
83 | database.ExecuteSql("drop table IF EXISTS inventoryfolders"); | ||
84 | database.ExecuteSql("drop table IF EXISTS migrations"); | ||
85 | } | ||
80 | } | 86 | } |
81 | } | 87 | } |