diff options
author | Melanie | 2009-10-02 08:23:38 +0100 |
---|---|---|
committer | Melanie | 2009-10-02 08:23:38 +0100 |
commit | 31d8cec0f8cd47ff445edc7771e5e73825a57927 (patch) | |
tree | a2d60604317739fa530502c40ffc71bab2a5c494 /OpenSim/Data/MySQL | |
parent | Restore the missing image handling to the image manager. The missing (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.zip opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.gz opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.bz2 opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.xz |
Merge branch 'master' into diva-textures
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 38 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/004_GridStore.sql | 6 |
8 files changed, 44 insertions, 30 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 66c34fe..0502b2b 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -204,7 +204,7 @@ namespace OpenSim.Data.MySQL | |||
204 | "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)", |
205 | _dbConnection.Connection); | 205 | _dbConnection.Connection); |
206 | 206 | ||
207 | string assetName = asset.Name; | 207 | string assetName = asset.Name; |
208 | if (asset.Name.Length > 64) | 208 | if (asset.Name.Length > 64) |
209 | { | 209 | { |
210 | assetName = asset.Name.Substring(0, 64); | 210 | assetName = asset.Name.Substring(0, 64); |
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index afd59bd..e508b52 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -127,7 +127,7 @@ namespace OpenSim.Data.MySQL | |||
127 | { | 127 | { |
128 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + | 128 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + |
129 | String.Join("`, `", fields) + | 129 | String.Join("`, `", fields) + |
130 | "`) values ( ?principalID, ?" + String.Join(", ?", fields) + ")"; | 130 | "`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; |
131 | 131 | ||
132 | cmd.CommandText = insert; | 132 | cmd.CommandText = insert; |
133 | 133 | ||
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 4521a0f..0eecf06 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -325,10 +325,10 @@ namespace OpenSim.Data.MySQL | |||
325 | UUID GroupID = UUID.Zero; | 325 | UUID GroupID = UUID.Zero; |
326 | UUID.TryParse((string)reader["avatarID"], out Owner); | 326 | UUID.TryParse((string)reader["avatarID"], out Owner); |
327 | UUID.TryParse((string)reader["groupID"], out GroupID); | 327 | UUID.TryParse((string)reader["groupID"], out GroupID); |
328 | item.Owner = Owner; | 328 | item.Owner = Owner; |
329 | item.GroupID = GroupID; | 329 | item.GroupID = GroupID; |
330 | 330 | ||
331 | // Rest of the parsing. If these UUID's fail, we're dead anyway | 331 | // Rest of the parsing. If these UUID's fail, we're dead anyway |
332 | item.ID = new UUID((string) reader["inventoryID"]); | 332 | item.ID = new UUID((string) reader["inventoryID"]); |
333 | item.AssetID = new UUID((string) reader["assetID"]); | 333 | item.AssetID = new UUID((string) reader["assetID"]); |
334 | item.AssetType = (int) reader["assetType"]; | 334 | item.AssetType = (int) reader["assetType"]; |
@@ -472,7 +472,7 @@ namespace OpenSim.Data.MySQL | |||
472 | + ", ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?inventoryGroupPermissions, ?salePrice, ?saleType, ?creationDate" | 472 | + ", ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?inventoryGroupPermissions, ?salePrice, ?saleType, ?creationDate" |
473 | + ", ?groupID, ?groupOwned, ?flags)"; | 473 | + ", ?groupID, ?groupOwned, ?flags)"; |
474 | 474 | ||
475 | string itemName = item.Name; | 475 | string itemName = item.Name; |
476 | if (item.Name.Length > 64) | 476 | if (item.Name.Length > 64) |
477 | { | 477 | { |
478 | itemName = item.Name.Substring(0, 64); | 478 | itemName = item.Name.Substring(0, 64); |
@@ -484,7 +484,7 @@ namespace OpenSim.Data.MySQL | |||
484 | { | 484 | { |
485 | itemDesc = item.Description.Substring(0, 128); | 485 | itemDesc = item.Description.Substring(0, 128); |
486 | m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length + " to " + itemDesc.Length + " characters on add item"); | 486 | m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length + " to " + itemDesc.Length + " characters on add item"); |
487 | } | 487 | } |
488 | 488 | ||
489 | try | 489 | try |
490 | { | 490 | { |
@@ -590,12 +590,12 @@ namespace OpenSim.Data.MySQL | |||
590 | "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; | 590 | "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; |
591 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; | 591 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; |
592 | 592 | ||
593 | string folderName = folder.Name; | 593 | string folderName = folder.Name; |
594 | if (folderName.Length > 64) | 594 | if (folderName.Length > 64) |
595 | { | 595 | { |
596 | folderName = folderName.Substring(0, 64); | 596 | folderName = folderName.Substring(0, 64); |
597 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length + " to " + folderName.Length + " characters on add folder"); | 597 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length + " to " + folderName.Length + " characters on add folder"); |
598 | } | 598 | } |
599 | 599 | ||
600 | database.CheckConnection(); | 600 | database.CheckConnection(); |
601 | 601 | ||
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 4a16a70..c2dd788 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | |||
@@ -464,7 +464,7 @@ namespace OpenSim.Data.MySQL | |||
464 | prim.Name, prim.UUID, prim.GroupPosition, groupID); | 464 | prim.Name, prim.UUID, prim.GroupPosition, groupID); |
465 | 465 | ||
466 | prim.UUID = groupID; | 466 | prim.UUID = groupID; |
467 | } | 467 | } |
468 | 468 | ||
469 | grp = new SceneObjectGroup(prim); | 469 | grp = new SceneObjectGroup(prim); |
470 | } | 470 | } |
@@ -533,7 +533,7 @@ namespace OpenSim.Data.MySQL | |||
533 | /// <summary> | 533 | /// <summary> |
534 | /// Load in a prim's persisted inventory. | 534 | /// Load in a prim's persisted inventory. |
535 | /// </summary> | 535 | /// </summary> |
536 | /// <param name="prim">The prim</param> | 536 | /// <param name="prim">The prim</param> |
537 | private void LoadItems(SceneObjectPart prim) | 537 | private void LoadItems(SceneObjectPart prim) |
538 | { | 538 | { |
539 | lock (m_Connection) | 539 | lock (m_Connection) |
@@ -773,7 +773,7 @@ namespace OpenSim.Data.MySQL | |||
773 | "use_estate_sun, fixed_sun, sun_position, " + | 773 | "use_estate_sun, fixed_sun, sun_position, " + |
774 | "covenant, Sandbox, sunvectorx, sunvectory, " + | 774 | "covenant, Sandbox, sunvectorx, sunvectory, " + |
775 | "sunvectorz, loaded_creation_datetime, " + | 775 | "sunvectorz, loaded_creation_datetime, " + |
776 | "loaded_creation_id) values ( ?RegionUUID, ?BlockTerraform, " + | 776 | "loaded_creation_id) values (?RegionUUID, ?BlockTerraform, " + |
777 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 777 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
778 | "?AllowLandResell, ?AllowLandJoinDivide, " + | 778 | "?AllowLandResell, ?AllowLandJoinDivide, " + |
779 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + | 779 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ced26a4..06ef624 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL | |||
39 | { | 39 | { |
40 | private string m_Realm; | 40 | private string m_Realm; |
41 | private List<string> m_ColumnNames = null; | 41 | private List<string> m_ColumnNames = null; |
42 | private int m_LastExpire = 0; | 42 | // private int m_LastExpire = 0; |
43 | 43 | ||
44 | public MySqlRegionData(string connectionString, string realm) | 44 | public MySqlRegionData(string connectionString, string realm) |
45 | : base(connectionString) | 45 | : base(connectionString) |
@@ -77,7 +77,7 @@ namespace OpenSim.Data.MySQL | |||
77 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 77 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); |
78 | 78 | ||
79 | List<RegionData> ret = RunCommand(cmd); | 79 | List<RegionData> ret = RunCommand(cmd); |
80 | if (ret == null) | 80 | if (ret.Count == 0) |
81 | return null; | 81 | return null; |
82 | 82 | ||
83 | return ret[0]; | 83 | return ret[0]; |
@@ -95,7 +95,7 @@ namespace OpenSim.Data.MySQL | |||
95 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 95 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); |
96 | 96 | ||
97 | List<RegionData> ret = RunCommand(cmd); | 97 | List<RegionData> ret = RunCommand(cmd); |
98 | if (ret == null) | 98 | if (ret.Count == 0) |
99 | return null; | 99 | return null; |
100 | 100 | ||
101 | return ret[0]; | 101 | return ret[0]; |
@@ -138,6 +138,8 @@ namespace OpenSim.Data.MySQL | |||
138 | ret.RegionName = result["regionName"].ToString(); | 138 | ret.RegionName = result["regionName"].ToString(); |
139 | ret.posX = Convert.ToInt32(result["locX"]); | 139 | ret.posX = Convert.ToInt32(result["locX"]); |
140 | ret.posY = Convert.ToInt32(result["locY"]); | 140 | ret.posY = Convert.ToInt32(result["locY"]); |
141 | ret.sizeX = Convert.ToInt32(result["sizeX"]); | ||
142 | ret.sizeY = Convert.ToInt32(result["sizeY"]); | ||
141 | 143 | ||
142 | if (m_ColumnNames == null) | 144 | if (m_ColumnNames == null) |
143 | { | 145 | { |
@@ -170,10 +172,7 @@ namespace OpenSim.Data.MySQL | |||
170 | result.Close(); | 172 | result.Close(); |
171 | CloseReaderCommand(cmd); | 173 | CloseReaderCommand(cmd); |
172 | 174 | ||
173 | if (retList.Count > 0) | 175 | return retList; |
174 | return retList; | ||
175 | |||
176 | return null; | ||
177 | } | 176 | } |
178 | 177 | ||
179 | public bool Store(RegionData data) | 178 | public bool Store(RegionData data) |
@@ -188,21 +187,25 @@ namespace OpenSim.Data.MySQL | |||
188 | data.Data.Remove("posX"); | 187 | data.Data.Remove("posX"); |
189 | if (data.Data.ContainsKey("posY")) | 188 | if (data.Data.ContainsKey("posY")) |
190 | data.Data.Remove("posY"); | 189 | data.Data.Remove("posY"); |
190 | if (data.Data.ContainsKey("sizeX")) | ||
191 | data.Data.Remove("sizeX"); | ||
192 | if (data.Data.ContainsKey("sizeY")) | ||
193 | data.Data.Remove("sizeY"); | ||
194 | if (data.Data.ContainsKey("locX")) | ||
195 | data.Data.Remove("locX"); | ||
196 | if (data.Data.ContainsKey("locY")) | ||
197 | data.Data.Remove("locY"); | ||
191 | 198 | ||
192 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | 199 | string[] fields = new List<string>(data.Data.Keys).ToArray(); |
193 | 200 | ||
194 | MySqlCommand cmd = new MySqlCommand(); | 201 | MySqlCommand cmd = new MySqlCommand(); |
195 | 202 | ||
196 | string update = "update `"+m_Realm+"` set "; | 203 | string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY"; |
197 | bool first = true; | ||
198 | foreach (string field in fields) | 204 | foreach (string field in fields) |
199 | { | 205 | { |
200 | if (!first) | 206 | update += ", "; |
201 | update += ", "; | ||
202 | update += "`" + field + "` = ?"+field; | 207 | update += "`" + field + "` = ?"+field; |
203 | 208 | ||
204 | first = false; | ||
205 | |||
206 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | 209 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
207 | } | 210 | } |
208 | 211 | ||
@@ -213,13 +216,18 @@ namespace OpenSim.Data.MySQL | |||
213 | 216 | ||
214 | cmd.CommandText = update; | 217 | cmd.CommandText = update; |
215 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); | 218 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); |
219 | cmd.Parameters.AddWithValue("?regionName", data.RegionName); | ||
216 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); | 220 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); |
221 | cmd.Parameters.AddWithValue("?posX", data.posX.ToString()); | ||
222 | cmd.Parameters.AddWithValue("?posY", data.posY.ToString()); | ||
223 | cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString()); | ||
224 | cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString()); | ||
217 | 225 | ||
218 | if (ExecuteNonQuery(cmd) < 1) | 226 | if (ExecuteNonQuery(cmd) < 1) |
219 | { | 227 | { |
220 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `" + | 228 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `regionName`, `" + |
221 | String.Join("`, `", fields) + | 229 | String.Join("`, `", fields) + |
222 | "`) values ( ?regionID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; | 230 | "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?regionName, ?" + String.Join(", ?", fields) + ")"; |
223 | 231 | ||
224 | cmd.CommandText = insert; | 232 | cmd.CommandText = insert; |
225 | 233 | ||
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index 39d60ca..d48144d 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL | |||
39 | { | 39 | { |
40 | private string m_Realm; | 40 | private string m_Realm; |
41 | private List<string> m_ColumnNames = null; | 41 | private List<string> m_ColumnNames = null; |
42 | private int m_LastExpire = 0; | 42 | // private int m_LastExpire = 0; |
43 | 43 | ||
44 | public MySqlUserAccountData(string connectionString, string realm) | 44 | public MySqlUserAccountData(string connectionString, string realm) |
45 | : base(connectionString) | 45 | : base(connectionString) |
@@ -146,7 +146,7 @@ namespace OpenSim.Data.MySQL | |||
146 | { | 146 | { |
147 | string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" + | 147 | string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" + |
148 | String.Join("`, `", fields) + | 148 | String.Join("`, `", fields) + |
149 | "`) values ( ?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; | 149 | "`) values (?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; |
150 | 150 | ||
151 | cmd.CommandText = insert; | 151 | cmd.CommandText = insert; |
152 | 152 | ||
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 537ef6c..04f872f 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -632,7 +632,7 @@ namespace OpenSim.Data.MySQL | |||
632 | UUID zero = UUID.Zero; | 632 | UUID zero = UUID.Zero; |
633 | if (user.ID == zero) | 633 | if (user.ID == zero) |
634 | { | 634 | { |
635 | return; | 635 | return; |
636 | } | 636 | } |
637 | MySQLSuperManager dbm = GetLockedConnection("AddNewUserProfile"); | 637 | MySQLSuperManager dbm = GetLockedConnection("AddNewUserProfile"); |
638 | 638 | ||
@@ -666,7 +666,7 @@ namespace OpenSim.Data.MySQL | |||
666 | { | 666 | { |
667 | UUID zero = UUID.Zero; | 667 | UUID zero = UUID.Zero; |
668 | if (agent.ProfileID == zero || agent.SessionID == zero) | 668 | if (agent.ProfileID == zero || agent.SessionID == zero) |
669 | return; | 669 | return; |
670 | 670 | ||
671 | MySQLSuperManager dbm = GetLockedConnection("AddNewUserAgent"); | 671 | MySQLSuperManager dbm = GetLockedConnection("AddNewUserAgent"); |
672 | try | 672 | try |
diff --git a/OpenSim/Data/MySQL/Resources/004_GridStore.sql b/OpenSim/Data/MySQL/Resources/004_GridStore.sql new file mode 100644 index 0000000..2238a88 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/004_GridStore.sql | |||
@@ -0,0 +1,6 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE regions add column sizeX integer not null default 0; | ||
4 | ALTER TABLE regions add column sizeY integer not null default 0; | ||
5 | |||
6 | COMMIT; | ||