diff options
Diffstat (limited to '')
34 files changed, 0 insertions, 9183 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs deleted file mode 100644 index f94375d..0000000 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ /dev/null | |||
@@ -1,314 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Data; | ||
30 | using System.Data.SqlClient; | ||
31 | using System.Reflection; | ||
32 | using System.Collections.Generic; | ||
33 | using OpenMetaverse; | ||
34 | using log4net; | ||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Data.MSSQL | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// A MSSQL Interface for the Asset server | ||
41 | /// </summary> | ||
42 | public class MSSQLAssetData : AssetDataBase | ||
43 | { | ||
44 | private const string _migrationStore = "AssetStore"; | ||
45 | |||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | private long m_ticksToEpoch; | ||
48 | /// <summary> | ||
49 | /// Database manager | ||
50 | /// </summary> | ||
51 | private MSSQLManager m_database; | ||
52 | private string m_connectionString; | ||
53 | |||
54 | #region IPlugin Members | ||
55 | |||
56 | override public void Dispose() { } | ||
57 | |||
58 | /// <summary> | ||
59 | /// <para>Initialises asset interface</para> | ||
60 | /// </summary> | ||
61 | // [Obsolete("Cannot be default-initialized!")] | ||
62 | override public void Initialise() | ||
63 | { | ||
64 | m_log.Info("[MSSQLAssetData]: " + Name + " cannot be default-initialized!"); | ||
65 | throw new PluginNotInitialisedException(Name); | ||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Initialises asset interface | ||
70 | /// </summary> | ||
71 | /// <para> | ||
72 | /// a string instead of file, if someone writes the support | ||
73 | /// </para> | ||
74 | /// <param name="connectionString">connect string</param> | ||
75 | override public void Initialise(string connectionString) | ||
76 | { | ||
77 | m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks; | ||
78 | |||
79 | m_database = new MSSQLManager(connectionString); | ||
80 | m_connectionString = connectionString; | ||
81 | |||
82 | //New migration to check for DB changes | ||
83 | m_database.CheckMigration(_migrationStore); | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Database provider version. | ||
88 | /// </summary> | ||
89 | override public string Version | ||
90 | { | ||
91 | get { return m_database.getVersion(); } | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// The name of this DB provider. | ||
96 | /// </summary> | ||
97 | override public string Name | ||
98 | { | ||
99 | get { return "MSSQL Asset storage engine"; } | ||
100 | } | ||
101 | |||
102 | #endregion | ||
103 | |||
104 | #region IAssetDataPlugin Members | ||
105 | |||
106 | /// <summary> | ||
107 | /// Fetch Asset from m_database | ||
108 | /// </summary> | ||
109 | /// <param name="assetID">the asset UUID</param> | ||
110 | /// <returns></returns> | ||
111 | override public AssetBase GetAsset(UUID assetID) | ||
112 | { | ||
113 | string sql = "SELECT * FROM assets WHERE id = @id"; | ||
114 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
115 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
116 | { | ||
117 | cmd.Parameters.Add(m_database.CreateParameter("id", assetID)); | ||
118 | conn.Open(); | ||
119 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
120 | { | ||
121 | if (reader.Read()) | ||
122 | { | ||
123 | AssetBase asset = new AssetBase( | ||
124 | DBGuid.FromDB(reader["id"]), | ||
125 | (string)reader["name"], | ||
126 | Convert.ToSByte(reader["assetType"]), | ||
127 | reader["creatorid"].ToString() | ||
128 | ); | ||
129 | // Region Main | ||
130 | asset.Description = (string)reader["description"]; | ||
131 | asset.Local = Convert.ToBoolean(reader["local"]); | ||
132 | asset.Temporary = Convert.ToBoolean(reader["temporary"]); | ||
133 | asset.Flags = (AssetFlags)(Convert.ToInt32(reader["asset_flags"])); | ||
134 | asset.Data = (byte[])reader["data"]; | ||
135 | return asset; | ||
136 | } | ||
137 | return null; // throw new Exception("No rows to return"); | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// Create asset in m_database | ||
144 | /// </summary> | ||
145 | /// <param name="asset">the asset</param> | ||
146 | override public void StoreAsset(AssetBase asset) | ||
147 | { | ||
148 | |||
149 | string sql = | ||
150 | @"IF EXISTS(SELECT * FROM assets WHERE id=@id) | ||
151 | UPDATE assets set name = @name, description = @description, assetType = @assetType, | ||
152 | local = @local, temporary = @temporary, creatorid = @creatorid, data = @data | ||
153 | WHERE id=@id | ||
154 | ELSE | ||
155 | INSERT INTO assets | ||
156 | ([id], [name], [description], [assetType], [local], | ||
157 | [temporary], [create_time], [access_time], [creatorid], [asset_flags], [data]) | ||
158 | VALUES | ||
159 | (@id, @name, @description, @assetType, @local, | ||
160 | @temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)"; | ||
161 | |||
162 | string assetName = asset.Name; | ||
163 | if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) | ||
164 | { | ||
165 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); | ||
166 | m_log.WarnFormat( | ||
167 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
168 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
169 | } | ||
170 | |||
171 | string assetDescription = asset.Description; | ||
172 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | ||
173 | { | ||
174 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | ||
175 | m_log.WarnFormat( | ||
176 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
177 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
178 | } | ||
179 | |||
180 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
181 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
182 | { | ||
183 | int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000); | ||
184 | command.Parameters.Add(m_database.CreateParameter("id", asset.FullID)); | ||
185 | command.Parameters.Add(m_database.CreateParameter("name", assetName)); | ||
186 | command.Parameters.Add(m_database.CreateParameter("description", assetDescription)); | ||
187 | command.Parameters.Add(m_database.CreateParameter("assetType", asset.Type)); | ||
188 | command.Parameters.Add(m_database.CreateParameter("local", asset.Local)); | ||
189 | command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); | ||
190 | command.Parameters.Add(m_database.CreateParameter("access_time", now)); | ||
191 | command.Parameters.Add(m_database.CreateParameter("create_time", now)); | ||
192 | command.Parameters.Add(m_database.CreateParameter("asset_flags", (int)asset.Flags)); | ||
193 | command.Parameters.Add(m_database.CreateParameter("creatorid", asset.Metadata.CreatorID)); | ||
194 | command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); | ||
195 | conn.Open(); | ||
196 | try | ||
197 | { | ||
198 | command.ExecuteNonQuery(); | ||
199 | } | ||
200 | catch(Exception e) | ||
201 | { | ||
202 | m_log.Error("[ASSET DB]: Error storing item :" + e.Message); | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | |||
207 | |||
208 | // Commented out since currently unused - this probably should be called in GetAsset() | ||
209 | // private void UpdateAccessTime(AssetBase asset) | ||
210 | // { | ||
211 | // using (AutoClosingSqlCommand cmd = m_database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) | ||
212 | // { | ||
213 | // int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000); | ||
214 | // cmd.Parameters.AddWithValue("@id", asset.FullID.ToString()); | ||
215 | // cmd.Parameters.AddWithValue("@access_time", now); | ||
216 | // try | ||
217 | // { | ||
218 | // cmd.ExecuteNonQuery(); | ||
219 | // } | ||
220 | // catch (Exception e) | ||
221 | // { | ||
222 | // m_log.Error(e.ToString()); | ||
223 | // } | ||
224 | // } | ||
225 | // } | ||
226 | |||
227 | /// <summary> | ||
228 | /// Check if the assets exist in the database. | ||
229 | /// </summary> | ||
230 | /// <param name="uuids">The assets' IDs</param> | ||
231 | /// <returns>For each asset: true if it exists, false otherwise</returns> | ||
232 | public override bool[] AssetsExist(UUID[] uuids) | ||
233 | { | ||
234 | if (uuids.Length == 0) | ||
235 | return new bool[0]; | ||
236 | |||
237 | HashSet<UUID> exist = new HashSet<UUID>(); | ||
238 | |||
239 | string ids = "'" + string.Join("','", uuids) + "'"; | ||
240 | string sql = string.Format("SELECT id FROM assets WHERE id IN ({0})", ids); | ||
241 | |||
242 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
243 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
244 | { | ||
245 | conn.Open(); | ||
246 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
247 | { | ||
248 | while (reader.Read()) | ||
249 | { | ||
250 | UUID id = DBGuid.FromDB(reader["id"]); | ||
251 | exist.Add(id); | ||
252 | } | ||
253 | } | ||
254 | } | ||
255 | |||
256 | bool[] results = new bool[uuids.Length]; | ||
257 | for (int i = 0; i < uuids.Length; i++) | ||
258 | results[i] = exist.Contains(uuids[i]); | ||
259 | return results; | ||
260 | } | ||
261 | |||
262 | /// <summary> | ||
263 | /// Returns a list of AssetMetadata objects. The list is a subset of | ||
264 | /// the entire data set offset by <paramref name="start" /> containing | ||
265 | /// <paramref name="count" /> elements. | ||
266 | /// </summary> | ||
267 | /// <param name="start">The number of results to discard from the total data set.</param> | ||
268 | /// <param name="count">The number of rows the returned list should contain.</param> | ||
269 | /// <returns>A list of AssetMetadata objects.</returns> | ||
270 | public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count) | ||
271 | { | ||
272 | List<AssetMetadata> retList = new List<AssetMetadata>(count); | ||
273 | string sql = @"WITH OrderedAssets AS | ||
274 | ( | ||
275 | SELECT id, name, description, assetType, temporary, creatorid, | ||
276 | RowNumber = ROW_NUMBER() OVER (ORDER BY id) | ||
277 | FROM assets | ||
278 | ) | ||
279 | SELECT * | ||
280 | FROM OrderedAssets | ||
281 | WHERE RowNumber BETWEEN @start AND @stop;"; | ||
282 | |||
283 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
284 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
285 | { | ||
286 | cmd.Parameters.Add(m_database.CreateParameter("start", start)); | ||
287 | cmd.Parameters.Add(m_database.CreateParameter("stop", start + count - 1)); | ||
288 | conn.Open(); | ||
289 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
290 | { | ||
291 | while (reader.Read()) | ||
292 | { | ||
293 | AssetMetadata metadata = new AssetMetadata(); | ||
294 | metadata.FullID = DBGuid.FromDB(reader["id"]); | ||
295 | metadata.Name = (string)reader["name"]; | ||
296 | metadata.Description = (string)reader["description"]; | ||
297 | metadata.Type = Convert.ToSByte(reader["assetType"]); | ||
298 | metadata.Temporary = Convert.ToBoolean(reader["temporary"]); | ||
299 | metadata.CreatorID = (string)reader["creatorid"]; | ||
300 | retList.Add(metadata); | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | |||
305 | return retList; | ||
306 | } | ||
307 | |||
308 | public override bool Delete(string id) | ||
309 | { | ||
310 | return false; | ||
311 | } | ||
312 | #endregion | ||
313 | } | ||
314 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLAuthenticationData.cs b/OpenSim/Data/MSSQL/MSSQLAuthenticationData.cs deleted file mode 100644 index 1ae78c4..0000000 --- a/OpenSim/Data/MSSQL/MSSQLAuthenticationData.cs +++ /dev/null | |||
@@ -1,227 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using System.Data.SqlClient; | ||
35 | using System.Reflection; | ||
36 | using System.Text; | ||
37 | |||
38 | namespace OpenSim.Data.MSSQL | ||
39 | { | ||
40 | public class MSSQLAuthenticationData : IAuthenticationData | ||
41 | { | ||
42 | private string m_Realm; | ||
43 | private List<string> m_ColumnNames = null; | ||
44 | private int m_LastExpire = 0; | ||
45 | private string m_ConnectionString; | ||
46 | private MSSQLManager m_database; | ||
47 | |||
48 | public MSSQLAuthenticationData(string connectionString, string realm) | ||
49 | { | ||
50 | m_Realm = realm; | ||
51 | m_ConnectionString = connectionString; | ||
52 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
53 | { | ||
54 | conn.Open(); | ||
55 | Migration m = new Migration(conn, GetType().Assembly, "AuthStore"); | ||
56 | m_database = new MSSQLManager(m_ConnectionString); | ||
57 | m.Update(); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | public AuthenticationData Get(UUID principalID) | ||
62 | { | ||
63 | AuthenticationData ret = new AuthenticationData(); | ||
64 | ret.Data = new Dictionary<string, object>(); | ||
65 | |||
66 | string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm); | ||
67 | |||
68 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
69 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
70 | { | ||
71 | cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID)); | ||
72 | conn.Open(); | ||
73 | using (SqlDataReader result = cmd.ExecuteReader()) | ||
74 | { | ||
75 | if (result.Read()) | ||
76 | { | ||
77 | ret.PrincipalID = principalID; | ||
78 | |||
79 | if (m_ColumnNames == null) | ||
80 | { | ||
81 | m_ColumnNames = new List<string>(); | ||
82 | |||
83 | DataTable schemaTable = result.GetSchemaTable(); | ||
84 | foreach (DataRow row in schemaTable.Rows) | ||
85 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
86 | } | ||
87 | |||
88 | foreach (string s in m_ColumnNames) | ||
89 | { | ||
90 | if (s == "UUID") | ||
91 | continue; | ||
92 | |||
93 | ret.Data[s] = result[s].ToString(); | ||
94 | } | ||
95 | return ret; | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | return null; | ||
100 | } | ||
101 | |||
102 | public bool Store(AuthenticationData data) | ||
103 | { | ||
104 | if (data.Data.ContainsKey("UUID")) | ||
105 | data.Data.Remove("UUID"); | ||
106 | |||
107 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
108 | StringBuilder updateBuilder = new StringBuilder(); | ||
109 | |||
110 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
111 | using (SqlCommand cmd = new SqlCommand()) | ||
112 | { | ||
113 | updateBuilder.AppendFormat("update {0} set ", m_Realm); | ||
114 | |||
115 | bool first = true; | ||
116 | foreach (string field in fields) | ||
117 | { | ||
118 | if (!first) | ||
119 | updateBuilder.Append(", "); | ||
120 | updateBuilder.AppendFormat("{0} = @{0}",field); | ||
121 | |||
122 | first = false; | ||
123 | cmd.Parameters.Add(m_database.CreateParameter("@" + field, data.Data[field])); | ||
124 | } | ||
125 | |||
126 | updateBuilder.Append(" where UUID = @principalID"); | ||
127 | |||
128 | cmd.CommandText = updateBuilder.ToString(); | ||
129 | cmd.Connection = conn; | ||
130 | cmd.Parameters.Add(m_database.CreateParameter("@principalID", data.PrincipalID)); | ||
131 | |||
132 | conn.Open(); | ||
133 | if (cmd.ExecuteNonQuery() < 1) | ||
134 | { | ||
135 | StringBuilder insertBuilder = new StringBuilder(); | ||
136 | |||
137 | insertBuilder.AppendFormat("insert into {0} (UUID, ", m_Realm); | ||
138 | insertBuilder.Append(String.Join(", ", fields)); | ||
139 | insertBuilder.Append(") values (@principalID, @"); | ||
140 | insertBuilder.Append(String.Join(", @", fields)); | ||
141 | insertBuilder.Append(")"); | ||
142 | |||
143 | cmd.CommandText = insertBuilder.ToString(); | ||
144 | |||
145 | if (cmd.ExecuteNonQuery() < 1) | ||
146 | { | ||
147 | return false; | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | return true; | ||
152 | } | ||
153 | |||
154 | public bool SetDataItem(UUID principalID, string item, string value) | ||
155 | { | ||
156 | string sql = string.Format("update {0} set {1} = @{1} where UUID = @UUID", m_Realm, item); | ||
157 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
158 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
159 | { | ||
160 | cmd.Parameters.Add(m_database.CreateParameter("@" + item, value)); | ||
161 | conn.Open(); | ||
162 | if (cmd.ExecuteNonQuery() > 0) | ||
163 | return true; | ||
164 | } | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | public bool SetToken(UUID principalID, string token, int lifetime) | ||
169 | { | ||
170 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
171 | DoExpire(); | ||
172 | |||
173 | string sql = "insert into tokens (UUID, token, validity) values (@principalID, @token, @lifetime)"; | ||
174 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
175 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
176 | { | ||
177 | cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID)); | ||
178 | cmd.Parameters.Add(m_database.CreateParameter("@token", token)); | ||
179 | cmd.Parameters.Add(m_database.CreateParameter("@lifetime", DateTime.Now.AddMinutes(lifetime))); | ||
180 | conn.Open(); | ||
181 | |||
182 | if (cmd.ExecuteNonQuery() > 0) | ||
183 | { | ||
184 | return true; | ||
185 | } | ||
186 | } | ||
187 | return false; | ||
188 | } | ||
189 | |||
190 | public bool CheckToken(UUID principalID, string token, int lifetime) | ||
191 | { | ||
192 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
193 | DoExpire(); | ||
194 | |||
195 | DateTime validDate = DateTime.Now.AddMinutes(lifetime); | ||
196 | string sql = "update tokens set validity = @validDate where UUID = @principalID and token = @token and validity > GetDate()"; | ||
197 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
198 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
199 | { | ||
200 | cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID)); | ||
201 | cmd.Parameters.Add(m_database.CreateParameter("@token", token)); | ||
202 | cmd.Parameters.Add(m_database.CreateParameter("@validDate", validDate)); | ||
203 | conn.Open(); | ||
204 | |||
205 | if (cmd.ExecuteNonQuery() > 0) | ||
206 | { | ||
207 | return true; | ||
208 | } | ||
209 | } | ||
210 | return false; | ||
211 | } | ||
212 | |||
213 | private void DoExpire() | ||
214 | { | ||
215 | DateTime currentDateTime = DateTime.Now; | ||
216 | string sql = "delete from tokens where validity < @currentDateTime"; | ||
217 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
218 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
219 | { | ||
220 | conn.Open(); | ||
221 | cmd.Parameters.Add(m_database.CreateParameter("@currentDateTime", currentDateTime)); | ||
222 | cmd.ExecuteNonQuery(); | ||
223 | } | ||
224 | m_LastExpire = System.Environment.TickCount; | ||
225 | } | ||
226 | } | ||
227 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLAvatarData.cs b/OpenSim/Data/MSSQL/MSSQLAvatarData.cs deleted file mode 100644 index 301b424..0000000 --- a/OpenSim/Data/MSSQL/MSSQLAvatarData.cs +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using System.Data.SqlClient; | ||
37 | |||
38 | namespace OpenSim.Data.MSSQL | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A MSSQL Interface for Avatar Storage | ||
42 | /// </summary> | ||
43 | public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>, | ||
44 | IAvatarData | ||
45 | { | ||
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | public MSSQLAvatarData(string connectionString, string realm) : | ||
49 | base(connectionString, realm, "Avatar") | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public bool Delete(UUID principalID, string name) | ||
54 | { | ||
55 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
56 | using (SqlCommand cmd = new SqlCommand()) | ||
57 | { | ||
58 | |||
59 | cmd.CommandText = String.Format("DELETE FROM {0} where [PrincipalID] = @PrincipalID and [Name] = @Name", m_Realm); | ||
60 | cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString())); | ||
61 | cmd.Parameters.Add(m_database.CreateParameter("@Name", name)); | ||
62 | cmd.Connection = conn; | ||
63 | conn.Open(); | ||
64 | if (cmd.ExecuteNonQuery() > 0) | ||
65 | return true; | ||
66 | |||
67 | return false; | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs deleted file mode 100644 index 1faa249..0000000 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ /dev/null | |||
@@ -1,577 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Data.SqlClient; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | |||
38 | namespace OpenSim.Data.MSSQL | ||
39 | { | ||
40 | public class MSSQLEstateStore : IEstateDataStore | ||
41 | { | ||
42 | private const string _migrationStore = "EstateStore"; | ||
43 | |||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private MSSQLManager _Database; | ||
47 | private string m_connectionString; | ||
48 | private FieldInfo[] _Fields; | ||
49 | private Dictionary<string, FieldInfo> _FieldMap = new Dictionary<string, FieldInfo>(); | ||
50 | |||
51 | #region Public methods | ||
52 | |||
53 | public MSSQLEstateStore() | ||
54 | { | ||
55 | } | ||
56 | |||
57 | public MSSQLEstateStore(string connectionString) | ||
58 | { | ||
59 | Initialise(connectionString); | ||
60 | } | ||
61 | |||
62 | /// <summary> | ||
63 | /// Initialises the estatedata class. | ||
64 | /// </summary> | ||
65 | /// <param name="connectionString">connectionString.</param> | ||
66 | public void Initialise(string connectionString) | ||
67 | { | ||
68 | if (!string.IsNullOrEmpty(connectionString)) | ||
69 | { | ||
70 | m_connectionString = connectionString; | ||
71 | _Database = new MSSQLManager(connectionString); | ||
72 | } | ||
73 | |||
74 | //Migration settings | ||
75 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
76 | { | ||
77 | conn.Open(); | ||
78 | Migration m = new Migration(conn, GetType().Assembly, "EstateStore"); | ||
79 | m.Update(); | ||
80 | } | ||
81 | |||
82 | //Interesting way to get parameters! Maybe implement that also with other types | ||
83 | Type t = typeof(EstateSettings); | ||
84 | _Fields = t.GetFields(BindingFlags.NonPublic | | ||
85 | BindingFlags.Instance | | ||
86 | BindingFlags.DeclaredOnly); | ||
87 | |||
88 | foreach (FieldInfo f in _Fields) | ||
89 | { | ||
90 | if (f.Name.Substring(0, 2) == "m_") | ||
91 | _FieldMap[f.Name.Substring(2)] = f; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Loads the estate settings. | ||
97 | /// </summary> | ||
98 | /// <param name="regionID">region ID.</param> | ||
99 | /// <returns></returns> | ||
100 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | ||
101 | { | ||
102 | EstateSettings es = new EstateSettings(); | ||
103 | |||
104 | string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = @RegionID"; | ||
105 | |||
106 | bool insertEstate = false; | ||
107 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
108 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
109 | { | ||
110 | cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID)); | ||
111 | conn.Open(); | ||
112 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
113 | { | ||
114 | if (reader.Read()) | ||
115 | { | ||
116 | foreach (string name in FieldList) | ||
117 | { | ||
118 | FieldInfo f = _FieldMap[name]; | ||
119 | object v = reader[name]; | ||
120 | if (f.FieldType == typeof(bool)) | ||
121 | { | ||
122 | f.SetValue(es, Convert.ToInt32(v) != 0); | ||
123 | } | ||
124 | else if (f.FieldType == typeof(UUID)) | ||
125 | { | ||
126 | f.SetValue(es, new UUID((Guid)v)); // uuid); | ||
127 | } | ||
128 | else if (f.FieldType == typeof(string)) | ||
129 | { | ||
130 | f.SetValue(es, v.ToString()); | ||
131 | } | ||
132 | else if (f.FieldType == typeof(UInt32)) | ||
133 | { | ||
134 | f.SetValue(es, Convert.ToUInt32(v)); | ||
135 | } | ||
136 | else if (f.FieldType == typeof(Single)) | ||
137 | { | ||
138 | f.SetValue(es, Convert.ToSingle(v)); | ||
139 | } | ||
140 | else | ||
141 | f.SetValue(es, v); | ||
142 | } | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | insertEstate = true; | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | |||
151 | if (insertEstate && create) | ||
152 | { | ||
153 | DoCreate(es); | ||
154 | LinkRegion(regionID, (int)es.EstateID); | ||
155 | } | ||
156 | |||
157 | LoadBanList(es); | ||
158 | |||
159 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | ||
160 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | ||
161 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); | ||
162 | |||
163 | //Set event | ||
164 | es.OnSave += StoreEstateSettings; | ||
165 | return es; | ||
166 | } | ||
167 | |||
168 | public EstateSettings CreateNewEstate() | ||
169 | { | ||
170 | EstateSettings es = new EstateSettings(); | ||
171 | es.OnSave += StoreEstateSettings; | ||
172 | |||
173 | DoCreate(es); | ||
174 | |||
175 | LoadBanList(es); | ||
176 | |||
177 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | ||
178 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | ||
179 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); | ||
180 | |||
181 | return es; | ||
182 | } | ||
183 | |||
184 | private void DoCreate(EstateSettings es) | ||
185 | { | ||
186 | List<string> names = new List<string>(FieldList); | ||
187 | |||
188 | names.Remove("EstateID"); | ||
189 | |||
190 | string sql = string.Format("insert into estate_settings ({0}) values ( @{1})", String.Join(",", names.ToArray()), String.Join(", @", names.ToArray())); | ||
191 | |||
192 | //_Log.Debug("[DB ESTATE]: SQL: " + sql); | ||
193 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
194 | using (SqlCommand insertCommand = new SqlCommand(sql, conn)) | ||
195 | { | ||
196 | insertCommand.CommandText = sql + " SET @ID = SCOPE_IDENTITY()"; | ||
197 | |||
198 | foreach (string name in names) | ||
199 | { | ||
200 | insertCommand.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es))); | ||
201 | } | ||
202 | SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int); | ||
203 | idParameter.Direction = ParameterDirection.Output; | ||
204 | insertCommand.Parameters.Add(idParameter); | ||
205 | conn.Open(); | ||
206 | insertCommand.ExecuteNonQuery(); | ||
207 | |||
208 | es.EstateID = Convert.ToUInt32(idParameter.Value); | ||
209 | } | ||
210 | |||
211 | //TODO check if this is needed?? | ||
212 | es.Save(); | ||
213 | } | ||
214 | |||
215 | /// <summary> | ||
216 | /// Stores the estate settings. | ||
217 | /// </summary> | ||
218 | /// <param name="es">estate settings</param> | ||
219 | public void StoreEstateSettings(EstateSettings es) | ||
220 | { | ||
221 | List<string> names = new List<string>(FieldList); | ||
222 | |||
223 | names.Remove("EstateID"); | ||
224 | |||
225 | string sql = string.Format("UPDATE estate_settings SET "); | ||
226 | foreach (string name in names) | ||
227 | { | ||
228 | sql += name + " = @" + name + ", "; | ||
229 | } | ||
230 | sql = sql.Remove(sql.LastIndexOf(",")); | ||
231 | sql += " WHERE EstateID = @EstateID"; | ||
232 | |||
233 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
234 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
235 | { | ||
236 | foreach (string name in names) | ||
237 | { | ||
238 | cmd.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es))); | ||
239 | } | ||
240 | |||
241 | cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); | ||
242 | conn.Open(); | ||
243 | cmd.ExecuteNonQuery(); | ||
244 | } | ||
245 | |||
246 | SaveBanList(es); | ||
247 | SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); | ||
248 | SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); | ||
249 | SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); | ||
250 | } | ||
251 | |||
252 | #endregion | ||
253 | |||
254 | #region Private methods | ||
255 | |||
256 | private string[] FieldList | ||
257 | { | ||
258 | get { return new List<string>(_FieldMap.Keys).ToArray(); } | ||
259 | } | ||
260 | |||
261 | private void LoadBanList(EstateSettings es) | ||
262 | { | ||
263 | es.ClearBans(); | ||
264 | |||
265 | string sql = "select bannedUUID from estateban where EstateID = @EstateID"; | ||
266 | |||
267 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
268 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
269 | { | ||
270 | SqlParameter idParameter = new SqlParameter("@EstateID", SqlDbType.Int); | ||
271 | idParameter.Value = es.EstateID; | ||
272 | cmd.Parameters.Add(idParameter); | ||
273 | conn.Open(); | ||
274 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
275 | { | ||
276 | while (reader.Read()) | ||
277 | { | ||
278 | EstateBan eb = new EstateBan(); | ||
279 | |||
280 | eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid; | ||
281 | eb.BannedHostAddress = "0.0.0.0"; | ||
282 | eb.BannedHostIPMask = "0.0.0.0"; | ||
283 | es.AddBan(eb); | ||
284 | } | ||
285 | } | ||
286 | } | ||
287 | } | ||
288 | |||
289 | private UUID[] LoadUUIDList(uint estateID, string table) | ||
290 | { | ||
291 | List<UUID> uuids = new List<UUID>(); | ||
292 | |||
293 | string sql = string.Format("select uuid from {0} where EstateID = @EstateID", table); | ||
294 | |||
295 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
296 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
297 | { | ||
298 | cmd.Parameters.Add(_Database.CreateParameter("@EstateID", estateID)); | ||
299 | conn.Open(); | ||
300 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
301 | { | ||
302 | while (reader.Read()) | ||
303 | { | ||
304 | uuids.Add(new UUID((Guid)reader["uuid"])); //uuid); | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | |||
309 | return uuids.ToArray(); | ||
310 | } | ||
311 | |||
312 | private void SaveBanList(EstateSettings es) | ||
313 | { | ||
314 | //Delete first | ||
315 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
316 | { | ||
317 | conn.Open(); | ||
318 | using (SqlCommand cmd = conn.CreateCommand()) | ||
319 | { | ||
320 | cmd.CommandText = "delete from estateban where EstateID = @EstateID"; | ||
321 | cmd.Parameters.AddWithValue("@EstateID", (int)es.EstateID); | ||
322 | cmd.ExecuteNonQuery(); | ||
323 | |||
324 | //Insert after | ||
325 | cmd.CommandText = "insert into estateban (EstateID, bannedUUID,bannedIp, bannedIpHostMask, bannedNameMask) values ( @EstateID, @bannedUUID, '','','' )"; | ||
326 | cmd.Parameters.AddWithValue("@bannedUUID", Guid.Empty); | ||
327 | foreach (EstateBan b in es.EstateBans) | ||
328 | { | ||
329 | cmd.Parameters["@bannedUUID"].Value = b.BannedUserID.Guid; | ||
330 | cmd.ExecuteNonQuery(); | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | } | ||
335 | |||
336 | private void SaveUUIDList(uint estateID, string table, UUID[] data) | ||
337 | { | ||
338 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
339 | { | ||
340 | conn.Open(); | ||
341 | using (SqlCommand cmd = conn.CreateCommand()) | ||
342 | { | ||
343 | cmd.Parameters.AddWithValue("@EstateID", (int)estateID); | ||
344 | cmd.CommandText = string.Format("delete from {0} where EstateID = @EstateID", table); | ||
345 | cmd.ExecuteNonQuery(); | ||
346 | |||
347 | cmd.CommandText = string.Format("insert into {0} (EstateID, uuid) values ( @EstateID, @uuid )", table); | ||
348 | cmd.Parameters.AddWithValue("@uuid", Guid.Empty); | ||
349 | foreach (UUID uuid in data) | ||
350 | { | ||
351 | cmd.Parameters["@uuid"].Value = uuid.Guid; //.ToString(); //TODO check if this works | ||
352 | cmd.ExecuteNonQuery(); | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | |||
358 | public EstateSettings LoadEstateSettings(int estateID) | ||
359 | { | ||
360 | EstateSettings es = new EstateSettings(); | ||
361 | string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_settings where EstateID = @EstateID"; | ||
362 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
363 | { | ||
364 | conn.Open(); | ||
365 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
366 | { | ||
367 | cmd.Parameters.AddWithValue("@EstateID", (int)estateID); | ||
368 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
369 | { | ||
370 | if (reader.Read()) | ||
371 | { | ||
372 | foreach (string name in FieldList) | ||
373 | { | ||
374 | FieldInfo f = _FieldMap[name]; | ||
375 | object v = reader[name]; | ||
376 | if (f.FieldType == typeof(bool)) | ||
377 | { | ||
378 | f.SetValue(es, Convert.ToInt32(v) != 0); | ||
379 | } | ||
380 | else if (f.FieldType == typeof(UUID)) | ||
381 | { | ||
382 | f.SetValue(es, new UUID((Guid)v)); // uuid); | ||
383 | } | ||
384 | else if (f.FieldType == typeof(string)) | ||
385 | { | ||
386 | f.SetValue(es, v.ToString()); | ||
387 | } | ||
388 | else if (f.FieldType == typeof(UInt32)) | ||
389 | { | ||
390 | f.SetValue(es, Convert.ToUInt32(v)); | ||
391 | } | ||
392 | else if (f.FieldType == typeof(Single)) | ||
393 | { | ||
394 | f.SetValue(es, Convert.ToSingle(v)); | ||
395 | } | ||
396 | else | ||
397 | f.SetValue(es, v); | ||
398 | } | ||
399 | } | ||
400 | |||
401 | } | ||
402 | } | ||
403 | } | ||
404 | LoadBanList(es); | ||
405 | |||
406 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | ||
407 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | ||
408 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); | ||
409 | |||
410 | //Set event | ||
411 | es.OnSave += StoreEstateSettings; | ||
412 | return es; | ||
413 | |||
414 | } | ||
415 | |||
416 | public List<EstateSettings> LoadEstateSettingsAll() | ||
417 | { | ||
418 | List<EstateSettings> allEstateSettings = new List<EstateSettings>(); | ||
419 | |||
420 | List<int> allEstateIds = GetEstatesAll(); | ||
421 | |||
422 | foreach (int estateId in allEstateIds) | ||
423 | allEstateSettings.Add(LoadEstateSettings(estateId)); | ||
424 | |||
425 | return allEstateSettings; | ||
426 | } | ||
427 | |||
428 | public List<int> GetEstates(string search) | ||
429 | { | ||
430 | List<int> result = new List<int>(); | ||
431 | string sql = "select estateID from estate_settings where EstateName = @EstateName"; | ||
432 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
433 | { | ||
434 | conn.Open(); | ||
435 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
436 | { | ||
437 | cmd.Parameters.AddWithValue("@EstateName", search); | ||
438 | |||
439 | using (IDataReader reader = cmd.ExecuteReader()) | ||
440 | { | ||
441 | while (reader.Read()) | ||
442 | { | ||
443 | result.Add(Convert.ToInt32(reader["EstateID"])); | ||
444 | } | ||
445 | reader.Close(); | ||
446 | } | ||
447 | } | ||
448 | } | ||
449 | |||
450 | return result; | ||
451 | } | ||
452 | |||
453 | public List<int> GetEstatesAll() | ||
454 | { | ||
455 | List<int> result = new List<int>(); | ||
456 | string sql = "select estateID from estate_settings"; | ||
457 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
458 | { | ||
459 | conn.Open(); | ||
460 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
461 | { | ||
462 | using (IDataReader reader = cmd.ExecuteReader()) | ||
463 | { | ||
464 | while (reader.Read()) | ||
465 | { | ||
466 | result.Add(Convert.ToInt32(reader["EstateID"])); | ||
467 | } | ||
468 | reader.Close(); | ||
469 | } | ||
470 | } | ||
471 | } | ||
472 | |||
473 | return result; | ||
474 | } | ||
475 | |||
476 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
477 | { | ||
478 | List<int> result = new List<int>(); | ||
479 | string sql = "select estateID from estate_settings where EstateOwner = @EstateOwner"; | ||
480 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
481 | { | ||
482 | conn.Open(); | ||
483 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
484 | { | ||
485 | cmd.Parameters.AddWithValue("@EstateOwner", ownerID); | ||
486 | |||
487 | using (IDataReader reader = cmd.ExecuteReader()) | ||
488 | { | ||
489 | while (reader.Read()) | ||
490 | { | ||
491 | result.Add(Convert.ToInt32(reader["EstateID"])); | ||
492 | } | ||
493 | reader.Close(); | ||
494 | } | ||
495 | } | ||
496 | } | ||
497 | |||
498 | return result; | ||
499 | } | ||
500 | |||
501 | public bool LinkRegion(UUID regionID, int estateID) | ||
502 | { | ||
503 | string deleteSQL = "delete from estate_map where RegionID = @RegionID"; | ||
504 | string insertSQL = "insert into estate_map values (@RegionID, @EstateID)"; | ||
505 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
506 | { | ||
507 | conn.Open(); | ||
508 | SqlTransaction transaction = conn.BeginTransaction(); | ||
509 | |||
510 | try | ||
511 | { | ||
512 | using (SqlCommand cmd = new SqlCommand(deleteSQL, conn)) | ||
513 | { | ||
514 | cmd.Transaction = transaction; | ||
515 | cmd.Parameters.AddWithValue("@RegionID", regionID.Guid); | ||
516 | |||
517 | cmd.ExecuteNonQuery(); | ||
518 | } | ||
519 | |||
520 | using (SqlCommand cmd = new SqlCommand(insertSQL, conn)) | ||
521 | { | ||
522 | cmd.Transaction = transaction; | ||
523 | cmd.Parameters.AddWithValue("@RegionID", regionID.Guid); | ||
524 | cmd.Parameters.AddWithValue("@EstateID", estateID); | ||
525 | |||
526 | int ret = cmd.ExecuteNonQuery(); | ||
527 | |||
528 | if (ret != 0) | ||
529 | transaction.Commit(); | ||
530 | else | ||
531 | transaction.Rollback(); | ||
532 | |||
533 | return (ret != 0); | ||
534 | } | ||
535 | } | ||
536 | catch (Exception ex) | ||
537 | { | ||
538 | m_log.Error("[REGION DB]: LinkRegion failed: " + ex.Message); | ||
539 | transaction.Rollback(); | ||
540 | } | ||
541 | } | ||
542 | return false; | ||
543 | } | ||
544 | |||
545 | public List<UUID> GetRegions(int estateID) | ||
546 | { | ||
547 | List<UUID> result = new List<UUID>(); | ||
548 | string sql = "select RegionID from estate_map where EstateID = @EstateID"; | ||
549 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
550 | { | ||
551 | conn.Open(); | ||
552 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
553 | { | ||
554 | cmd.Parameters.AddWithValue("@EstateID", estateID); | ||
555 | |||
556 | using (IDataReader reader = cmd.ExecuteReader()) | ||
557 | { | ||
558 | while (reader.Read()) | ||
559 | { | ||
560 | result.Add(DBGuid.FromDB(reader["RegionID"])); | ||
561 | } | ||
562 | reader.Close(); | ||
563 | } | ||
564 | } | ||
565 | } | ||
566 | |||
567 | return result; | ||
568 | } | ||
569 | |||
570 | public bool DeleteEstate(int estateID) | ||
571 | { | ||
572 | // TODO: Implementation! | ||
573 | return false; | ||
574 | } | ||
575 | #endregion | ||
576 | } | ||
577 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs deleted file mode 100644 index 1af2dce..0000000 --- a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using System.Data.SqlClient; | ||
35 | using System.Reflection; | ||
36 | using System.Text; | ||
37 | |||
38 | namespace OpenSim.Data.MSSQL | ||
39 | { | ||
40 | public class MSSQLFriendsData : MSSQLGenericTableHandler<FriendsData>, IFriendsData | ||
41 | { | ||
42 | public MSSQLFriendsData(string connectionString, string realm) | ||
43 | : base(connectionString, realm, "FriendsStore") | ||
44 | { | ||
45 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
46 | { | ||
47 | conn.Open(); | ||
48 | Migration m = new Migration(conn, GetType().Assembly, "FriendsStore"); | ||
49 | m.Update(); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | public bool Delete(UUID principalID, string friend) | ||
54 | { | ||
55 | return Delete(principalID.ToString(), friend); | ||
56 | } | ||
57 | |||
58 | public override bool Delete(string principalID, string friend) | ||
59 | { | ||
60 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
61 | using (SqlCommand cmd = new SqlCommand()) | ||
62 | { | ||
63 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = @PrincipalID and Friend = @Friend", m_Realm); | ||
64 | cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString())); | ||
65 | cmd.Parameters.Add(m_database.CreateParameter("@Friend", friend)); | ||
66 | cmd.Connection = conn; | ||
67 | conn.Open(); | ||
68 | cmd.ExecuteNonQuery(); | ||
69 | |||
70 | return true; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | public FriendsData[] GetFriends(UUID principalID) | ||
75 | { | ||
76 | return GetFriends(principalID.ToString()); | ||
77 | } | ||
78 | |||
79 | public FriendsData[] GetFriends(string principalID) | ||
80 | { | ||
81 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
82 | using (SqlCommand cmd = new SqlCommand()) | ||
83 | { | ||
84 | |||
85 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = @PrincipalID", m_Realm); | ||
86 | cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString())); | ||
87 | cmd.Connection = conn; | ||
88 | conn.Open(); | ||
89 | return DoQuery(cmd); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | public FriendsData[] GetFriends(Guid principalID) | ||
94 | { | ||
95 | return GetFriends(principalID.ToString()); | ||
96 | } | ||
97 | |||
98 | } | ||
99 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs deleted file mode 100644 index 4145d95..0000000 --- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs +++ /dev/null | |||
@@ -1,384 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using System.Data.SqlClient; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using System.Text; | ||
38 | |||
39 | namespace OpenSim.Data.MSSQL | ||
40 | { | ||
41 | public class MSSQLGenericTableHandler<T> where T : class, new() | ||
42 | { | ||
43 | // private static readonly ILog m_log = | ||
44 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | protected string m_ConnectionString; | ||
47 | protected MSSQLManager m_database; //used for parameter type translation | ||
48 | protected Dictionary<string, FieldInfo> m_Fields = | ||
49 | new Dictionary<string, FieldInfo>(); | ||
50 | |||
51 | protected List<string> m_ColumnNames = null; | ||
52 | protected string m_Realm; | ||
53 | protected FieldInfo m_DataField = null; | ||
54 | |||
55 | public MSSQLGenericTableHandler(string connectionString, | ||
56 | string realm, string storeName) | ||
57 | { | ||
58 | m_Realm = realm; | ||
59 | |||
60 | m_ConnectionString = connectionString; | ||
61 | |||
62 | if (storeName != String.Empty) | ||
63 | { | ||
64 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
65 | { | ||
66 | conn.Open(); | ||
67 | Migration m = new Migration(conn, GetType().Assembly, storeName); | ||
68 | m.Update(); | ||
69 | } | ||
70 | |||
71 | } | ||
72 | m_database = new MSSQLManager(m_ConnectionString); | ||
73 | |||
74 | Type t = typeof(T); | ||
75 | FieldInfo[] fields = t.GetFields(BindingFlags.Public | | ||
76 | BindingFlags.Instance | | ||
77 | BindingFlags.DeclaredOnly); | ||
78 | |||
79 | if (fields.Length == 0) | ||
80 | return; | ||
81 | |||
82 | foreach (FieldInfo f in fields) | ||
83 | { | ||
84 | if (f.Name != "Data") | ||
85 | m_Fields[f.Name] = f; | ||
86 | else | ||
87 | m_DataField = f; | ||
88 | } | ||
89 | |||
90 | } | ||
91 | |||
92 | private void CheckColumnNames(SqlDataReader reader) | ||
93 | { | ||
94 | if (m_ColumnNames != null) | ||
95 | return; | ||
96 | |||
97 | m_ColumnNames = new List<string>(); | ||
98 | |||
99 | DataTable schemaTable = reader.GetSchemaTable(); | ||
100 | foreach (DataRow row in schemaTable.Rows) | ||
101 | { | ||
102 | if (row["ColumnName"] != null && | ||
103 | (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) | ||
104 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
105 | |||
106 | } | ||
107 | } | ||
108 | |||
109 | private List<string> GetConstraints() | ||
110 | { | ||
111 | List<string> constraints = new List<string>(); | ||
112 | string query = string.Format(@"SELECT | ||
113 | COL_NAME(ic.object_id,ic.column_id) AS column_name | ||
114 | FROM sys.indexes AS i | ||
115 | INNER JOIN sys.index_columns AS ic | ||
116 | ON i.object_id = ic.object_id AND i.index_id = ic.index_id | ||
117 | WHERE i.is_primary_key = 1 | ||
118 | AND i.object_id = OBJECT_ID('{0}');", m_Realm); | ||
119 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
120 | using (SqlCommand cmd = new SqlCommand(query, conn)) | ||
121 | { | ||
122 | conn.Open(); | ||
123 | using (SqlDataReader rdr = cmd.ExecuteReader()) | ||
124 | { | ||
125 | while (rdr.Read()) | ||
126 | { | ||
127 | // query produces 0 to many rows of single column, so always add the first item in each row | ||
128 | constraints.Add((string)rdr[0]); | ||
129 | } | ||
130 | } | ||
131 | return constraints; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | public virtual T[] Get(string field, string key) | ||
136 | { | ||
137 | return Get(new string[] { field }, new string[] { key }); | ||
138 | } | ||
139 | |||
140 | public virtual T[] Get(string[] fields, string[] keys) | ||
141 | { | ||
142 | if (fields.Length != keys.Length) | ||
143 | return new T[0]; | ||
144 | |||
145 | List<string> terms = new List<string>(); | ||
146 | |||
147 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
148 | using (SqlCommand cmd = new SqlCommand()) | ||
149 | { | ||
150 | |||
151 | for (int i = 0; i < fields.Length; i++) | ||
152 | { | ||
153 | cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i])); | ||
154 | terms.Add("[" + fields[i] + "] = @" + fields[i]); | ||
155 | } | ||
156 | |||
157 | string where = String.Join(" AND ", terms.ToArray()); | ||
158 | |||
159 | string query = String.Format("SELECT * FROM {0} WHERE {1}", | ||
160 | m_Realm, where); | ||
161 | |||
162 | cmd.Connection = conn; | ||
163 | cmd.CommandText = query; | ||
164 | conn.Open(); | ||
165 | return DoQuery(cmd); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | protected T[] DoQuery(SqlCommand cmd) | ||
170 | { | ||
171 | List<T> result = new List<T>(); | ||
172 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
173 | { | ||
174 | if (reader == null) | ||
175 | return new T[0]; | ||
176 | |||
177 | CheckColumnNames(reader); | ||
178 | |||
179 | while (reader.Read()) | ||
180 | { | ||
181 | T row = new T(); | ||
182 | |||
183 | foreach (string name in m_Fields.Keys) | ||
184 | { | ||
185 | if (m_Fields[name].GetValue(row) is bool) | ||
186 | { | ||
187 | int v = Convert.ToInt32(reader[name]); | ||
188 | m_Fields[name].SetValue(row, v != 0 ? true : false); | ||
189 | } | ||
190 | else if (m_Fields[name].GetValue(row) is UUID) | ||
191 | { | ||
192 | UUID uuid = UUID.Zero; | ||
193 | |||
194 | UUID.TryParse(reader[name].ToString(), out uuid); | ||
195 | m_Fields[name].SetValue(row, uuid); | ||
196 | } | ||
197 | else if (m_Fields[name].GetValue(row) is int) | ||
198 | { | ||
199 | int v = Convert.ToInt32(reader[name]); | ||
200 | m_Fields[name].SetValue(row, v); | ||
201 | } | ||
202 | else | ||
203 | { | ||
204 | m_Fields[name].SetValue(row, reader[name]); | ||
205 | } | ||
206 | } | ||
207 | |||
208 | if (m_DataField != null) | ||
209 | { | ||
210 | Dictionary<string, string> data = | ||
211 | new Dictionary<string, string>(); | ||
212 | |||
213 | foreach (string col in m_ColumnNames) | ||
214 | { | ||
215 | data[col] = reader[col].ToString(); | ||
216 | if (data[col] == null) | ||
217 | data[col] = String.Empty; | ||
218 | } | ||
219 | |||
220 | m_DataField.SetValue(row, data); | ||
221 | } | ||
222 | |||
223 | result.Add(row); | ||
224 | } | ||
225 | return result.ToArray(); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | public virtual T[] Get(string where) | ||
230 | { | ||
231 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
232 | using (SqlCommand cmd = new SqlCommand()) | ||
233 | { | ||
234 | |||
235 | string query = String.Format("SELECT * FROM {0} WHERE {1}", | ||
236 | m_Realm, where); | ||
237 | cmd.Connection = conn; | ||
238 | cmd.CommandText = query; | ||
239 | |||
240 | //m_log.WarnFormat("[MSSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where); | ||
241 | |||
242 | conn.Open(); | ||
243 | return DoQuery(cmd); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | public virtual bool Store(T row) | ||
248 | { | ||
249 | List<string> constraintFields = GetConstraints(); | ||
250 | List<KeyValuePair<string, string>> constraints = new List<KeyValuePair<string, string>>(); | ||
251 | |||
252 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
253 | using (SqlCommand cmd = new SqlCommand()) | ||
254 | { | ||
255 | |||
256 | StringBuilder query = new StringBuilder(); | ||
257 | List<String> names = new List<String>(); | ||
258 | List<String> values = new List<String>(); | ||
259 | |||
260 | foreach (FieldInfo fi in m_Fields.Values) | ||
261 | { | ||
262 | names.Add(fi.Name); | ||
263 | values.Add("@" + fi.Name); | ||
264 | // Temporarily return more information about what field is unexpectedly null for | ||
265 | // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the | ||
266 | // InventoryTransferModule or we may be required to substitute a DBNull here. | ||
267 | if (fi.GetValue(row) == null) | ||
268 | throw new NullReferenceException( | ||
269 | string.Format( | ||
270 | "[MSSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null", | ||
271 | fi.Name, row)); | ||
272 | |||
273 | if (constraintFields.Count > 0 && constraintFields.Contains(fi.Name)) | ||
274 | { | ||
275 | constraints.Add(new KeyValuePair<string, string>(fi.Name, fi.GetValue(row).ToString())); | ||
276 | } | ||
277 | cmd.Parameters.Add(m_database.CreateParameter(fi.Name, fi.GetValue(row).ToString())); | ||
278 | } | ||
279 | |||
280 | if (m_DataField != null) | ||
281 | { | ||
282 | Dictionary<string, string> data = | ||
283 | (Dictionary<string, string>)m_DataField.GetValue(row); | ||
284 | |||
285 | foreach (KeyValuePair<string, string> kvp in data) | ||
286 | { | ||
287 | if (constraintFields.Count > 0 && constraintFields.Contains(kvp.Key)) | ||
288 | { | ||
289 | constraints.Add(new KeyValuePair<string, string>(kvp.Key, kvp.Key)); | ||
290 | } | ||
291 | names.Add(kvp.Key); | ||
292 | values.Add("@" + kvp.Key); | ||
293 | cmd.Parameters.Add(m_database.CreateParameter("@" + kvp.Key, kvp.Value)); | ||
294 | } | ||
295 | |||
296 | } | ||
297 | |||
298 | query.AppendFormat("UPDATE {0} SET ", m_Realm); | ||
299 | int i = 0; | ||
300 | for (i = 0; i < names.Count - 1; i++) | ||
301 | { | ||
302 | query.AppendFormat("[{0}] = {1}, ", names[i], values[i]); | ||
303 | } | ||
304 | query.AppendFormat("[{0}] = {1} ", names[i], values[i]); | ||
305 | if (constraints.Count > 0) | ||
306 | { | ||
307 | List<string> terms = new List<string>(); | ||
308 | for (int j = 0; j < constraints.Count; j++) | ||
309 | { | ||
310 | terms.Add(" [" + constraints[j].Key + "] = @" + constraints[j].Key); | ||
311 | } | ||
312 | string where = String.Join(" AND ", terms.ToArray()); | ||
313 | query.AppendFormat(" WHERE {0} ", where); | ||
314 | |||
315 | } | ||
316 | cmd.Connection = conn; | ||
317 | cmd.CommandText = query.ToString(); | ||
318 | |||
319 | conn.Open(); | ||
320 | if (cmd.ExecuteNonQuery() > 0) | ||
321 | { | ||
322 | //m_log.WarnFormat("[MSSQLGenericTable]: Updating {0}", m_Realm); | ||
323 | return true; | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | // assume record has not yet been inserted | ||
328 | |||
329 | query = new StringBuilder(); | ||
330 | query.AppendFormat("INSERT INTO {0} ([", m_Realm); | ||
331 | query.Append(String.Join("],[", names.ToArray())); | ||
332 | query.Append("]) values (" + String.Join(",", values.ToArray()) + ")"); | ||
333 | cmd.Connection = conn; | ||
334 | cmd.CommandText = query.ToString(); | ||
335 | //m_log.WarnFormat("[MSSQLGenericTable]: Inserting into {0}", m_Realm); | ||
336 | if (conn.State != ConnectionState.Open) | ||
337 | conn.Open(); | ||
338 | if (cmd.ExecuteNonQuery() > 0) | ||
339 | return true; | ||
340 | } | ||
341 | |||
342 | return false; | ||
343 | } | ||
344 | } | ||
345 | |||
346 | public virtual bool Delete(string field, string key) | ||
347 | { | ||
348 | return Delete(new string[] { field }, new string[] { key }); | ||
349 | } | ||
350 | |||
351 | public virtual bool Delete(string[] fields, string[] keys) | ||
352 | { | ||
353 | if (fields.Length != keys.Length) | ||
354 | return false; | ||
355 | |||
356 | List<string> terms = new List<string>(); | ||
357 | |||
358 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
359 | using (SqlCommand cmd = new SqlCommand()) | ||
360 | { | ||
361 | for (int i = 0; i < fields.Length; i++) | ||
362 | { | ||
363 | cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i])); | ||
364 | terms.Add("[" + fields[i] + "] = @" + fields[i]); | ||
365 | } | ||
366 | |||
367 | string where = String.Join(" AND ", terms.ToArray()); | ||
368 | |||
369 | string query = String.Format("DELETE FROM {0} WHERE {1}", m_Realm, where); | ||
370 | |||
371 | cmd.Connection = conn; | ||
372 | cmd.CommandText = query; | ||
373 | conn.Open(); | ||
374 | |||
375 | if (cmd.ExecuteNonQuery() > 0) | ||
376 | { | ||
377 | //m_log.Warn("[MSSQLGenericTable]: " + deleteCommand); | ||
378 | return true; | ||
379 | } | ||
380 | return false; | ||
381 | } | ||
382 | } | ||
383 | } | ||
384 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs deleted file mode 100644 index 8ec8d49..0000000 --- a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using System.Data.SqlClient; | ||
37 | |||
38 | namespace OpenSim.Data.MSSQL | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A MSSQL Interface for Avatar Storage | ||
42 | /// </summary> | ||
43 | public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>, | ||
44 | IGridUserData | ||
45 | { | ||
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | public MSSQLGridUserData(string connectionString, string realm) : | ||
49 | base(connectionString, realm, "GridUserStore") | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public new GridUserData Get(string userID) | ||
54 | { | ||
55 | GridUserData[] ret = Get("UserID", userID); | ||
56 | |||
57 | if (ret.Length == 0) | ||
58 | return null; | ||
59 | |||
60 | return ret[0]; | ||
61 | } | ||
62 | |||
63 | public GridUserData[] GetAll(string userID) | ||
64 | { | ||
65 | return base.Get(String.Format("UserID LIKE '{0}%'", userID)); | ||
66 | } | ||
67 | |||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs deleted file mode 100644 index 961593f..0000000 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ /dev/null | |||
@@ -1,831 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Data.SqlClient; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Data.MSSQL | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// A MSSQL interface for the inventory server | ||
41 | /// </summary> | ||
42 | public class MSSQLInventoryData : IInventoryDataPlugin | ||
43 | { | ||
44 | private const string _migrationStore = "InventoryStore"; | ||
45 | |||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | /// <summary> | ||
49 | /// The database manager | ||
50 | /// </summary> | ||
51 | private MSSQLManager database; | ||
52 | private string m_connectionString; | ||
53 | |||
54 | #region IPlugin members | ||
55 | |||
56 | [Obsolete("Cannot be default-initialized!")] | ||
57 | public void Initialise() | ||
58 | { | ||
59 | m_log.Info("[MSSQLInventoryData]: " + Name + " cannot be default-initialized!"); | ||
60 | throw new PluginNotInitialisedException(Name); | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Loads and initialises the MSSQL inventory storage interface | ||
65 | /// </summary> | ||
66 | /// <param name="connectionString">connect string</param> | ||
67 | /// <remarks>use mssql_connection.ini</remarks> | ||
68 | public void Initialise(string connectionString) | ||
69 | { | ||
70 | m_connectionString = connectionString; | ||
71 | database = new MSSQLManager(connectionString); | ||
72 | |||
73 | //New migrations check of store | ||
74 | database.CheckMigration(_migrationStore); | ||
75 | } | ||
76 | |||
77 | /// <summary> | ||
78 | /// The name of this DB provider | ||
79 | /// </summary> | ||
80 | /// <returns>A string containing the name of the DB provider</returns> | ||
81 | public string Name | ||
82 | { | ||
83 | get { return "MSSQL Inventory Data Interface"; } | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Closes this DB provider | ||
88 | /// </summary> | ||
89 | public void Dispose() | ||
90 | { | ||
91 | database = null; | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// Returns the version of this DB provider | ||
96 | /// </summary> | ||
97 | /// <returns>A string containing the DB provider</returns> | ||
98 | public string Version | ||
99 | { | ||
100 | get { return database.getVersion(); } | ||
101 | } | ||
102 | |||
103 | #endregion | ||
104 | |||
105 | #region Folder methods | ||
106 | |||
107 | /// <summary> | ||
108 | /// Returns a list of the root folders within a users inventory | ||
109 | /// </summary> | ||
110 | /// <param name="user">The user whos inventory is to be searched</param> | ||
111 | /// <returns>A list of folder objects</returns> | ||
112 | public List<InventoryFolderBase> getUserRootFolders(UUID user) | ||
113 | { | ||
114 | if (user == UUID.Zero) | ||
115 | return new List<InventoryFolderBase>(); | ||
116 | |||
117 | return getInventoryFolders(UUID.Zero, user); | ||
118 | } | ||
119 | |||
120 | /// <summary> | ||
121 | /// see InventoryItemBase.getUserRootFolder | ||
122 | /// </summary> | ||
123 | /// <param name="user">the User UUID</param> | ||
124 | /// <returns></returns> | ||
125 | public InventoryFolderBase getUserRootFolder(UUID user) | ||
126 | { | ||
127 | List<InventoryFolderBase> items = getUserRootFolders(user); | ||
128 | |||
129 | InventoryFolderBase rootFolder = null; | ||
130 | |||
131 | // There should only ever be one root folder for a user. However, if there's more | ||
132 | // than one we'll simply use the first one rather than failing. It would be even | ||
133 | // nicer to print some message to this effect, but this feels like it's too low a | ||
134 | // to put such a message out, and it's too minor right now to spare the time to | ||
135 | // suitably refactor. | ||
136 | if (items.Count > 0) | ||
137 | { | ||
138 | rootFolder = items[0]; | ||
139 | } | ||
140 | |||
141 | return rootFolder; | ||
142 | } | ||
143 | |||
144 | /// <summary> | ||
145 | /// Returns a list of folders in a users inventory contained within the specified folder | ||
146 | /// </summary> | ||
147 | /// <param name="parentID">The folder to search</param> | ||
148 | /// <returns>A list of inventory folders</returns> | ||
149 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) | ||
150 | { | ||
151 | return getInventoryFolders(parentID, UUID.Zero); | ||
152 | } | ||
153 | |||
154 | /// <summary> | ||
155 | /// Returns a specified inventory folder | ||
156 | /// </summary> | ||
157 | /// <param name="folderID">The folder to return</param> | ||
158 | /// <returns>A folder class</returns> | ||
159 | public InventoryFolderBase getInventoryFolder(UUID folderID) | ||
160 | { | ||
161 | string sql = "SELECT * FROM inventoryfolders WHERE folderID = @folderID"; | ||
162 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
163 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
164 | { | ||
165 | cmd.Parameters.Add(database.CreateParameter("folderID", folderID)); | ||
166 | conn.Open(); | ||
167 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
168 | { | ||
169 | if (reader.Read()) | ||
170 | { | ||
171 | return readInventoryFolder(reader); | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | m_log.InfoFormat("[INVENTORY DB] : Found no inventory folder with ID : {0}", folderID); | ||
176 | return null; | ||
177 | } | ||
178 | |||
179 | /// <summary> | ||
180 | /// Returns all child folders in the hierarchy from the parent folder and down. | ||
181 | /// Does not return the parent folder itself. | ||
182 | /// </summary> | ||
183 | /// <param name="parentID">The folder to get subfolders for</param> | ||
184 | /// <returns>A list of inventory folders</returns> | ||
185 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) | ||
186 | { | ||
187 | //Note maybe change this to use a Dataset that loading in all folders of a user and then go throw it that way. | ||
188 | //Note this is changed so it opens only one connection to the database and not everytime it wants to get data. | ||
189 | |||
190 | /* NOTE: the implementation below is very inefficient (makes a separate request to get subfolders for | ||
191 | * every found folder, recursively). Inventory code for other DBs has been already rewritten to get ALL | ||
192 | * inventory for a specific user at once. | ||
193 | * | ||
194 | * Meanwhile, one little thing is corrected: getFolderHierarchy(UUID.Zero) doesn't make sense and should never | ||
195 | * be used, so check for that and return an empty list. | ||
196 | */ | ||
197 | |||
198 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
199 | |||
200 | if (parentID == UUID.Zero) | ||
201 | return folders; | ||
202 | |||
203 | string sql = "SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID"; | ||
204 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
205 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
206 | { | ||
207 | cmd.Parameters.Add(database.CreateParameter("@parentID", parentID)); | ||
208 | conn.Open(); | ||
209 | folders.AddRange(getInventoryFolders(cmd)); | ||
210 | |||
211 | List<InventoryFolderBase> tempFolders = new List<InventoryFolderBase>(); | ||
212 | |||
213 | foreach (InventoryFolderBase folderBase in folders) | ||
214 | { | ||
215 | tempFolders.AddRange(getFolderHierarchy(folderBase.ID, cmd)); | ||
216 | } | ||
217 | if (tempFolders.Count > 0) | ||
218 | { | ||
219 | folders.AddRange(tempFolders); | ||
220 | } | ||
221 | } | ||
222 | return folders; | ||
223 | } | ||
224 | |||
225 | /// <summary> | ||
226 | /// Creates a new inventory folder | ||
227 | /// </summary> | ||
228 | /// <param name="folder">Folder to create</param> | ||
229 | public void addInventoryFolder(InventoryFolderBase folder) | ||
230 | { | ||
231 | string sql = @"INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) | ||
232 | VALUES (@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; | ||
233 | |||
234 | string folderName = folder.Name; | ||
235 | if (folderName.Length > 64) | ||
236 | { | ||
237 | folderName = folderName.Substring(0, 64); | ||
238 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length.ToString() + " to " + folderName.Length + " characters on add"); | ||
239 | } | ||
240 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
241 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
242 | { | ||
243 | cmd.Parameters.Add(database.CreateParameter("folderID", folder.ID)); | ||
244 | cmd.Parameters.Add(database.CreateParameter("agentID", folder.Owner)); | ||
245 | cmd.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID)); | ||
246 | cmd.Parameters.Add(database.CreateParameter("folderName", folderName)); | ||
247 | cmd.Parameters.Add(database.CreateParameter("type", folder.Type)); | ||
248 | cmd.Parameters.Add(database.CreateParameter("version", folder.Version)); | ||
249 | conn.Open(); | ||
250 | try | ||
251 | { | ||
252 | cmd.ExecuteNonQuery(); | ||
253 | } | ||
254 | catch (Exception e) | ||
255 | { | ||
256 | m_log.ErrorFormat("[INVENTORY DB]: Error : {0}", e.Message); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
261 | /// <summary> | ||
262 | /// Updates an inventory folder | ||
263 | /// </summary> | ||
264 | /// <param name="folder">Folder to update</param> | ||
265 | public void updateInventoryFolder(InventoryFolderBase folder) | ||
266 | { | ||
267 | string sql = @"UPDATE inventoryfolders SET agentID = @agentID, | ||
268 | parentFolderID = @parentFolderID, | ||
269 | folderName = @folderName, | ||
270 | type = @type, | ||
271 | version = @version | ||
272 | WHERE folderID = @folderID"; | ||
273 | |||
274 | string folderName = folder.Name; | ||
275 | if (folderName.Length > 64) | ||
276 | { | ||
277 | folderName = folderName.Substring(0, 64); | ||
278 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length.ToString() + " to " + folderName.Length + " characters on update"); | ||
279 | } | ||
280 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
281 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
282 | { | ||
283 | cmd.Parameters.Add(database.CreateParameter("folderID", folder.ID)); | ||
284 | cmd.Parameters.Add(database.CreateParameter("agentID", folder.Owner)); | ||
285 | cmd.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID)); | ||
286 | cmd.Parameters.Add(database.CreateParameter("folderName", folderName)); | ||
287 | cmd.Parameters.Add(database.CreateParameter("type", folder.Type)); | ||
288 | cmd.Parameters.Add(database.CreateParameter("version", folder.Version)); | ||
289 | conn.Open(); | ||
290 | try | ||
291 | { | ||
292 | cmd.ExecuteNonQuery(); | ||
293 | } | ||
294 | catch (Exception e) | ||
295 | { | ||
296 | m_log.ErrorFormat("[INVENTORY DB]: Error : {0}", e.Message); | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | |||
301 | /// <summary> | ||
302 | /// Updates an inventory folder | ||
303 | /// </summary> | ||
304 | /// <param name="folder">Folder to update</param> | ||
305 | public void moveInventoryFolder(InventoryFolderBase folder) | ||
306 | { | ||
307 | string sql = @"UPDATE inventoryfolders SET parentFolderID = @parentFolderID WHERE folderID = @folderID"; | ||
308 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
309 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
310 | { | ||
311 | cmd.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID)); | ||
312 | cmd.Parameters.Add(database.CreateParameter("folderID", folder.ID)); | ||
313 | conn.Open(); | ||
314 | try | ||
315 | { | ||
316 | cmd.ExecuteNonQuery(); | ||
317 | } | ||
318 | catch (Exception e) | ||
319 | { | ||
320 | m_log.ErrorFormat("[INVENTORY DB]: Error : {0}", e.Message); | ||
321 | } | ||
322 | } | ||
323 | } | ||
324 | |||
325 | /// <summary> | ||
326 | /// Delete an inventory folder | ||
327 | /// </summary> | ||
328 | /// <param name="folderID">Id of folder to delete</param> | ||
329 | public void deleteInventoryFolder(UUID folderID) | ||
330 | { | ||
331 | string sql = "SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID"; | ||
332 | |||
333 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
334 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
335 | { | ||
336 | List<InventoryFolderBase> subFolders; | ||
337 | cmd.Parameters.Add(database.CreateParameter("@parentID", UUID.Zero)); | ||
338 | conn.Open(); | ||
339 | subFolders = getFolderHierarchy(folderID, cmd); | ||
340 | |||
341 | |||
342 | //Delete all sub-folders | ||
343 | foreach (InventoryFolderBase f in subFolders) | ||
344 | { | ||
345 | DeleteOneFolder(f.ID, conn); | ||
346 | DeleteItemsInFolder(f.ID, conn); | ||
347 | } | ||
348 | |||
349 | //Delete the actual row | ||
350 | DeleteOneFolder(folderID, conn); | ||
351 | DeleteItemsInFolder(folderID, conn); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | #endregion | ||
356 | |||
357 | #region Item Methods | ||
358 | |||
359 | /// <summary> | ||
360 | /// Returns a list of items in a specified folder | ||
361 | /// </summary> | ||
362 | /// <param name="folderID">The folder to search</param> | ||
363 | /// <returns>A list containing inventory items</returns> | ||
364 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) | ||
365 | { | ||
366 | string sql = "SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID"; | ||
367 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
368 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
369 | { | ||
370 | cmd.Parameters.Add(database.CreateParameter("parentFolderID", folderID)); | ||
371 | conn.Open(); | ||
372 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
373 | |||
374 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
375 | { | ||
376 | while (reader.Read()) | ||
377 | { | ||
378 | items.Add(readInventoryItem(reader)); | ||
379 | } | ||
380 | } | ||
381 | return items; | ||
382 | } | ||
383 | } | ||
384 | |||
385 | /// <summary> | ||
386 | /// Returns a specified inventory item | ||
387 | /// </summary> | ||
388 | /// <param name="itemID">The item ID</param> | ||
389 | /// <returns>An inventory item</returns> | ||
390 | public InventoryItemBase getInventoryItem(UUID itemID) | ||
391 | { | ||
392 | string sql = "SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID"; | ||
393 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
394 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
395 | { | ||
396 | cmd.Parameters.Add(database.CreateParameter("inventoryID", itemID)); | ||
397 | conn.Open(); | ||
398 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
399 | { | ||
400 | if (reader.Read()) | ||
401 | { | ||
402 | return readInventoryItem(reader); | ||
403 | } | ||
404 | } | ||
405 | } | ||
406 | |||
407 | m_log.InfoFormat("[INVENTORY DB]: Found no inventory item with ID : {0}", itemID); | ||
408 | return null; | ||
409 | } | ||
410 | |||
411 | /// <summary> | ||
412 | /// Adds a specified item to the database | ||
413 | /// </summary> | ||
414 | /// <param name="item">The inventory item</param> | ||
415 | public void addInventoryItem(InventoryItemBase item) | ||
416 | { | ||
417 | if (getInventoryItem(item.ID) != null) | ||
418 | { | ||
419 | updateInventoryItem(item); | ||
420 | return; | ||
421 | } | ||
422 | |||
423 | string sql = @"INSERT INTO inventoryitems | ||
424 | ([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], | ||
425 | [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], | ||
426 | [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions], [inventoryGroupPermissions], | ||
427 | [salePrice], [saleType], [creationDate], [groupID], [groupOwned], [flags]) | ||
428 | VALUES | ||
429 | (@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, | ||
430 | @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, | ||
431 | @inventoryBasePermissions, @inventoryEveryOnePermissions, @inventoryGroupPermissions, @salePrice, @saleType, | ||
432 | @creationDate, @groupID, @groupOwned, @flags)"; | ||
433 | |||
434 | string itemName = item.Name; | ||
435 | if (item.Name.Length > 64) | ||
436 | { | ||
437 | itemName = item.Name.Substring(0, 64); | ||
438 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters"); | ||
439 | } | ||
440 | |||
441 | string itemDesc = item.Description; | ||
442 | if (item.Description.Length > 128) | ||
443 | { | ||
444 | itemDesc = item.Description.Substring(0, 128); | ||
445 | m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters"); | ||
446 | } | ||
447 | |||
448 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
449 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
450 | { | ||
451 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); | ||
452 | command.Parameters.Add(database.CreateParameter("assetID", item.AssetID)); | ||
453 | command.Parameters.Add(database.CreateParameter("assetType", item.AssetType)); | ||
454 | command.Parameters.Add(database.CreateParameter("parentFolderID", item.Folder)); | ||
455 | command.Parameters.Add(database.CreateParameter("avatarID", item.Owner)); | ||
456 | command.Parameters.Add(database.CreateParameter("inventoryName", itemName)); | ||
457 | command.Parameters.Add(database.CreateParameter("inventoryDescription", itemDesc)); | ||
458 | command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions)); | ||
459 | command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions)); | ||
460 | command.Parameters.Add(database.CreateParameter("invType", item.InvType)); | ||
461 | command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorId)); | ||
462 | command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions)); | ||
463 | command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions)); | ||
464 | command.Parameters.Add(database.CreateParameter("inventoryGroupPermissions", item.GroupPermissions)); | ||
465 | command.Parameters.Add(database.CreateParameter("salePrice", item.SalePrice)); | ||
466 | command.Parameters.Add(database.CreateParameter("saleType", item.SaleType)); | ||
467 | command.Parameters.Add(database.CreateParameter("creationDate", item.CreationDate)); | ||
468 | command.Parameters.Add(database.CreateParameter("groupID", item.GroupID)); | ||
469 | command.Parameters.Add(database.CreateParameter("groupOwned", item.GroupOwned)); | ||
470 | command.Parameters.Add(database.CreateParameter("flags", item.Flags)); | ||
471 | conn.Open(); | ||
472 | try | ||
473 | { | ||
474 | command.ExecuteNonQuery(); | ||
475 | } | ||
476 | catch (Exception e) | ||
477 | { | ||
478 | m_log.Error("[INVENTORY DB]: Error inserting item :" + e.Message); | ||
479 | } | ||
480 | } | ||
481 | |||
482 | sql = "UPDATE inventoryfolders SET version = version + 1 WHERE folderID = @folderID"; | ||
483 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
484 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
485 | { | ||
486 | command.Parameters.Add(database.CreateParameter("folderID", item.Folder.ToString())); | ||
487 | conn.Open(); | ||
488 | try | ||
489 | { | ||
490 | command.ExecuteNonQuery(); | ||
491 | } | ||
492 | catch (Exception e) | ||
493 | { | ||
494 | m_log.Error("[INVENTORY DB] Error updating inventory folder for new item :" + e.Message); | ||
495 | } | ||
496 | } | ||
497 | } | ||
498 | |||
499 | /// <summary> | ||
500 | /// Updates the specified inventory item | ||
501 | /// </summary> | ||
502 | /// <param name="item">Inventory item to update</param> | ||
503 | public void updateInventoryItem(InventoryItemBase item) | ||
504 | { | ||
505 | string sql = @"UPDATE inventoryitems SET assetID = @assetID, | ||
506 | assetType = @assetType, | ||
507 | parentFolderID = @parentFolderID, | ||
508 | avatarID = @avatarID, | ||
509 | inventoryName = @inventoryName, | ||
510 | inventoryDescription = @inventoryDescription, | ||
511 | inventoryNextPermissions = @inventoryNextPermissions, | ||
512 | inventoryCurrentPermissions = @inventoryCurrentPermissions, | ||
513 | invType = @invType, | ||
514 | creatorID = @creatorID, | ||
515 | inventoryBasePermissions = @inventoryBasePermissions, | ||
516 | inventoryEveryOnePermissions = @inventoryEveryOnePermissions, | ||
517 | inventoryGroupPermissions = @inventoryGroupPermissions, | ||
518 | salePrice = @salePrice, | ||
519 | saleType = @saleType, | ||
520 | creationDate = @creationDate, | ||
521 | groupID = @groupID, | ||
522 | groupOwned = @groupOwned, | ||
523 | flags = @flags | ||
524 | WHERE inventoryID = @inventoryID"; | ||
525 | |||
526 | string itemName = item.Name; | ||
527 | if (item.Name.Length > 64) | ||
528 | { | ||
529 | itemName = item.Name.Substring(0, 64); | ||
530 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters on update"); | ||
531 | } | ||
532 | |||
533 | string itemDesc = item.Description; | ||
534 | if (item.Description.Length > 128) | ||
535 | { | ||
536 | itemDesc = item.Description.Substring(0, 128); | ||
537 | m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters on update"); | ||
538 | } | ||
539 | |||
540 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
541 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
542 | { | ||
543 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); | ||
544 | command.Parameters.Add(database.CreateParameter("assetID", item.AssetID)); | ||
545 | command.Parameters.Add(database.CreateParameter("assetType", item.AssetType)); | ||
546 | command.Parameters.Add(database.CreateParameter("parentFolderID", item.Folder)); | ||
547 | command.Parameters.Add(database.CreateParameter("avatarID", item.Owner)); | ||
548 | command.Parameters.Add(database.CreateParameter("inventoryName", itemName)); | ||
549 | command.Parameters.Add(database.CreateParameter("inventoryDescription", itemDesc)); | ||
550 | command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions)); | ||
551 | command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions)); | ||
552 | command.Parameters.Add(database.CreateParameter("invType", item.InvType)); | ||
553 | command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorId)); | ||
554 | command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions)); | ||
555 | command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions)); | ||
556 | command.Parameters.Add(database.CreateParameter("inventoryGroupPermissions", item.GroupPermissions)); | ||
557 | command.Parameters.Add(database.CreateParameter("salePrice", item.SalePrice)); | ||
558 | command.Parameters.Add(database.CreateParameter("saleType", item.SaleType)); | ||
559 | command.Parameters.Add(database.CreateParameter("creationDate", item.CreationDate)); | ||
560 | command.Parameters.Add(database.CreateParameter("groupID", item.GroupID)); | ||
561 | command.Parameters.Add(database.CreateParameter("groupOwned", item.GroupOwned)); | ||
562 | command.Parameters.Add(database.CreateParameter("flags", item.Flags)); | ||
563 | conn.Open(); | ||
564 | try | ||
565 | { | ||
566 | command.ExecuteNonQuery(); | ||
567 | } | ||
568 | catch (Exception e) | ||
569 | { | ||
570 | m_log.Error("[INVENTORY DB]: Error updating item :" + e.Message); | ||
571 | } | ||
572 | } | ||
573 | } | ||
574 | |||
575 | // See IInventoryDataPlugin | ||
576 | |||
577 | /// <summary> | ||
578 | /// Delete an item in inventory database | ||
579 | /// </summary> | ||
580 | /// <param name="itemID">the item UUID</param> | ||
581 | public void deleteInventoryItem(UUID itemID) | ||
582 | { | ||
583 | string sql = "DELETE FROM inventoryitems WHERE inventoryID=@inventoryID"; | ||
584 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
585 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
586 | { | ||
587 | cmd.Parameters.Add(database.CreateParameter("inventoryID", itemID)); | ||
588 | try | ||
589 | { | ||
590 | conn.Open(); | ||
591 | cmd.ExecuteNonQuery(); | ||
592 | } | ||
593 | catch (Exception e) | ||
594 | { | ||
595 | m_log.Error("[INVENTORY DB]: Error deleting item :" + e.Message); | ||
596 | } | ||
597 | } | ||
598 | } | ||
599 | |||
600 | public InventoryItemBase queryInventoryItem(UUID itemID) | ||
601 | { | ||
602 | return getInventoryItem(itemID); | ||
603 | } | ||
604 | |||
605 | public InventoryFolderBase queryInventoryFolder(UUID folderID) | ||
606 | { | ||
607 | return getInventoryFolder(folderID); | ||
608 | } | ||
609 | |||
610 | /// <summary> | ||
611 | /// Returns all activated gesture-items in the inventory of the specified avatar. | ||
612 | /// </summary> | ||
613 | /// <param name="avatarID">The <see cref="UUID"/> of the avatar</param> | ||
614 | /// <returns> | ||
615 | /// The list of gestures (<see cref="InventoryItemBase"/>s) | ||
616 | /// </returns> | ||
617 | public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) | ||
618 | { | ||
619 | string sql = "SELECT * FROM inventoryitems WHERE avatarId = @uuid AND assetType = @assetType and flags = 1"; | ||
620 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
621 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
622 | { | ||
623 | cmd.Parameters.Add(database.CreateParameter("uuid", avatarID)); | ||
624 | cmd.Parameters.Add(database.CreateParameter("assetType", (int)AssetType.Gesture)); | ||
625 | conn.Open(); | ||
626 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
627 | { | ||
628 | List<InventoryItemBase> gestureList = new List<InventoryItemBase>(); | ||
629 | while (reader.Read()) | ||
630 | { | ||
631 | gestureList.Add(readInventoryItem(reader)); | ||
632 | } | ||
633 | return gestureList; | ||
634 | } | ||
635 | } | ||
636 | } | ||
637 | |||
638 | #endregion | ||
639 | |||
640 | #region Private methods | ||
641 | |||
642 | /// <summary> | ||
643 | /// Delete an item in inventory database | ||
644 | /// </summary> | ||
645 | /// <param name="folderID">the item ID</param> | ||
646 | /// <param name="connection">connection to the database</param> | ||
647 | private void DeleteItemsInFolder(UUID folderID, SqlConnection connection) | ||
648 | { | ||
649 | using (SqlCommand command = new SqlCommand("DELETE FROM inventoryitems WHERE folderID=@folderID", connection)) | ||
650 | { | ||
651 | command.Parameters.Add(database.CreateParameter("folderID", folderID)); | ||
652 | |||
653 | try | ||
654 | { | ||
655 | command.ExecuteNonQuery(); | ||
656 | } | ||
657 | catch (Exception e) | ||
658 | { | ||
659 | m_log.Error("[INVENTORY DB] Error deleting item :" + e.Message); | ||
660 | } | ||
661 | } | ||
662 | } | ||
663 | |||
664 | /// <summary> | ||
665 | /// Gets the folder hierarchy in a loop. | ||
666 | /// </summary> | ||
667 | /// <param name="parentID">parent ID.</param> | ||
668 | /// <param name="command">SQL command/connection to database</param> | ||
669 | /// <returns></returns> | ||
670 | private static List<InventoryFolderBase> getFolderHierarchy(UUID parentID, SqlCommand command) | ||
671 | { | ||
672 | command.Parameters["@parentID"].Value = parentID.Guid; //.ToString(); | ||
673 | |||
674 | List<InventoryFolderBase> folders = getInventoryFolders(command); | ||
675 | |||
676 | if (folders.Count > 0) | ||
677 | { | ||
678 | List<InventoryFolderBase> tempFolders = new List<InventoryFolderBase>(); | ||
679 | |||
680 | foreach (InventoryFolderBase folderBase in folders) | ||
681 | { | ||
682 | tempFolders.AddRange(getFolderHierarchy(folderBase.ID, command)); | ||
683 | } | ||
684 | |||
685 | if (tempFolders.Count > 0) | ||
686 | { | ||
687 | folders.AddRange(tempFolders); | ||
688 | } | ||
689 | } | ||
690 | return folders; | ||
691 | } | ||
692 | |||
693 | /// <summary> | ||
694 | /// Gets the inventory folders. | ||
695 | /// </summary> | ||
696 | /// <param name="parentID">parentID, use UUID.Zero to get root</param> | ||
697 | /// <param name="user">user id, use UUID.Zero, if you want all folders from a parentID.</param> | ||
698 | /// <returns></returns> | ||
699 | private List<InventoryFolderBase> getInventoryFolders(UUID parentID, UUID user) | ||
700 | { | ||
701 | string sql = "SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID AND agentID LIKE @uuid"; | ||
702 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
703 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
704 | { | ||
705 | if (user == UUID.Zero) | ||
706 | { | ||
707 | command.Parameters.Add(database.CreateParameter("uuid", "%")); | ||
708 | } | ||
709 | else | ||
710 | { | ||
711 | command.Parameters.Add(database.CreateParameter("uuid", user)); | ||
712 | } | ||
713 | command.Parameters.Add(database.CreateParameter("parentID", parentID)); | ||
714 | conn.Open(); | ||
715 | return getInventoryFolders(command); | ||
716 | } | ||
717 | } | ||
718 | |||
719 | /// <summary> | ||
720 | /// Gets the inventory folders. | ||
721 | /// </summary> | ||
722 | /// <param name="command">SQLcommand.</param> | ||
723 | /// <returns></returns> | ||
724 | private static List<InventoryFolderBase> getInventoryFolders(SqlCommand command) | ||
725 | { | ||
726 | using (SqlDataReader reader = command.ExecuteReader()) | ||
727 | { | ||
728 | |||
729 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | ||
730 | while (reader.Read()) | ||
731 | { | ||
732 | items.Add(readInventoryFolder(reader)); | ||
733 | } | ||
734 | return items; | ||
735 | } | ||
736 | } | ||
737 | |||
738 | /// <summary> | ||
739 | /// Reads a list of inventory folders returned by a query. | ||
740 | /// </summary> | ||
741 | /// <param name="reader">A MSSQL Data Reader</param> | ||
742 | /// <returns>A List containing inventory folders</returns> | ||
743 | protected static InventoryFolderBase readInventoryFolder(SqlDataReader reader) | ||
744 | { | ||
745 | try | ||
746 | { | ||
747 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
748 | folder.Owner = DBGuid.FromDB(reader["agentID"]); | ||
749 | folder.ParentID = DBGuid.FromDB(reader["parentFolderID"]); | ||
750 | folder.ID = DBGuid.FromDB(reader["folderID"]); | ||
751 | folder.Name = (string)reader["folderName"]; | ||
752 | folder.Type = (short)reader["type"]; | ||
753 | folder.Version = Convert.ToUInt16(reader["version"]); | ||
754 | |||
755 | return folder; | ||
756 | } | ||
757 | catch (Exception e) | ||
758 | { | ||
759 | m_log.Error("[INVENTORY DB] Error reading inventory folder :" + e.Message); | ||
760 | } | ||
761 | |||
762 | return null; | ||
763 | } | ||
764 | |||
765 | /// <summary> | ||
766 | /// Reads a one item from an SQL result | ||
767 | /// </summary> | ||
768 | /// <param name="reader">The SQL Result</param> | ||
769 | /// <returns>the item read</returns> | ||
770 | private static InventoryItemBase readInventoryItem(IDataRecord reader) | ||
771 | { | ||
772 | try | ||
773 | { | ||
774 | InventoryItemBase item = new InventoryItemBase(); | ||
775 | |||
776 | item.ID = DBGuid.FromDB(reader["inventoryID"]); | ||
777 | item.AssetID = DBGuid.FromDB(reader["assetID"]); | ||
778 | item.AssetType = Convert.ToInt32(reader["assetType"].ToString()); | ||
779 | item.Folder = DBGuid.FromDB(reader["parentFolderID"]); | ||
780 | item.Owner = DBGuid.FromDB(reader["avatarID"]); | ||
781 | item.Name = reader["inventoryName"].ToString(); | ||
782 | item.Description = reader["inventoryDescription"].ToString(); | ||
783 | item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); | ||
784 | item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); | ||
785 | item.InvType = Convert.ToInt32(reader["invType"].ToString()); | ||
786 | item.CreatorId = reader["creatorID"].ToString(); | ||
787 | item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); | ||
788 | item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); | ||
789 | item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]); | ||
790 | item.SalePrice = Convert.ToInt32(reader["salePrice"]); | ||
791 | item.SaleType = Convert.ToByte(reader["saleType"]); | ||
792 | item.CreationDate = Convert.ToInt32(reader["creationDate"]); | ||
793 | item.GroupID = DBGuid.FromDB(reader["groupID"]); | ||
794 | item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); | ||
795 | item.Flags = Convert.ToUInt32(reader["flags"]); | ||
796 | |||
797 | return item; | ||
798 | } | ||
799 | catch (SqlException e) | ||
800 | { | ||
801 | m_log.Error("[INVENTORY DB]: Error reading inventory item :" + e.Message); | ||
802 | } | ||
803 | |||
804 | return null; | ||
805 | } | ||
806 | |||
807 | /// <summary> | ||
808 | /// Delete a folder in inventory databasae | ||
809 | /// </summary> | ||
810 | /// <param name="folderID">the folder UUID</param> | ||
811 | /// <param name="connection">connection to database</param> | ||
812 | private void DeleteOneFolder(UUID folderID, SqlConnection connection) | ||
813 | { | ||
814 | try | ||
815 | { | ||
816 | using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection)) | ||
817 | { | ||
818 | command.Parameters.Add(database.CreateParameter("folderID", folderID)); | ||
819 | |||
820 | command.ExecuteNonQuery(); | ||
821 | } | ||
822 | } | ||
823 | catch (SqlException e) | ||
824 | { | ||
825 | m_log.Error("[INVENTORY DB]: Error deleting folder :" + e.Message); | ||
826 | } | ||
827 | } | ||
828 | |||
829 | #endregion | ||
830 | } | ||
831 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs deleted file mode 100644 index 9a0015c..0000000 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ /dev/null | |||
@@ -1,219 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Data.SqlClient; | ||
32 | using System.IO; | ||
33 | using System.Reflection; | ||
34 | using log4net; | ||
35 | using OpenMetaverse; | ||
36 | |||
37 | namespace OpenSim.Data.MSSQL | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// A management class for the MS SQL Storage Engine | ||
41 | /// </summary> | ||
42 | public class MSSQLManager | ||
43 | { | ||
44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Connection string for ADO.net | ||
48 | /// </summary> | ||
49 | private readonly string connectionString; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Initialize the manager and set the connectionstring | ||
53 | /// </summary> | ||
54 | /// <param name="connection"></param> | ||
55 | public MSSQLManager(string connection) | ||
56 | { | ||
57 | connectionString = connection; | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Type conversion to a SQLDbType functions | ||
62 | /// </summary> | ||
63 | /// <param name="type"></param> | ||
64 | /// <returns></returns> | ||
65 | internal SqlDbType DbtypeFromType(Type type) | ||
66 | { | ||
67 | if (type == typeof(string)) | ||
68 | { | ||
69 | return SqlDbType.VarChar; | ||
70 | } | ||
71 | if (type == typeof(double)) | ||
72 | { | ||
73 | return SqlDbType.Float; | ||
74 | } | ||
75 | if (type == typeof(Single)) | ||
76 | { | ||
77 | return SqlDbType.Float; | ||
78 | } | ||
79 | if (type == typeof(int)) | ||
80 | { | ||
81 | return SqlDbType.Int; | ||
82 | } | ||
83 | if (type == typeof(bool)) | ||
84 | { | ||
85 | return SqlDbType.Bit; | ||
86 | } | ||
87 | if (type == typeof(UUID)) | ||
88 | { | ||
89 | return SqlDbType.UniqueIdentifier; | ||
90 | } | ||
91 | if (type == typeof(sbyte)) | ||
92 | { | ||
93 | return SqlDbType.Int; | ||
94 | } | ||
95 | if (type == typeof(Byte[])) | ||
96 | { | ||
97 | return SqlDbType.Image; | ||
98 | } | ||
99 | if (type == typeof(uint) || type == typeof(ushort)) | ||
100 | { | ||
101 | return SqlDbType.Int; | ||
102 | } | ||
103 | if (type == typeof(ulong)) | ||
104 | { | ||
105 | return SqlDbType.BigInt; | ||
106 | } | ||
107 | if (type == typeof(DateTime)) | ||
108 | { | ||
109 | return SqlDbType.DateTime; | ||
110 | } | ||
111 | |||
112 | return SqlDbType.VarChar; | ||
113 | } | ||
114 | |||
115 | /// <summary> | ||
116 | /// Creates value for parameter. | ||
117 | /// </summary> | ||
118 | /// <param name="value">The value.</param> | ||
119 | /// <returns></returns> | ||
120 | private static object CreateParameterValue(object value) | ||
121 | { | ||
122 | Type valueType = value.GetType(); | ||
123 | |||
124 | if (valueType == typeof(UUID)) //TODO check if this works | ||
125 | { | ||
126 | return ((UUID) value).Guid; | ||
127 | } | ||
128 | if (valueType == typeof(UUID)) | ||
129 | { | ||
130 | return ((UUID)value).Guid; | ||
131 | } | ||
132 | if (valueType == typeof(bool)) | ||
133 | { | ||
134 | return (bool)value ? 1 : 0; | ||
135 | } | ||
136 | if (valueType == typeof(Byte[])) | ||
137 | { | ||
138 | return value; | ||
139 | } | ||
140 | if (valueType == typeof(int)) | ||
141 | { | ||
142 | return value; | ||
143 | } | ||
144 | return value; | ||
145 | } | ||
146 | |||
147 | /// <summary> | ||
148 | /// Create a parameter for a command | ||
149 | /// </summary> | ||
150 | /// <param name="parameterName">Name of the parameter.</param> | ||
151 | /// <param name="parameterObject">parameter object.</param> | ||
152 | /// <returns></returns> | ||
153 | internal SqlParameter CreateParameter(string parameterName, object parameterObject) | ||
154 | { | ||
155 | return CreateParameter(parameterName, parameterObject, false); | ||
156 | } | ||
157 | |||
158 | /// <summary> | ||
159 | /// Creates the parameter for a command. | ||
160 | /// </summary> | ||
161 | /// <param name="parameterName">Name of the parameter.</param> | ||
162 | /// <param name="parameterObject">parameter object.</param> | ||
163 | /// <param name="parameterOut">if set to <c>true</c> parameter is a output parameter</param> | ||
164 | /// <returns></returns> | ||
165 | internal SqlParameter CreateParameter(string parameterName, object parameterObject, bool parameterOut) | ||
166 | { | ||
167 | //Tweak so we dont always have to add @ sign | ||
168 | if (!parameterName.StartsWith("@")) parameterName = "@" + parameterName; | ||
169 | |||
170 | //HACK if object is null, it is turned into a string, there are no nullable type till now | ||
171 | if (parameterObject == null) parameterObject = ""; | ||
172 | |||
173 | SqlParameter parameter = new SqlParameter(parameterName, DbtypeFromType(parameterObject.GetType())); | ||
174 | |||
175 | if (parameterOut) | ||
176 | { | ||
177 | parameter.Direction = ParameterDirection.Output; | ||
178 | } | ||
179 | else | ||
180 | { | ||
181 | parameter.Direction = ParameterDirection.Input; | ||
182 | parameter.Value = CreateParameterValue(parameterObject); | ||
183 | } | ||
184 | |||
185 | return parameter; | ||
186 | } | ||
187 | |||
188 | /// <summary> | ||
189 | /// Checks if we need to do some migrations to the database | ||
190 | /// </summary> | ||
191 | /// <param name="migrationStore">migrationStore.</param> | ||
192 | public void CheckMigration(string migrationStore) | ||
193 | { | ||
194 | using (SqlConnection connection = new SqlConnection(connectionString)) | ||
195 | { | ||
196 | connection.Open(); | ||
197 | Assembly assem = GetType().Assembly; | ||
198 | MSSQLMigration migration = new MSSQLMigration(connection, assem, migrationStore); | ||
199 | |||
200 | migration.Update(); | ||
201 | } | ||
202 | } | ||
203 | |||
204 | /// <summary> | ||
205 | /// Returns the version of this DB provider | ||
206 | /// </summary> | ||
207 | /// <returns>A string containing the DB provider</returns> | ||
208 | public string getVersion() | ||
209 | { | ||
210 | Module module = GetType().Module; | ||
211 | // string dllName = module.Assembly.ManifestModule.Name; | ||
212 | Version dllVersion = module.Assembly.GetName().Version; | ||
213 | |||
214 | return | ||
215 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | ||
216 | dllVersion.Revision); | ||
217 | } | ||
218 | } | ||
219 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/MSSQL/MSSQLMigration.cs deleted file mode 100644 index c2fecef..0000000 --- a/OpenSim/Data/MSSQL/MSSQLMigration.cs +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Data; | ||
30 | using System.Data.Common; | ||
31 | using System.Reflection; | ||
32 | using System.Data.SqlClient; | ||
33 | |||
34 | namespace OpenSim.Data.MSSQL | ||
35 | { | ||
36 | public class MSSQLMigration : Migration | ||
37 | { | ||
38 | public MSSQLMigration(DbConnection conn, Assembly assem, string type) | ||
39 | : base(conn, assem, type) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | public MSSQLMigration(DbConnection conn, Assembly assem, string subtype, string type) | ||
44 | : base(conn, assem, subtype, type) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | protected override int FindVersion(DbConnection conn, string type) | ||
49 | { | ||
50 | int version = 0; | ||
51 | using (DbCommand cmd = conn.CreateCommand()) | ||
52 | { | ||
53 | try | ||
54 | { | ||
55 | cmd.CommandText = "select top 1 version from migrations where name = '" + type + "' order by version desc"; //Must be | ||
56 | using (IDataReader reader = cmd.ExecuteReader()) | ||
57 | { | ||
58 | if (reader.Read()) | ||
59 | { | ||
60 | version = Convert.ToInt32(reader["version"]); | ||
61 | } | ||
62 | reader.Close(); | ||
63 | } | ||
64 | } | ||
65 | catch | ||
66 | { | ||
67 | // Return -1 to indicate table does not exist | ||
68 | return -1; | ||
69 | } | ||
70 | } | ||
71 | return version; | ||
72 | } | ||
73 | |||
74 | protected override void ExecuteScript(DbConnection conn, string[] script) | ||
75 | { | ||
76 | if (!(conn is SqlConnection)) | ||
77 | { | ||
78 | base.ExecuteScript(conn, script); | ||
79 | return; | ||
80 | } | ||
81 | |||
82 | foreach (string sql in script) | ||
83 | { | ||
84 | try | ||
85 | { | ||
86 | using (SqlCommand cmd = new SqlCommand(sql, (SqlConnection)conn)) | ||
87 | { | ||
88 | cmd.ExecuteNonQuery(); | ||
89 | } | ||
90 | } | ||
91 | catch (Exception) | ||
92 | { | ||
93 | throw new Exception(sql); | ||
94 | |||
95 | } | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs b/OpenSim/Data/MSSQL/MSSQLPresenceData.cs deleted file mode 100644 index 0c71e79..0000000 --- a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using System.Data.SqlClient; | ||
37 | |||
38 | namespace OpenSim.Data.MSSQL | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A MySQL Interface for the Presence Server | ||
42 | /// </summary> | ||
43 | public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>, | ||
44 | IPresenceData | ||
45 | { | ||
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | public MSSQLPresenceData(string connectionString, string realm) : | ||
49 | base(connectionString, realm, "Presence") | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public PresenceData Get(UUID sessionID) | ||
54 | { | ||
55 | PresenceData[] ret = Get("SessionID", | ||
56 | sessionID.ToString()); | ||
57 | |||
58 | if (ret.Length == 0) | ||
59 | return null; | ||
60 | |||
61 | return ret[0]; | ||
62 | } | ||
63 | |||
64 | public void LogoutRegionAgents(UUID regionID) | ||
65 | { | ||
66 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
67 | using (SqlCommand cmd = new SqlCommand()) | ||
68 | { | ||
69 | |||
70 | cmd.CommandText = String.Format("DELETE FROM {0} WHERE [RegionID]=@RegionID", m_Realm); | ||
71 | |||
72 | cmd.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.ToString())); | ||
73 | cmd.Connection = conn; | ||
74 | conn.Open(); | ||
75 | cmd.ExecuteNonQuery(); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | public bool ReportAgent(UUID sessionID, UUID regionID) | ||
80 | { | ||
81 | PresenceData[] pd = Get("SessionID", sessionID.ToString()); | ||
82 | if (pd.Length == 0) | ||
83 | return false; | ||
84 | |||
85 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
86 | using (SqlCommand cmd = new SqlCommand()) | ||
87 | { | ||
88 | |||
89 | cmd.CommandText = String.Format(@"UPDATE {0} SET | ||
90 | [RegionID] = @RegionID | ||
91 | WHERE [SessionID] = @SessionID", m_Realm); | ||
92 | |||
93 | cmd.Parameters.Add(m_database.CreateParameter("@SessionID", sessionID.ToString())); | ||
94 | cmd.Parameters.Add(m_database.CreateParameter("@RegionID", regionID.ToString())); | ||
95 | cmd.Connection = conn; | ||
96 | conn.Open(); | ||
97 | if (cmd.ExecuteNonQuery() == 0) | ||
98 | return false; | ||
99 | } | ||
100 | return true; | ||
101 | } | ||
102 | |||
103 | public bool VerifyAgent(UUID agentId, UUID secureSessionID) | ||
104 | { | ||
105 | PresenceData[] ret = Get("SecureSessionID", | ||
106 | secureSessionID.ToString()); | ||
107 | |||
108 | if (ret.Length == 0) | ||
109 | return false; | ||
110 | |||
111 | if(ret[0].UserID != agentId.ToString()) | ||
112 | return false; | ||
113 | |||
114 | return true; | ||
115 | } | ||
116 | } | ||
117 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs deleted file mode 100644 index c0589df..0000000 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ /dev/null | |||
@@ -1,352 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Data.SqlClient; | ||
32 | using System.Drawing; | ||
33 | using System.IO; | ||
34 | using System.Reflection; | ||
35 | using log4net; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using RegionFlags = OpenSim.Framework.RegionFlags; | ||
41 | |||
42 | namespace OpenSim.Data.MSSQL | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// A MSSQL Interface for the Region Server. | ||
46 | /// </summary> | ||
47 | public class MSSQLRegionData : IRegionData | ||
48 | { | ||
49 | private string m_Realm; | ||
50 | private List<string> m_ColumnNames = null; | ||
51 | private string m_ConnectionString; | ||
52 | private MSSQLManager m_database; | ||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | |||
55 | public MSSQLRegionData(string connectionString, string realm) | ||
56 | { | ||
57 | m_Realm = realm; | ||
58 | m_ConnectionString = connectionString; | ||
59 | m_database = new MSSQLManager(connectionString); | ||
60 | |||
61 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
62 | { | ||
63 | conn.Open(); | ||
64 | Migration m = new Migration(conn, GetType().Assembly, "GridStore"); | ||
65 | m.Update(); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | public List<RegionData> Get(string regionName, UUID scopeID) | ||
70 | { | ||
71 | string sql = "select * from ["+m_Realm+"] where regionName like @regionName"; | ||
72 | if (scopeID != UUID.Zero) | ||
73 | sql += " and ScopeID = @scopeID"; | ||
74 | sql += " order by regionName"; | ||
75 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
76 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
77 | { | ||
78 | cmd.Parameters.Add(m_database.CreateParameter("@regionName", regionName)); | ||
79 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
80 | conn.Open(); | ||
81 | return RunCommand(cmd); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | public RegionData Get(int posX, int posY, UUID scopeID) | ||
86 | { | ||
87 | string sql = "select * from ["+m_Realm+"] where locX = @posX and locY = @posY"; | ||
88 | if (scopeID != UUID.Zero) | ||
89 | sql += " and ScopeID = @scopeID"; | ||
90 | |||
91 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
92 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
93 | { | ||
94 | cmd.Parameters.Add(m_database.CreateParameter("@posX", posX.ToString())); | ||
95 | cmd.Parameters.Add(m_database.CreateParameter("@posY", posY.ToString())); | ||
96 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
97 | conn.Open(); | ||
98 | List<RegionData> ret = RunCommand(cmd); | ||
99 | if (ret.Count == 0) | ||
100 | return null; | ||
101 | |||
102 | return ret[0]; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | public RegionData Get(UUID regionID, UUID scopeID) | ||
107 | { | ||
108 | string sql = "select * from ["+m_Realm+"] where uuid = @regionID"; | ||
109 | if (scopeID != UUID.Zero) | ||
110 | sql += " and ScopeID = @scopeID"; | ||
111 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
112 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
113 | { | ||
114 | cmd.Parameters.Add(m_database.CreateParameter("@regionID", regionID)); | ||
115 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
116 | conn.Open(); | ||
117 | List<RegionData> ret = RunCommand(cmd); | ||
118 | if (ret.Count == 0) | ||
119 | return null; | ||
120 | |||
121 | return ret[0]; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) | ||
126 | { | ||
127 | string sql = "select * from ["+m_Realm+"] where locX between @startX and @endX and locY between @startY and @endY"; | ||
128 | if (scopeID != UUID.Zero) | ||
129 | sql += " and ScopeID = @scopeID"; | ||
130 | |||
131 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
132 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
133 | { | ||
134 | cmd.Parameters.Add(m_database.CreateParameter("@startX", startX)); | ||
135 | cmd.Parameters.Add(m_database.CreateParameter("@startY", startY)); | ||
136 | cmd.Parameters.Add(m_database.CreateParameter("@endX", endX)); | ||
137 | cmd.Parameters.Add(m_database.CreateParameter("@endY", endY)); | ||
138 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
139 | conn.Open(); | ||
140 | return RunCommand(cmd); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | public List<RegionData> RunCommand(SqlCommand cmd) | ||
145 | { | ||
146 | List<RegionData> retList = new List<RegionData>(); | ||
147 | |||
148 | SqlDataReader result = cmd.ExecuteReader(); | ||
149 | |||
150 | while (result.Read()) | ||
151 | { | ||
152 | RegionData ret = new RegionData(); | ||
153 | ret.Data = new Dictionary<string, object>(); | ||
154 | |||
155 | UUID regionID; | ||
156 | UUID.TryParse(result["uuid"].ToString(), out regionID); | ||
157 | ret.RegionID = regionID; | ||
158 | UUID scope; | ||
159 | UUID.TryParse(result["ScopeID"].ToString(), out scope); | ||
160 | ret.ScopeID = scope; | ||
161 | ret.RegionName = result["regionName"].ToString(); | ||
162 | ret.posX = Convert.ToInt32(result["locX"]); | ||
163 | ret.posY = Convert.ToInt32(result["locY"]); | ||
164 | ret.sizeX = Convert.ToInt32(result["sizeX"]); | ||
165 | ret.sizeY = Convert.ToInt32(result["sizeY"]); | ||
166 | |||
167 | if (m_ColumnNames == null) | ||
168 | { | ||
169 | m_ColumnNames = new List<string>(); | ||
170 | |||
171 | DataTable schemaTable = result.GetSchemaTable(); | ||
172 | foreach (DataRow row in schemaTable.Rows) | ||
173 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
174 | } | ||
175 | |||
176 | foreach (string s in m_ColumnNames) | ||
177 | { | ||
178 | if (s == "uuid") | ||
179 | continue; | ||
180 | if (s == "ScopeID") | ||
181 | continue; | ||
182 | if (s == "regionName") | ||
183 | continue; | ||
184 | if (s == "locX") | ||
185 | continue; | ||
186 | if (s == "locY") | ||
187 | continue; | ||
188 | |||
189 | ret.Data[s] = result[s].ToString(); | ||
190 | } | ||
191 | |||
192 | retList.Add(ret); | ||
193 | } | ||
194 | return retList; | ||
195 | } | ||
196 | |||
197 | public bool Store(RegionData data) | ||
198 | { | ||
199 | if (data.Data.ContainsKey("uuid")) | ||
200 | data.Data.Remove("uuid"); | ||
201 | if (data.Data.ContainsKey("ScopeID")) | ||
202 | data.Data.Remove("ScopeID"); | ||
203 | if (data.Data.ContainsKey("regionName")) | ||
204 | data.Data.Remove("regionName"); | ||
205 | if (data.Data.ContainsKey("posX")) | ||
206 | data.Data.Remove("posX"); | ||
207 | if (data.Data.ContainsKey("posY")) | ||
208 | data.Data.Remove("posY"); | ||
209 | if (data.Data.ContainsKey("sizeX")) | ||
210 | data.Data.Remove("sizeX"); | ||
211 | if (data.Data.ContainsKey("sizeY")) | ||
212 | data.Data.Remove("sizeY"); | ||
213 | if (data.Data.ContainsKey("locX")) | ||
214 | data.Data.Remove("locX"); | ||
215 | if (data.Data.ContainsKey("locY")) | ||
216 | data.Data.Remove("locY"); | ||
217 | |||
218 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
219 | |||
220 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
221 | using (SqlCommand cmd = new SqlCommand()) | ||
222 | { | ||
223 | |||
224 | string update = "update [" + m_Realm + "] set locX=@posX, locY=@posY, sizeX=@sizeX, sizeY=@sizeY "; | ||
225 | |||
226 | foreach (string field in fields) | ||
227 | { | ||
228 | |||
229 | update += ", "; | ||
230 | update += "[" + field + "] = @" + field; | ||
231 | |||
232 | cmd.Parameters.Add(m_database.CreateParameter("@" + field, data.Data[field])); | ||
233 | } | ||
234 | |||
235 | update += " where uuid = @regionID"; | ||
236 | |||
237 | if (data.ScopeID != UUID.Zero) | ||
238 | update += " and ScopeID = @scopeID"; | ||
239 | |||
240 | cmd.CommandText = update; | ||
241 | cmd.Connection = conn; | ||
242 | cmd.Parameters.Add(m_database.CreateParameter("@regionID", data.RegionID)); | ||
243 | cmd.Parameters.Add(m_database.CreateParameter("@regionName", data.RegionName)); | ||
244 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", data.ScopeID)); | ||
245 | cmd.Parameters.Add(m_database.CreateParameter("@posX", data.posX)); | ||
246 | cmd.Parameters.Add(m_database.CreateParameter("@posY", data.posY)); | ||
247 | cmd.Parameters.Add(m_database.CreateParameter("@sizeX", data.sizeX)); | ||
248 | cmd.Parameters.Add(m_database.CreateParameter("@sizeY", data.sizeY)); | ||
249 | conn.Open(); | ||
250 | try | ||
251 | { | ||
252 | if (cmd.ExecuteNonQuery() < 1) | ||
253 | { | ||
254 | string insert = "insert into [" + m_Realm + "] ([uuid], [ScopeID], [locX], [locY], [sizeX], [sizeY], [regionName], [" + | ||
255 | String.Join("], [", fields) + | ||
256 | "]) values (@regionID, @scopeID, @posX, @posY, @sizeX, @sizeY, @regionName, @" + String.Join(", @", fields) + ")"; | ||
257 | |||
258 | cmd.CommandText = insert; | ||
259 | |||
260 | try | ||
261 | { | ||
262 | if (cmd.ExecuteNonQuery() < 1) | ||
263 | { | ||
264 | return false; | ||
265 | } | ||
266 | } | ||
267 | catch (Exception ex) | ||
268 | { | ||
269 | m_log.Warn("[MSSQL Grid]: Error inserting into Regions table: " + ex.Message + ", INSERT sql: " + insert); | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | catch (Exception ex) | ||
274 | { | ||
275 | m_log.Warn("[MSSQL Grid]: Error updating Regions table: " + ex.Message + ", UPDATE sql: " + update); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | return true; | ||
280 | } | ||
281 | |||
282 | public bool SetDataItem(UUID regionID, string item, string value) | ||
283 | { | ||
284 | string sql = "update [" + m_Realm + | ||
285 | "] set [" + item + "] = @" + item + " where uuid = @UUID"; | ||
286 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
287 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
288 | { | ||
289 | cmd.Parameters.Add(m_database.CreateParameter("@" + item, value)); | ||
290 | cmd.Parameters.Add(m_database.CreateParameter("@UUID", regionID)); | ||
291 | conn.Open(); | ||
292 | if (cmd.ExecuteNonQuery() > 0) | ||
293 | return true; | ||
294 | } | ||
295 | return false; | ||
296 | } | ||
297 | |||
298 | public bool Delete(UUID regionID) | ||
299 | { | ||
300 | string sql = "delete from [" + m_Realm + | ||
301 | "] where uuid = @UUID"; | ||
302 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
303 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
304 | { | ||
305 | cmd.Parameters.Add(m_database.CreateParameter("@UUID", regionID)); | ||
306 | conn.Open(); | ||
307 | if (cmd.ExecuteNonQuery() > 0) | ||
308 | return true; | ||
309 | } | ||
310 | return false; | ||
311 | } | ||
312 | |||
313 | public List<RegionData> GetDefaultRegions(UUID scopeID) | ||
314 | { | ||
315 | return Get((int)RegionFlags.DefaultRegion, scopeID); | ||
316 | } | ||
317 | |||
318 | public List<RegionData> GetDefaultHypergridRegions(UUID scopeID) | ||
319 | { | ||
320 | return Get((int)RegionFlags.DefaultHGRegion, scopeID); | ||
321 | } | ||
322 | |||
323 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) | ||
324 | { | ||
325 | List<RegionData> regions = Get((int)RegionFlags.FallbackRegion, scopeID); | ||
326 | RegionDataDistanceCompare distanceComparer = new RegionDataDistanceCompare(x, y); | ||
327 | regions.Sort(distanceComparer); | ||
328 | |||
329 | return regions; | ||
330 | } | ||
331 | |||
332 | public List<RegionData> GetHyperlinks(UUID scopeID) | ||
333 | { | ||
334 | return Get((int)RegionFlags.Hyperlink, scopeID); | ||
335 | } | ||
336 | |||
337 | private List<RegionData> Get(int regionFlags, UUID scopeID) | ||
338 | { | ||
339 | string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0"; | ||
340 | if (scopeID != UUID.Zero) | ||
341 | sql += " AND ScopeID = @scopeID"; | ||
342 | |||
343 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
344 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
345 | { | ||
346 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
347 | conn.Open(); | ||
348 | return RunCommand(cmd); | ||
349 | } | ||
350 | } | ||
351 | } | ||
352 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs deleted file mode 100644 index 1a5ecd6..0000000 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ /dev/null | |||
@@ -1,2242 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Data.SqlClient; | ||
32 | using System.Drawing; | ||
33 | using System.IO; | ||
34 | using System.Reflection; | ||
35 | using log4net; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | |||
41 | namespace OpenSim.Data.MSSQL | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// A MSSQL Interface for the Region Server. | ||
45 | /// </summary> | ||
46 | public class MSSQLSimulationData : ISimulationDataStore | ||
47 | { | ||
48 | private const string _migrationStore = "RegionStore"; | ||
49 | |||
50 | // private static FileSystemDataStore Instance = new FileSystemDataStore(); | ||
51 | private static readonly ILog _Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | private static string LogHeader = "[REGION DB MSSQL]"; | ||
53 | |||
54 | /// <summary> | ||
55 | /// The database manager | ||
56 | /// </summary> | ||
57 | private MSSQLManager _Database; | ||
58 | private string m_connectionString; | ||
59 | protected virtual Assembly Assembly | ||
60 | { | ||
61 | get { return GetType().Assembly; } | ||
62 | } | ||
63 | |||
64 | public MSSQLSimulationData() | ||
65 | { | ||
66 | } | ||
67 | |||
68 | public MSSQLSimulationData(string connectionString) | ||
69 | { | ||
70 | Initialise(connectionString); | ||
71 | } | ||
72 | |||
73 | /// <summary> | ||
74 | /// Initialises the region datastore | ||
75 | /// </summary> | ||
76 | /// <param name="connectionString">The connection string.</param> | ||
77 | public void Initialise(string connectionString) | ||
78 | { | ||
79 | m_connectionString = connectionString; | ||
80 | _Database = new MSSQLManager(connectionString); | ||
81 | |||
82 | using (SqlConnection conn = new SqlConnection(connectionString)) | ||
83 | { | ||
84 | conn.Open(); | ||
85 | //New Migration settings | ||
86 | Migration m = new Migration(conn, Assembly, "RegionStore"); | ||
87 | m.Update(); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// Dispose the database | ||
93 | /// </summary> | ||
94 | public void Dispose() { } | ||
95 | |||
96 | #region SceneObjectGroup region for loading and Store of the scene. | ||
97 | |||
98 | /// <summary> | ||
99 | /// Loads the objects present in the region. | ||
100 | /// </summary> | ||
101 | /// <param name="regionUUID">The region UUID.</param> | ||
102 | /// <returns></returns> | ||
103 | public List<SceneObjectGroup> LoadObjects(UUID regionUUID) | ||
104 | { | ||
105 | UUID lastGroupID = UUID.Zero; | ||
106 | |||
107 | Dictionary<UUID, SceneObjectPart> prims = new Dictionary<UUID, SceneObjectPart>(); | ||
108 | Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); | ||
109 | SceneObjectGroup grp = null; | ||
110 | |||
111 | string sql = "SELECT *, " + | ||
112 | "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + | ||
113 | "FROM prims " + | ||
114 | "LEFT JOIN primshapes ON prims.UUID = primshapes.UUID " + | ||
115 | "WHERE RegionUUID = @RegionUUID " + | ||
116 | "ORDER BY SceneGroupID asc, sort asc, LinkNumber asc"; | ||
117 | |||
118 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
119 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
120 | { | ||
121 | command.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); | ||
122 | conn.Open(); | ||
123 | using (SqlDataReader reader = command.ExecuteReader()) | ||
124 | { | ||
125 | while (reader.Read()) | ||
126 | { | ||
127 | SceneObjectPart sceneObjectPart = BuildPrim(reader); | ||
128 | if (reader["Shape"] is DBNull) | ||
129 | sceneObjectPart.Shape = PrimitiveBaseShape.Default; | ||
130 | else | ||
131 | sceneObjectPart.Shape = BuildShape(reader); | ||
132 | |||
133 | prims[sceneObjectPart.UUID] = sceneObjectPart; | ||
134 | |||
135 | UUID groupID = new UUID((Guid)reader["SceneGroupID"]); | ||
136 | |||
137 | if (groupID != lastGroupID) // New SOG | ||
138 | { | ||
139 | if (grp != null) | ||
140 | objects[grp.UUID] = grp; | ||
141 | |||
142 | lastGroupID = groupID; | ||
143 | |||
144 | // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are | ||
145 | // recorded as the root prim (for which the UUID must equal the persisted group UUID). In | ||
146 | // this case, force the UUID to be the same as the group UUID so that at least these can be | ||
147 | // deleted (we need to change the UUID so that any other prims in the linkset can also be | ||
148 | // deleted). | ||
149 | if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) | ||
150 | { | ||
151 | _Log.WarnFormat( | ||
152 | "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID", | ||
153 | sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID); | ||
154 | |||
155 | sceneObjectPart.UUID = groupID; | ||
156 | } | ||
157 | |||
158 | grp = new SceneObjectGroup(sceneObjectPart); | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | // Black magic to preserve link numbers | ||
163 | // Why is this needed, fix this in AddPart method. | ||
164 | int link = sceneObjectPart.LinkNum; | ||
165 | |||
166 | grp.AddPart(sceneObjectPart); | ||
167 | |||
168 | if (link != 0) | ||
169 | sceneObjectPart.LinkNum = link; | ||
170 | } | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | |||
175 | if (grp != null) | ||
176 | objects[grp.UUID] = grp; | ||
177 | |||
178 | // Instead of attempting to LoadItems on every prim, | ||
179 | // most of which probably have no items... get a | ||
180 | // list from DB of all prims which have items and | ||
181 | // LoadItems only on those | ||
182 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); | ||
183 | string qry = "select distinct primID from primitems"; | ||
184 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
185 | using (SqlCommand command = new SqlCommand(qry, conn)) | ||
186 | { | ||
187 | conn.Open(); | ||
188 | using (SqlDataReader itemReader = command.ExecuteReader()) | ||
189 | { | ||
190 | while (itemReader.Read()) | ||
191 | { | ||
192 | if (!(itemReader["primID"] is DBNull)) | ||
193 | { | ||
194 | UUID primID = new UUID(itemReader["primID"].ToString()); | ||
195 | if (prims.ContainsKey(primID)) | ||
196 | { | ||
197 | primsWithInventory.Add(prims[primID]); | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | |||
204 | LoadItems(primsWithInventory); | ||
205 | |||
206 | _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); | ||
207 | |||
208 | return new List<SceneObjectGroup>(objects.Values); | ||
209 | } | ||
210 | |||
211 | /// <summary> | ||
212 | /// Load in the prim's persisted inventory. | ||
213 | /// </summary> | ||
214 | /// <param name="allPrims">all prims with inventory on a region</param> | ||
215 | private void LoadItems(List<SceneObjectPart> allPrimsWithInventory) | ||
216 | { | ||
217 | string sql = "SELECT * FROM primitems WHERE PrimID = @PrimID"; | ||
218 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
219 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
220 | { | ||
221 | conn.Open(); | ||
222 | foreach (SceneObjectPart objectPart in allPrimsWithInventory) | ||
223 | { | ||
224 | command.Parameters.Clear(); | ||
225 | command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); | ||
226 | |||
227 | List<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | ||
228 | |||
229 | using (SqlDataReader reader = command.ExecuteReader()) | ||
230 | { | ||
231 | while (reader.Read()) | ||
232 | { | ||
233 | TaskInventoryItem item = BuildItem(reader); | ||
234 | |||
235 | item.ParentID = objectPart.UUID; // Values in database are | ||
236 | // often wrong | ||
237 | inventory.Add(item); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | objectPart.Inventory.RestoreInventoryItems(inventory); | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | |||
246 | /// <summary> | ||
247 | /// Stores all object's details apart from inventory | ||
248 | /// </summary> | ||
249 | /// <param name="obj"></param> | ||
250 | /// <param name="regionUUID"></param> | ||
251 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | ||
252 | { | ||
253 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | ||
254 | // Eligibility check | ||
255 | // | ||
256 | if ((flags & (uint)PrimFlags.Temporary) != 0) | ||
257 | return; | ||
258 | if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) | ||
259 | return; | ||
260 | |||
261 | _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Parts.Length); | ||
262 | |||
263 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
264 | { | ||
265 | conn.Open(); | ||
266 | SqlTransaction transaction = conn.BeginTransaction(); | ||
267 | |||
268 | try | ||
269 | { | ||
270 | foreach (SceneObjectPart sceneObjectPart in obj.Parts) | ||
271 | { | ||
272 | //Update prim | ||
273 | using (SqlCommand sqlCommand = conn.CreateCommand()) | ||
274 | { | ||
275 | sqlCommand.Transaction = transaction; | ||
276 | try | ||
277 | { | ||
278 | StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
279 | } | ||
280 | catch (SqlException sqlEx) | ||
281 | { | ||
282 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
283 | throw; | ||
284 | } | ||
285 | } | ||
286 | |||
287 | //Update primshapes | ||
288 | using (SqlCommand sqlCommand = conn.CreateCommand()) | ||
289 | { | ||
290 | sqlCommand.Transaction = transaction; | ||
291 | try | ||
292 | { | ||
293 | StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
294 | } | ||
295 | catch (SqlException sqlEx) | ||
296 | { | ||
297 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
298 | throw; | ||
299 | } | ||
300 | } | ||
301 | } | ||
302 | |||
303 | transaction.Commit(); | ||
304 | } | ||
305 | catch (Exception ex) | ||
306 | { | ||
307 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message); | ||
308 | try | ||
309 | { | ||
310 | transaction.Rollback(); | ||
311 | } | ||
312 | catch (Exception ex2) | ||
313 | { | ||
314 | //Show error | ||
315 | _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message); | ||
316 | |||
317 | } | ||
318 | } | ||
319 | } | ||
320 | } | ||
321 | |||
322 | /// <summary> | ||
323 | /// Stores the prim of the sceneobjectpart. | ||
324 | /// </summary> | ||
325 | /// <param name="sceneObjectPart">The sceneobjectpart or prim.</param> | ||
326 | /// <param name="sqlCommand">The SQL command with the transaction.</param> | ||
327 | /// <param name="sceneGroupID">The scenegroup UUID.</param> | ||
328 | /// <param name="regionUUID">The region UUID.</param> | ||
329 | private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) | ||
330 | { | ||
331 | //Big query to update or insert a new prim. | ||
332 | //Note for SQL Server 2008 this could be simplified | ||
333 | string queryPrims = @" | ||
334 | IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID) | ||
335 | BEGIN | ||
336 | UPDATE prims SET | ||
337 | CreationDate = @CreationDate, Name = @Name, Text = @Text, Description = @Description, SitName = @SitName, | ||
338 | TouchName = @TouchName, ObjectFlags = @ObjectFlags, OwnerMask = @OwnerMask, NextOwnerMask = @NextOwnerMask, GroupMask = @GroupMask, | ||
339 | EveryoneMask = @EveryoneMask, BaseMask = @BaseMask, PositionX = @PositionX, PositionY = @PositionY, PositionZ = @PositionZ, | ||
340 | GroupPositionX = @GroupPositionX, GroupPositionY = @GroupPositionY, GroupPositionZ = @GroupPositionZ, VelocityX = @VelocityX, | ||
341 | VelocityY = @VelocityY, VelocityZ = @VelocityZ, AngularVelocityX = @AngularVelocityX, AngularVelocityY = @AngularVelocityY, | ||
342 | AngularVelocityZ = @AngularVelocityZ, AccelerationX = @AccelerationX, AccelerationY = @AccelerationY, | ||
343 | AccelerationZ = @AccelerationZ, RotationX = @RotationX, RotationY = @RotationY, RotationZ = @RotationZ, RotationW = @RotationW, | ||
344 | SitTargetOffsetX = @SitTargetOffsetX, SitTargetOffsetY = @SitTargetOffsetY, SitTargetOffsetZ = @SitTargetOffsetZ, | ||
345 | SitTargetOrientW = @SitTargetOrientW, SitTargetOrientX = @SitTargetOrientX, SitTargetOrientY = @SitTargetOrientY, | ||
346 | SitTargetOrientZ = @SitTargetOrientZ, RegionUUID = @RegionUUID, CreatorID = @CreatorID, OwnerID = @OwnerID, GroupID = @GroupID, | ||
347 | LastOwnerID = @LastOwnerID, SceneGroupID = @SceneGroupID, PayPrice = @PayPrice, PayButton1 = @PayButton1, PayButton2 = @PayButton2, | ||
348 | PayButton3 = @PayButton3, PayButton4 = @PayButton4, LoopedSound = @LoopedSound, LoopedSoundGain = @LoopedSoundGain, | ||
349 | TextureAnimation = @TextureAnimation, OmegaX = @OmegaX, OmegaY = @OmegaY, OmegaZ = @OmegaZ, CameraEyeOffsetX = @CameraEyeOffsetX, | ||
350 | CameraEyeOffsetY = @CameraEyeOffsetY, CameraEyeOffsetZ = @CameraEyeOffsetZ, CameraAtOffsetX = @CameraAtOffsetX, | ||
351 | CameraAtOffsetY = @CameraAtOffsetY, CameraAtOffsetZ = @CameraAtOffsetZ, ForceMouselook = @ForceMouselook, | ||
352 | ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice, | ||
353 | SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem, | ||
354 | ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches, | ||
355 | LinkNumber = @LinkNumber, MediaURL = @MediaURL, AttachedPosX = @AttachedPosX, AttachedPosY = @AttachedPosY, AttachedPosZ = @AttachedPosZ, DynAttrs = @DynAttrs, | ||
356 | PhysicsShapeType = @PhysicsShapeType, Density = @Density, GravityModifier = @GravityModifier, Friction = @Friction, Restitution = @Restitution | ||
357 | WHERE UUID = @UUID | ||
358 | END | ||
359 | ELSE | ||
360 | BEGIN | ||
361 | INSERT INTO | ||
362 | prims ( | ||
363 | UUID, CreationDate, Name, Text, Description, SitName, TouchName, ObjectFlags, OwnerMask, NextOwnerMask, GroupMask, | ||
364 | EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, | ||
365 | VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, | ||
366 | RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, | ||
367 | SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, RegionUUID, CreatorID, OwnerID, GroupID, LastOwnerID, SceneGroupID, | ||
368 | PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, | ||
369 | OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, | ||
370 | ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, | ||
371 | ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL, AttachedPosX, AttachedPosY, AttachedPosZ, DynAttrs, | ||
372 | PhysicsShapeType, Density, GravityModifier, Friction, Restitution | ||
373 | ) VALUES ( | ||
374 | @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask, | ||
375 | @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX, | ||
376 | @VelocityY, @VelocityZ, @AngularVelocityX, @AngularVelocityY, @AngularVelocityZ, @AccelerationX, @AccelerationY, @AccelerationZ, | ||
377 | @RotationX, @RotationY, @RotationZ, @RotationW, @SitTargetOffsetX, @SitTargetOffsetY, @SitTargetOffsetZ, @SitTargetOrientW, | ||
378 | @SitTargetOrientX, @SitTargetOrientY, @SitTargetOrientZ, @RegionUUID, @CreatorID, @OwnerID, @GroupID, @LastOwnerID, @SceneGroupID, | ||
379 | @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX, | ||
380 | @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ, | ||
381 | @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA, | ||
382 | @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL, @AttachedPosX, @AttachedPosY, @AttachedPosZ, @DynAttrs, | ||
383 | @PhysicsShapeType, @Density, @GravityModifier, @Friction, @Restitution | ||
384 | ) | ||
385 | END"; | ||
386 | |||
387 | //Set commandtext. | ||
388 | sqlCommand.CommandText = queryPrims; | ||
389 | //Add parameters | ||
390 | sqlCommand.Parameters.AddRange(CreatePrimParameters(sceneObjectPart, sceneGroupID, regionUUID)); | ||
391 | |||
392 | //Execute the query. If it fails then error is trapped in calling function | ||
393 | sqlCommand.ExecuteNonQuery(); | ||
394 | } | ||
395 | |||
396 | /// <summary> | ||
397 | /// Stores the scene object prim shapes. | ||
398 | /// </summary> | ||
399 | /// <param name="sceneObjectPart">The sceneobjectpart containing prim shape.</param> | ||
400 | /// <param name="sqlCommand">The SQL command with the transaction.</param> | ||
401 | /// <param name="sceneGroupID">The scenegroup UUID.</param> | ||
402 | /// <param name="regionUUID">The region UUID.</param> | ||
403 | private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) | ||
404 | { | ||
405 | //Big query to or insert or update primshapes | ||
406 | //Note for SQL Server 2008 this can be simplified | ||
407 | string queryPrimShapes = @" | ||
408 | IF EXISTS (SELECT UUID FROM primshapes WHERE UUID = @UUID) | ||
409 | BEGIN | ||
410 | UPDATE primshapes SET | ||
411 | Shape = @Shape, ScaleX = @ScaleX, ScaleY = @ScaleY, ScaleZ = @ScaleZ, PCode = @PCode, PathBegin = @PathBegin, | ||
412 | PathEnd = @PathEnd, PathScaleX = @PathScaleX, PathScaleY = @PathScaleY, PathShearX = @PathShearX, PathShearY = @PathShearY, | ||
413 | PathSkew = @PathSkew, PathCurve = @PathCurve, PathRadiusOffset = @PathRadiusOffset, PathRevolutions = @PathRevolutions, | ||
414 | PathTaperX = @PathTaperX, PathTaperY = @PathTaperY, PathTwist = @PathTwist, PathTwistBegin = @PathTwistBegin, | ||
415 | ProfileBegin = @ProfileBegin, ProfileEnd = @ProfileEnd, ProfileCurve = @ProfileCurve, ProfileHollow = @ProfileHollow, | ||
416 | Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media | ||
417 | WHERE UUID = @UUID | ||
418 | END | ||
419 | ELSE | ||
420 | BEGIN | ||
421 | INSERT INTO | ||
422 | primshapes ( | ||
423 | UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, | ||
424 | PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, | ||
425 | ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media | ||
426 | ) VALUES ( | ||
427 | @UUID, @Shape, @ScaleX, @ScaleY, @ScaleZ, @PCode, @PathBegin, @PathEnd, @PathScaleX, @PathScaleY, @PathShearX, @PathShearY, | ||
428 | @PathSkew, @PathCurve, @PathRadiusOffset, @PathRevolutions, @PathTaperX, @PathTaperY, @PathTwist, @PathTwistBegin, @ProfileBegin, | ||
429 | @ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media | ||
430 | ) | ||
431 | END"; | ||
432 | |||
433 | //Set commandtext. | ||
434 | sqlCommand.CommandText = queryPrimShapes; | ||
435 | |||
436 | //Add parameters | ||
437 | sqlCommand.Parameters.AddRange(CreatePrimShapeParameters(sceneObjectPart, sceneGroupID, regionUUID)); | ||
438 | |||
439 | //Execute the query. If it fails then error is trapped in calling function | ||
440 | sqlCommand.ExecuteNonQuery(); | ||
441 | |||
442 | } | ||
443 | |||
444 | /// <summary> | ||
445 | /// Removes a object from the database. | ||
446 | /// Meaning removing it from tables Prims, PrimShapes and PrimItems | ||
447 | /// </summary> | ||
448 | /// <param name="objectID">id of scenegroup</param> | ||
449 | /// <param name="regionUUID">regionUUID (is this used anyway</param> | ||
450 | public void RemoveObject(UUID objectID, UUID regionUUID) | ||
451 | { | ||
452 | _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID); | ||
453 | |||
454 | //Remove from prims and primsitem table | ||
455 | string sqlPrims = "DELETE FROM PRIMS WHERE SceneGroupID = @objectID"; | ||
456 | string sqlPrimItems = "DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; | ||
457 | string sqlPrimShapes = "DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; | ||
458 | |||
459 | lock (_Database) | ||
460 | { | ||
461 | //Using the non transaction mode. | ||
462 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
463 | using (SqlCommand cmd = new SqlCommand()) | ||
464 | { | ||
465 | cmd.Connection = conn; | ||
466 | cmd.CommandText = sqlPrimShapes; | ||
467 | conn.Open(); | ||
468 | cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID)); | ||
469 | cmd.ExecuteNonQuery(); | ||
470 | |||
471 | cmd.CommandText = sqlPrimItems; | ||
472 | cmd.ExecuteNonQuery(); | ||
473 | |||
474 | cmd.CommandText = sqlPrims; | ||
475 | cmd.ExecuteNonQuery(); | ||
476 | } | ||
477 | } | ||
478 | } | ||
479 | |||
480 | /// <summary> | ||
481 | /// Store the inventory of a prim. Warning deletes everything first and then adds all again. | ||
482 | /// </summary> | ||
483 | /// <param name="primID"></param> | ||
484 | /// <param name="items"></param> | ||
485 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | ||
486 | { | ||
487 | //_Log.InfoFormat("[REGION DB: Persisting Prim Inventory with prim ID {0}", primID); | ||
488 | |||
489 | //Statement from MySQL section! | ||
490 | // For now, we're just going to crudely remove all the previous inventory items | ||
491 | // no matter whether they have changed or not, and replace them with the current set. | ||
492 | |||
493 | //Delete everything from PrimID | ||
494 | //TODO add index on PrimID in DB, if not already exist | ||
495 | |||
496 | string sql = "DELETE PRIMITEMS WHERE primID = @primID"; | ||
497 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
498 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
499 | { | ||
500 | cmd.Parameters.Add(_Database.CreateParameter("@primID", primID)); | ||
501 | conn.Open(); | ||
502 | cmd.ExecuteNonQuery(); | ||
503 | } | ||
504 | |||
505 | sql = | ||
506 | @"INSERT INTO primitems ( | ||
507 | itemID,primID,assetID,parentFolderID,invType,assetType,name,description,creationDate,creatorID,ownerID,lastOwnerID,groupID, | ||
508 | nextPermissions,currentPermissions,basePermissions,everyonePermissions,groupPermissions,flags) | ||
509 | VALUES (@itemID,@primID,@assetID,@parentFolderID,@invType,@assetType,@name,@description,@creationDate,@creatorID,@ownerID, | ||
510 | @lastOwnerID,@groupID,@nextPermissions,@currentPermissions,@basePermissions,@everyonePermissions,@groupPermissions,@flags)"; | ||
511 | |||
512 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
513 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
514 | { | ||
515 | conn.Open(); | ||
516 | foreach (TaskInventoryItem taskItem in items) | ||
517 | { | ||
518 | cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem)); | ||
519 | cmd.ExecuteNonQuery(); | ||
520 | cmd.Parameters.Clear(); | ||
521 | } | ||
522 | } | ||
523 | } | ||
524 | |||
525 | #endregion | ||
526 | |||
527 | /// <summary> | ||
528 | /// Loads the terrain map. | ||
529 | /// </summary> | ||
530 | /// <param name="regionID">regionID.</param> | ||
531 | /// <returns></returns> | ||
532 | public double[,] LoadTerrain(UUID regionID) | ||
533 | { | ||
534 | double[,] ret = null; | ||
535 | TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); | ||
536 | if (terrData != null) | ||
537 | ret = terrData.GetDoubles(); | ||
538 | return ret; | ||
539 | } | ||
540 | |||
541 | // Returns 'null' if region not found | ||
542 | public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
543 | { | ||
544 | TerrainData terrData = null; | ||
545 | |||
546 | string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; | ||
547 | |||
548 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
549 | { | ||
550 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
551 | { | ||
552 | // MySqlParameter param = new MySqlParameter(); | ||
553 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); | ||
554 | conn.Open(); | ||
555 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
556 | { | ||
557 | int rev; | ||
558 | if (reader.Read()) | ||
559 | { | ||
560 | rev = (int)reader["Revision"]; | ||
561 | byte[] blob = (byte[])reader["Heightfield"]; | ||
562 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
563 | } | ||
564 | else | ||
565 | { | ||
566 | _Log.Info("[REGION DB]: No terrain found for region"); | ||
567 | return null; | ||
568 | } | ||
569 | _Log.Info("[REGION DB]: Loaded terrain revision r" + rev); | ||
570 | } | ||
571 | } | ||
572 | } | ||
573 | |||
574 | return terrData; | ||
575 | } | ||
576 | |||
577 | // Legacy entry point for when terrain was always a 256x256 hieghtmap | ||
578 | public void StoreTerrain(double[,] ter, UUID regionID) | ||
579 | { | ||
580 | StoreTerrain(new HeightmapTerrainData(ter), regionID); | ||
581 | } | ||
582 | |||
583 | /// <summary> | ||
584 | /// Stores the terrain map to DB. | ||
585 | /// </summary> | ||
586 | /// <param name="terrain">terrain map data.</param> | ||
587 | /// <param name="regionID">regionID.</param> | ||
588 | public void StoreTerrain(TerrainData terrData, UUID regionID) | ||
589 | { | ||
590 | //Delete old terrain map | ||
591 | string sql = "delete from terrain where RegionUUID=@RegionUUID"; | ||
592 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
593 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
594 | { | ||
595 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); | ||
596 | conn.Open(); | ||
597 | cmd.ExecuteNonQuery(); | ||
598 | } | ||
599 | |||
600 | sql = "insert into terrain(RegionUUID, Revision, Heightfield) values(@RegionUUID, @Revision, @Heightfield)"; | ||
601 | |||
602 | int terrainDBRevision; | ||
603 | Array terrainDBblob; | ||
604 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
605 | |||
606 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
607 | { | ||
608 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
609 | { | ||
610 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); | ||
611 | cmd.Parameters.Add(_Database.CreateParameter("@Revision", terrainDBRevision)); | ||
612 | cmd.Parameters.Add(_Database.CreateParameter("@Heightfield", terrainDBblob)); | ||
613 | conn.Open(); | ||
614 | cmd.ExecuteNonQuery(); | ||
615 | } | ||
616 | } | ||
617 | |||
618 | _Log.InfoFormat("{0} Stored terrain revision r={1}", LogHeader, terrainDBRevision); | ||
619 | } | ||
620 | |||
621 | /// <summary> | ||
622 | /// Loads all the land objects of a region. | ||
623 | /// </summary> | ||
624 | /// <param name="regionUUID">The region UUID.</param> | ||
625 | /// <returns></returns> | ||
626 | public List<LandData> LoadLandObjects(UUID regionUUID) | ||
627 | { | ||
628 | List<LandData> LandDataForRegion = new List<LandData>(); | ||
629 | |||
630 | string sql = "select * from land where RegionUUID = @RegionUUID"; | ||
631 | |||
632 | //Retrieve all land data from region | ||
633 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
634 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
635 | { | ||
636 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionUUID)); | ||
637 | conn.Open(); | ||
638 | using (SqlDataReader readerLandData = cmd.ExecuteReader()) | ||
639 | { | ||
640 | while (readerLandData.Read()) | ||
641 | { | ||
642 | LandDataForRegion.Add(BuildLandData(readerLandData)); | ||
643 | } | ||
644 | } | ||
645 | } | ||
646 | |||
647 | //Retrieve all accesslist data for all landdata | ||
648 | foreach (LandData LandData in LandDataForRegion) | ||
649 | { | ||
650 | sql = "select * from landaccesslist where LandUUID = @LandUUID"; | ||
651 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
652 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
653 | { | ||
654 | cmd.Parameters.Add(_Database.CreateParameter("@LandUUID", LandData.GlobalID)); | ||
655 | conn.Open(); | ||
656 | using (SqlDataReader readerAccessList = cmd.ExecuteReader()) | ||
657 | { | ||
658 | while (readerAccessList.Read()) | ||
659 | { | ||
660 | LandData.ParcelAccessList.Add(BuildLandAccessData(readerAccessList)); | ||
661 | } | ||
662 | } | ||
663 | } | ||
664 | } | ||
665 | |||
666 | //Return data | ||
667 | return LandDataForRegion; | ||
668 | } | ||
669 | |||
670 | /// <summary> | ||
671 | /// Stores land object with landaccess list. | ||
672 | /// </summary> | ||
673 | /// <param name="parcel">parcel data.</param> | ||
674 | public void StoreLandObject(ILandObject parcel) | ||
675 | { | ||
676 | //As this is only one record in land table I just delete all and then add a new record. | ||
677 | //As the delete landaccess is already in the mysql code | ||
678 | |||
679 | //Delete old values | ||
680 | RemoveLandObject(parcel.LandData.GlobalID); | ||
681 | |||
682 | //Insert new values | ||
683 | string sql = @"INSERT INTO [land] | ||
684 | ([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime]) | ||
685 | VALUES | ||
686 | (@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)"; | ||
687 | |||
688 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
689 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
690 | { | ||
691 | cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID)); | ||
692 | conn.Open(); | ||
693 | cmd.ExecuteNonQuery(); | ||
694 | } | ||
695 | |||
696 | sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)"; | ||
697 | |||
698 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
699 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
700 | { | ||
701 | conn.Open(); | ||
702 | foreach (LandAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) | ||
703 | { | ||
704 | cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID)); | ||
705 | |||
706 | cmd.ExecuteNonQuery(); | ||
707 | cmd.Parameters.Clear(); | ||
708 | } | ||
709 | } | ||
710 | } | ||
711 | |||
712 | /// <summary> | ||
713 | /// Removes a land object from DB. | ||
714 | /// </summary> | ||
715 | /// <param name="globalID">UUID of landobject</param> | ||
716 | public void RemoveLandObject(UUID globalID) | ||
717 | { | ||
718 | string sql = "delete from land where UUID=@UUID"; | ||
719 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
720 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
721 | { | ||
722 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); | ||
723 | conn.Open(); | ||
724 | cmd.ExecuteNonQuery(); | ||
725 | } | ||
726 | sql = "delete from landaccesslist where LandUUID=@UUID"; | ||
727 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
728 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
729 | { | ||
730 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); | ||
731 | conn.Open(); | ||
732 | cmd.ExecuteNonQuery(); | ||
733 | } | ||
734 | } | ||
735 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | ||
736 | { | ||
737 | RegionLightShareData nWP = new RegionLightShareData(); | ||
738 | nWP.OnSave += StoreRegionWindlightSettings; | ||
739 | string sql = "select * from [regionwindlight] where region_id = @regionID"; | ||
740 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
741 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
742 | { | ||
743 | cmd.Parameters.Add(_Database.CreateParameter("@regionID", regionUUID)); | ||
744 | conn.Open(); | ||
745 | using (SqlDataReader result = cmd.ExecuteReader()) | ||
746 | { | ||
747 | if (!result.Read()) | ||
748 | { | ||
749 | //No result, so store our default windlight profile and return it | ||
750 | nWP.regionID = regionUUID; | ||
751 | StoreRegionWindlightSettings(nWP); | ||
752 | return nWP; | ||
753 | } | ||
754 | else | ||
755 | { | ||
756 | nWP.regionID = DBGuid.FromDB(result["region_id"]); | ||
757 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | ||
758 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | ||
759 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | ||
760 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | ||
761 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | ||
762 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | ||
763 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | ||
764 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | ||
765 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | ||
766 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | ||
767 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | ||
768 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | ||
769 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | ||
770 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | ||
771 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | ||
772 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | ||
773 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | ||
774 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | ||
775 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | ||
776 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | ||
777 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | ||
778 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | ||
779 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | ||
780 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | ||
781 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | ||
782 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | ||
783 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | ||
784 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | ||
785 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | ||
786 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | ||
787 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | ||
788 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | ||
789 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | ||
790 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | ||
791 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | ||
792 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | ||
793 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | ||
794 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | ||
795 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | ||
796 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | ||
797 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | ||
798 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | ||
799 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | ||
800 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | ||
801 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | ||
802 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | ||
803 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | ||
804 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | ||
805 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | ||
806 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | ||
807 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | ||
808 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | ||
809 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | ||
810 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | ||
811 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | ||
812 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | ||
813 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | ||
814 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | ||
815 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | ||
816 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | ||
817 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | ||
818 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | ||
819 | nWP.valid = true; | ||
820 | } | ||
821 | } | ||
822 | } | ||
823 | return nWP; | ||
824 | } | ||
825 | |||
826 | public void RemoveRegionWindlightSettings(UUID regionID) | ||
827 | { | ||
828 | string sql = "delete from [regionwindlight] where region_id = @region_id"; | ||
829 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
830 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
831 | { | ||
832 | conn.Open(); | ||
833 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionID)); | ||
834 | cmd.ExecuteNonQuery(); | ||
835 | } | ||
836 | } | ||
837 | |||
838 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | ||
839 | { | ||
840 | string sql = "select count (region_id) from regionwindlight where region_id = @region_id"; | ||
841 | bool exists = false; | ||
842 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
843 | { | ||
844 | conn.Open(); | ||
845 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
846 | { | ||
847 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", wl.regionID)); | ||
848 | exists = (int)cmd.ExecuteScalar() > 0; | ||
849 | } | ||
850 | } | ||
851 | if (exists) | ||
852 | { | ||
853 | RemoveRegionWindlightSettings(wl.regionID); | ||
854 | } | ||
855 | |||
856 | // sql insert | ||
857 | sql = @"INSERT INTO [regionwindlight] | ||
858 | ([region_id] | ||
859 | ,[water_color_r] | ||
860 | ,[water_color_g] | ||
861 | ,[water_color_b] | ||
862 | ,[water_fog_density_exponent] | ||
863 | ,[underwater_fog_modifier] | ||
864 | ,[reflection_wavelet_scale_1] | ||
865 | ,[reflection_wavelet_scale_2] | ||
866 | ,[reflection_wavelet_scale_3] | ||
867 | ,[fresnel_scale] | ||
868 | ,[fresnel_offset] | ||
869 | ,[refract_scale_above] | ||
870 | ,[refract_scale_below] | ||
871 | ,[blur_multiplier] | ||
872 | ,[big_wave_direction_x] | ||
873 | ,[big_wave_direction_y] | ||
874 | ,[little_wave_direction_x] | ||
875 | ,[little_wave_direction_y] | ||
876 | ,[normal_map_texture] | ||
877 | ,[horizon_r] | ||
878 | ,[horizon_g] | ||
879 | ,[horizon_b] | ||
880 | ,[horizon_i] | ||
881 | ,[haze_horizon] | ||
882 | ,[blue_density_r] | ||
883 | ,[blue_density_g] | ||
884 | ,[blue_density_b] | ||
885 | ,[blue_density_i] | ||
886 | ,[haze_density] | ||
887 | ,[density_multiplier] | ||
888 | ,[distance_multiplier] | ||
889 | ,[max_altitude] | ||
890 | ,[sun_moon_color_r] | ||
891 | ,[sun_moon_color_g] | ||
892 | ,[sun_moon_color_b] | ||
893 | ,[sun_moon_color_i] | ||
894 | ,[sun_moon_position] | ||
895 | ,[ambient_r] | ||
896 | ,[ambient_g] | ||
897 | ,[ambient_b] | ||
898 | ,[ambient_i] | ||
899 | ,[east_angle] | ||
900 | ,[sun_glow_focus] | ||
901 | ,[sun_glow_size] | ||
902 | ,[scene_gamma] | ||
903 | ,[star_brightness] | ||
904 | ,[cloud_color_r] | ||
905 | ,[cloud_color_g] | ||
906 | ,[cloud_color_b] | ||
907 | ,[cloud_color_i] | ||
908 | ,[cloud_x] | ||
909 | ,[cloud_y] | ||
910 | ,[cloud_density] | ||
911 | ,[cloud_coverage] | ||
912 | ,[cloud_scale] | ||
913 | ,[cloud_detail_x] | ||
914 | ,[cloud_detail_y] | ||
915 | ,[cloud_detail_density] | ||
916 | ,[cloud_scroll_x] | ||
917 | ,[cloud_scroll_x_lock] | ||
918 | ,[cloud_scroll_y] | ||
919 | ,[cloud_scroll_y_lock] | ||
920 | ,[draw_classic_clouds]) | ||
921 | VALUES | ||
922 | (@region_id | ||
923 | ,@water_color_r | ||
924 | ,@water_color_g | ||
925 | ,@water_color_b | ||
926 | ,@water_fog_density_exponent | ||
927 | ,@underwater_fog_modifier | ||
928 | ,@reflection_wavelet_scale_1 | ||
929 | ,@reflection_wavelet_scale_2 | ||
930 | ,@reflection_wavelet_scale_3 | ||
931 | ,@fresnel_scale | ||
932 | ,@fresnel_offset | ||
933 | ,@refract_scale_above | ||
934 | ,@refract_scale_below | ||
935 | ,@blur_multiplier | ||
936 | ,@big_wave_direction_x | ||
937 | ,@big_wave_direction_y | ||
938 | ,@little_wave_direction_x | ||
939 | ,@little_wave_direction_y | ||
940 | ,@normal_map_texture | ||
941 | ,@horizon_r | ||
942 | ,@horizon_g | ||
943 | ,@horizon_b | ||
944 | ,@horizon_i | ||
945 | ,@haze_horizon | ||
946 | ,@blue_density_r | ||
947 | ,@blue_density_g | ||
948 | ,@blue_density_b | ||
949 | ,@blue_density_i | ||
950 | ,@haze_density | ||
951 | ,@density_multiplier | ||
952 | ,@distance_multiplier | ||
953 | ,@max_altitude | ||
954 | ,@sun_moon_color_r | ||
955 | ,@sun_moon_color_g | ||
956 | ,@sun_moon_color_b | ||
957 | ,@sun_moon_color_i | ||
958 | ,@sun_moon_position | ||
959 | ,@ambient_r | ||
960 | ,@ambient_g | ||
961 | ,@ambient_b | ||
962 | ,@ambient_i | ||
963 | ,@east_angle | ||
964 | ,@sun_glow_focus | ||
965 | ,@sun_glow_size | ||
966 | ,@scene_gamma | ||
967 | ,@star_brightness | ||
968 | ,@cloud_color_r | ||
969 | ,@cloud_color_g | ||
970 | ,@cloud_color_b | ||
971 | ,@cloud_color_i | ||
972 | ,@cloud_x | ||
973 | ,@cloud_y | ||
974 | ,@cloud_density | ||
975 | ,@cloud_coverage | ||
976 | ,@cloud_scale | ||
977 | ,@cloud_detail_x | ||
978 | ,@cloud_detail_y | ||
979 | ,@cloud_detail_density | ||
980 | ,@cloud_scroll_x | ||
981 | ,@cloud_scroll_x_lock | ||
982 | ,@cloud_scroll_y | ||
983 | ,@cloud_scroll_y_lock | ||
984 | ,@draw_classic_clouds)"; | ||
985 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
986 | { | ||
987 | conn.Open(); | ||
988 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
989 | { | ||
990 | cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID)); | ||
991 | cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X)); | ||
992 | cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y)); | ||
993 | cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z)); | ||
994 | cmd.Parameters.Add(_Database.CreateParameter("water_fog_density_exponent", wl.waterFogDensityExponent)); | ||
995 | cmd.Parameters.Add(_Database.CreateParameter("underwater_fog_modifier", wl.underwaterFogModifier)); | ||
996 | cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X)); | ||
997 | cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y)); | ||
998 | cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z)); | ||
999 | cmd.Parameters.Add(_Database.CreateParameter("fresnel_scale", wl.fresnelScale)); | ||
1000 | cmd.Parameters.Add(_Database.CreateParameter("fresnel_offset", wl.fresnelOffset)); | ||
1001 | cmd.Parameters.Add(_Database.CreateParameter("refract_scale_above", wl.refractScaleAbove)); | ||
1002 | cmd.Parameters.Add(_Database.CreateParameter("refract_scale_below", wl.refractScaleBelow)); | ||
1003 | cmd.Parameters.Add(_Database.CreateParameter("blur_multiplier", wl.blurMultiplier)); | ||
1004 | cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_x", wl.bigWaveDirection.X)); | ||
1005 | cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y)); | ||
1006 | cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X)); | ||
1007 | cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y)); | ||
1008 | cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture)); | ||
1009 | cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X)); | ||
1010 | cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y)); | ||
1011 | cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z)); | ||
1012 | cmd.Parameters.Add(_Database.CreateParameter("horizon_i", wl.horizon.W)); | ||
1013 | cmd.Parameters.Add(_Database.CreateParameter("haze_horizon", wl.hazeHorizon)); | ||
1014 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_r", wl.blueDensity.X)); | ||
1015 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_g", wl.blueDensity.Y)); | ||
1016 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_b", wl.blueDensity.Z)); | ||
1017 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_i", wl.blueDensity.W)); | ||
1018 | cmd.Parameters.Add(_Database.CreateParameter("haze_density", wl.hazeDensity)); | ||
1019 | cmd.Parameters.Add(_Database.CreateParameter("density_multiplier", wl.densityMultiplier)); | ||
1020 | cmd.Parameters.Add(_Database.CreateParameter("distance_multiplier", wl.distanceMultiplier)); | ||
1021 | cmd.Parameters.Add(_Database.CreateParameter("max_altitude", wl.maxAltitude)); | ||
1022 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_r", wl.sunMoonColor.X)); | ||
1023 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_g", wl.sunMoonColor.Y)); | ||
1024 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_b", wl.sunMoonColor.Z)); | ||
1025 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_i", wl.sunMoonColor.W)); | ||
1026 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_position", wl.sunMoonPosition)); | ||
1027 | cmd.Parameters.Add(_Database.CreateParameter("ambient_r", wl.ambient.X)); | ||
1028 | cmd.Parameters.Add(_Database.CreateParameter("ambient_g", wl.ambient.Y)); | ||
1029 | cmd.Parameters.Add(_Database.CreateParameter("ambient_b", wl.ambient.Z)); | ||
1030 | cmd.Parameters.Add(_Database.CreateParameter("ambient_i", wl.ambient.W)); | ||
1031 | cmd.Parameters.Add(_Database.CreateParameter("east_angle", wl.eastAngle)); | ||
1032 | cmd.Parameters.Add(_Database.CreateParameter("sun_glow_focus", wl.sunGlowFocus)); | ||
1033 | cmd.Parameters.Add(_Database.CreateParameter("sun_glow_size", wl.sunGlowSize)); | ||
1034 | cmd.Parameters.Add(_Database.CreateParameter("scene_gamma", wl.sceneGamma)); | ||
1035 | cmd.Parameters.Add(_Database.CreateParameter("star_brightness", wl.starBrightness)); | ||
1036 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_r", wl.cloudColor.X)); | ||
1037 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_g", wl.cloudColor.Y)); | ||
1038 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_b", wl.cloudColor.Z)); | ||
1039 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_i", wl.cloudColor.W)); | ||
1040 | cmd.Parameters.Add(_Database.CreateParameter("cloud_x", wl.cloudXYDensity.X)); | ||
1041 | cmd.Parameters.Add(_Database.CreateParameter("cloud_y", wl.cloudXYDensity.Y)); | ||
1042 | cmd.Parameters.Add(_Database.CreateParameter("cloud_density", wl.cloudXYDensity.Z)); | ||
1043 | cmd.Parameters.Add(_Database.CreateParameter("cloud_coverage", wl.cloudCoverage)); | ||
1044 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scale", wl.cloudScale)); | ||
1045 | cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_x", wl.cloudDetailXYDensity.X)); | ||
1046 | cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_y", wl.cloudDetailXYDensity.Y)); | ||
1047 | cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_density", wl.cloudDetailXYDensity.Z)); | ||
1048 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x", wl.cloudScrollX)); | ||
1049 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x_lock", wl.cloudScrollXLock)); | ||
1050 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y", wl.cloudScrollY)); | ||
1051 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y_lock", wl.cloudScrollYLock)); | ||
1052 | cmd.Parameters.Add(_Database.CreateParameter("draw_classic_clouds", wl.drawClassicClouds)); | ||
1053 | |||
1054 | cmd.ExecuteNonQuery(); | ||
1055 | } | ||
1056 | } | ||
1057 | #region update | ||
1058 | // } | ||
1059 | // else | ||
1060 | // { | ||
1061 | // // sql update | ||
1062 | // sql = @"UPDATE [OpenSim].[dbo].[regionwindlight] | ||
1063 | // SET [region_id] = @region_id | ||
1064 | // ,[water_color_r] = @water_color_r | ||
1065 | // ,[water_color_g] = @water_color_g | ||
1066 | // ,[water_color_b] = @water_color_b | ||
1067 | // ,[water_fog_density_exponent] = @water_fog_density_exponent | ||
1068 | // ,[underwater_fog_modifier] = @underwater_fog_modifier | ||
1069 | // ,[reflection_wavelet_scale_1] = @reflection_wavelet_scale_1 | ||
1070 | // ,[reflection_wavelet_scale_2] = @reflection_wavelet_scale_2 | ||
1071 | // ,[reflection_wavelet_scale_3] = @reflection_wavelet_scale_3 | ||
1072 | // ,[fresnel_scale] = @fresnel_scale | ||
1073 | // ,[fresnel_offset] = @fresnel_offset | ||
1074 | // ,[refract_scale_above] = @refract_scale_above | ||
1075 | // ,[refract_scale_below] = @refract_scale_below | ||
1076 | // ,[blur_multiplier] = @blur_multiplier | ||
1077 | // ,[big_wave_direction_x] = @big_wave_direction_x | ||
1078 | // ,[big_wave_direction_y] = @big_wave_direction_y | ||
1079 | // ,[little_wave_direction_x] = @little_wave_direction_x | ||
1080 | // ,[little_wave_direction_y] = @little_wave_direction_y | ||
1081 | // ,[normal_map_texture] = @normal_map_texture | ||
1082 | // ,[horizon_r] = @horizon_r | ||
1083 | // ,[horizon_g] = @horizon_g | ||
1084 | // ,[horizon_b] = @horizon_b | ||
1085 | // ,[horizon_i] = @horizon_i | ||
1086 | // ,[haze_horizon] = @haze_horizon | ||
1087 | // ,[blue_density_r] = @blue_density_r | ||
1088 | // ,[blue_density_g] = @blue_density_g | ||
1089 | // ,[blue_density_b] = @blue_density_b | ||
1090 | // ,[blue_density_i] = @blue_density_i | ||
1091 | // ,[haze_density] = @haze_density | ||
1092 | // ,[density_multiplier] = @density_multiplier | ||
1093 | // ,[distance_multiplier] = @distance_multiplier | ||
1094 | // ,[max_altitude] = @max_altitude | ||
1095 | // ,[sun_moon_color_r] = @sun_moon_color_r | ||
1096 | // ,[sun_moon_color_g] = @sun_moon_color_g | ||
1097 | // ,[sun_moon_color_b] = @sun_moon_color_b | ||
1098 | // ,[sun_moon_color_i] = @sun_moon_color_i | ||
1099 | // ,[sun_moon_position] = @sun_moon_position | ||
1100 | // ,[ambient_r] = @ambient_r | ||
1101 | // ,[ambient_g] = @ambient_g | ||
1102 | // ,[ambient_b] = @ambient_b | ||
1103 | // ,[ambient_i] = @ambient_i | ||
1104 | // ,[east_angle] = @east_angle | ||
1105 | // ,[sun_glow_focus] = @sun_glow_focus | ||
1106 | // ,[sun_glow_size] = @sun_glow_size | ||
1107 | // ,[scene_gamma] = @scene_gamma | ||
1108 | // ,[star_brightness] = @star_brightness | ||
1109 | // ,[cloud_color_r] = @cloud_color_r | ||
1110 | // ,[cloud_color_g] = @cloud_color_g | ||
1111 | // ,[cloud_color_b] = @cloud_color_b | ||
1112 | // ,[cloud_color_i] = @cloud_color_i | ||
1113 | // ,[cloud_x] = @cloud_x | ||
1114 | // ,[cloud_y] = @cloud_y | ||
1115 | // ,[cloud_density] = @cloud_density | ||
1116 | // ,[cloud_coverage] = @cloud_coverage | ||
1117 | // ,[cloud_scale] = @cloud_scale | ||
1118 | // ,[cloud_detail_x] = @cloud_detail_x | ||
1119 | // ,[cloud_detail_y] = @cloud_detail_y | ||
1120 | // ,[cloud_detail_density] = @cloud_detail_density | ||
1121 | // ,[cloud_scroll_x] = @cloud_scroll_x | ||
1122 | // ,[cloud_scroll_x_lock] = @cloud_scroll_x_lock | ||
1123 | // ,[cloud_scroll_y] = @cloud_scroll_y | ||
1124 | // ,[cloud_scroll_y_lock] = @cloud_scroll_y_lock | ||
1125 | // ,[draw_classic_clouds] = @draw_classic_clouds | ||
1126 | // WHERE region_id = @region_id"; | ||
1127 | // using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1128 | // { | ||
1129 | // conn.Open(); | ||
1130 | // using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1131 | // { | ||
1132 | // cmd.Parameters.AddWithValue("region_id", wl.regionID); | ||
1133 | // cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | ||
1134 | // cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); | ||
1135 | // cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); | ||
1136 | // cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); | ||
1137 | // cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); | ||
1138 | // cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); | ||
1139 | // cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); | ||
1140 | // cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); | ||
1141 | // cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); | ||
1142 | // cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); | ||
1143 | // cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); | ||
1144 | // cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); | ||
1145 | // cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); | ||
1146 | // cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); | ||
1147 | // cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); | ||
1148 | // cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); | ||
1149 | // cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); | ||
1150 | // cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); | ||
1151 | // cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); | ||
1152 | // cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); | ||
1153 | // cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); | ||
1154 | // cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); | ||
1155 | // cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); | ||
1156 | // cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); | ||
1157 | // cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); | ||
1158 | // cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); | ||
1159 | // cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); | ||
1160 | // cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); | ||
1161 | // cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); | ||
1162 | // cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); | ||
1163 | // cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); | ||
1164 | // cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); | ||
1165 | // cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); | ||
1166 | // cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); | ||
1167 | // cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); | ||
1168 | // cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); | ||
1169 | // cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); | ||
1170 | // cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); | ||
1171 | // cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); | ||
1172 | // cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); | ||
1173 | // cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); | ||
1174 | // cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); | ||
1175 | // cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); | ||
1176 | // cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); | ||
1177 | // cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); | ||
1178 | // cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); | ||
1179 | // cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); | ||
1180 | // cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); | ||
1181 | // cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); | ||
1182 | // cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); | ||
1183 | // cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); | ||
1184 | // cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); | ||
1185 | // cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); | ||
1186 | // cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); | ||
1187 | // cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); | ||
1188 | // cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); | ||
1189 | // cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); | ||
1190 | // cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); | ||
1191 | // cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); | ||
1192 | // cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); | ||
1193 | // cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); | ||
1194 | // cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); | ||
1195 | |||
1196 | // cmd.ExecuteNonQuery(); | ||
1197 | // } | ||
1198 | // } | ||
1199 | // } | ||
1200 | #endregion | ||
1201 | } | ||
1202 | |||
1203 | #region Environment Settings | ||
1204 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
1205 | { | ||
1206 | string sql = "select * from [regionenvironment] where region_id = @region_id"; | ||
1207 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1208 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1209 | { | ||
1210 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1211 | conn.Open(); | ||
1212 | using (SqlDataReader result = cmd.ExecuteReader()) | ||
1213 | { | ||
1214 | if (!result.Read()) | ||
1215 | { | ||
1216 | return String.Empty; | ||
1217 | } | ||
1218 | else | ||
1219 | { | ||
1220 | return Convert.ToString(result["llsd_settings"]); | ||
1221 | } | ||
1222 | } | ||
1223 | } | ||
1224 | } | ||
1225 | |||
1226 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
1227 | { | ||
1228 | { | ||
1229 | string sql = "DELETE FROM [regionenvironment] WHERE region_id = @region_id"; | ||
1230 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1231 | |||
1232 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1233 | { | ||
1234 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1235 | conn.Open(); | ||
1236 | cmd.ExecuteNonQuery(); | ||
1237 | } | ||
1238 | |||
1239 | sql = "INSERT INTO [regionenvironment] (region_id, llsd_settings) VALUES (@region_id, @llsd_settings)"; | ||
1240 | |||
1241 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1242 | |||
1243 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1244 | { | ||
1245 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1246 | cmd.Parameters.Add(_Database.CreateParameter("@llsd_settings", settings)); | ||
1247 | |||
1248 | conn.Open(); | ||
1249 | cmd.ExecuteNonQuery(); | ||
1250 | } | ||
1251 | } | ||
1252 | } | ||
1253 | |||
1254 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
1255 | { | ||
1256 | string sql = "delete from [regionenvironment] where region_id = @region_id"; | ||
1257 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1258 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1259 | { | ||
1260 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1261 | |||
1262 | conn.Open(); | ||
1263 | cmd.ExecuteNonQuery(); | ||
1264 | } | ||
1265 | } | ||
1266 | #endregion | ||
1267 | |||
1268 | /// <summary> | ||
1269 | /// Loads the settings of a region. | ||
1270 | /// </summary> | ||
1271 | /// <param name="regionUUID">The region UUID.</param> | ||
1272 | /// <returns></returns> | ||
1273 | public RegionSettings LoadRegionSettings(UUID regionUUID) | ||
1274 | { | ||
1275 | string sql = "select * from regionsettings where regionUUID = @regionUUID"; | ||
1276 | RegionSettings regionSettings; | ||
1277 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1278 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1279 | { | ||
1280 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); | ||
1281 | conn.Open(); | ||
1282 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
1283 | { | ||
1284 | if (reader.Read()) | ||
1285 | { | ||
1286 | regionSettings = BuildRegionSettings(reader); | ||
1287 | regionSettings.OnSave += StoreRegionSettings; | ||
1288 | |||
1289 | return regionSettings; | ||
1290 | } | ||
1291 | } | ||
1292 | } | ||
1293 | |||
1294 | //If we reach this point then there are new region settings for that region | ||
1295 | regionSettings = new RegionSettings(); | ||
1296 | regionSettings.RegionUUID = regionUUID; | ||
1297 | regionSettings.OnSave += StoreRegionSettings; | ||
1298 | |||
1299 | //Store new values | ||
1300 | StoreNewRegionSettings(regionSettings); | ||
1301 | |||
1302 | LoadSpawnPoints(regionSettings); | ||
1303 | |||
1304 | return regionSettings; | ||
1305 | } | ||
1306 | |||
1307 | /// <summary> | ||
1308 | /// Store region settings, need to check if the check is really necesary. If we can make something for creating new region. | ||
1309 | /// </summary> | ||
1310 | /// <param name="regionSettings">region settings.</param> | ||
1311 | public void StoreRegionSettings(RegionSettings regionSettings) | ||
1312 | { | ||
1313 | //Little check if regionUUID already exist in DB | ||
1314 | string regionUUID; | ||
1315 | string sql = "SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID"; | ||
1316 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1317 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1318 | { | ||
1319 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); | ||
1320 | conn.Open(); | ||
1321 | regionUUID = cmd.ExecuteScalar().ToString(); | ||
1322 | } | ||
1323 | |||
1324 | if (string.IsNullOrEmpty(regionUUID)) | ||
1325 | { | ||
1326 | StoreNewRegionSettings(regionSettings); | ||
1327 | } | ||
1328 | else | ||
1329 | { | ||
1330 | //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB | ||
1331 | sql = | ||
1332 | @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage | ||
1333 | ,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide | ||
1334 | ,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity | ||
1335 | ,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics | ||
1336 | ,[terrain_texture_1] = @terrain_texture_1 ,[terrain_texture_2] = @terrain_texture_2 ,[terrain_texture_3] = @terrain_texture_3 | ||
1337 | ,[terrain_texture_4] = @terrain_texture_4 ,[elevation_1_nw] = @elevation_1_nw ,[elevation_2_nw] = @elevation_2_nw | ||
1338 | ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se | ||
1339 | ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit | ||
1340 | ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position | ||
1341 | ,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID | ||
1342 | WHERE [regionUUID] = @regionUUID"; | ||
1343 | |||
1344 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1345 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1346 | { | ||
1347 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); | ||
1348 | conn.Open(); | ||
1349 | cmd.ExecuteNonQuery(); | ||
1350 | } | ||
1351 | } | ||
1352 | SaveSpawnPoints(regionSettings); | ||
1353 | } | ||
1354 | |||
1355 | public void Shutdown() | ||
1356 | { | ||
1357 | //Not used?? | ||
1358 | } | ||
1359 | |||
1360 | #region Private Methods | ||
1361 | |||
1362 | /// <summary> | ||
1363 | /// Stores new regionsettings. | ||
1364 | /// </summary> | ||
1365 | /// <param name="regionSettings">The region settings.</param> | ||
1366 | private void StoreNewRegionSettings(RegionSettings regionSettings) | ||
1367 | { | ||
1368 | string sql = @"INSERT INTO [regionsettings] | ||
1369 | ([regionUUID],[block_terraform],[block_fly],[allow_damage],[restrict_pushing],[allow_land_resell],[allow_land_join_divide], | ||
1370 | [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics], | ||
1371 | [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne], | ||
1372 | [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit], | ||
1373 | [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[covenant_datetime],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id] | ||
1374 | ) | ||
1375 | VALUES | ||
1376 | (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide, | ||
1377 | @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics, | ||
1378 | @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne, | ||
1379 | @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, | ||
1380 | @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant, @covenant_datetime, @sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; | ||
1381 | |||
1382 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1383 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1384 | { | ||
1385 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); | ||
1386 | conn.Open(); | ||
1387 | cmd.ExecuteNonQuery(); | ||
1388 | } | ||
1389 | } | ||
1390 | |||
1391 | #region Private DataRecord conversion methods | ||
1392 | |||
1393 | /// <summary> | ||
1394 | /// Builds the region settings from a datarecod. | ||
1395 | /// </summary> | ||
1396 | /// <param name="row">datarecord with regionsettings.</param> | ||
1397 | /// <returns></returns> | ||
1398 | private static RegionSettings BuildRegionSettings(IDataRecord row) | ||
1399 | { | ||
1400 | //TODO change this is some more generic code so we doesnt have to change it every time a new field is added? | ||
1401 | RegionSettings newSettings = new RegionSettings(); | ||
1402 | |||
1403 | newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]); | ||
1404 | newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); | ||
1405 | newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); | ||
1406 | newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); | ||
1407 | newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); | ||
1408 | newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); | ||
1409 | newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); | ||
1410 | newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); | ||
1411 | newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); | ||
1412 | newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); | ||
1413 | newSettings.Maturity = Convert.ToInt32(row["maturity"]); | ||
1414 | newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); | ||
1415 | newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); | ||
1416 | newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); | ||
1417 | newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]); | ||
1418 | newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]); | ||
1419 | newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]); | ||
1420 | newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]); | ||
1421 | newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); | ||
1422 | newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); | ||
1423 | newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); | ||
1424 | newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); | ||
1425 | newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); | ||
1426 | newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); | ||
1427 | newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); | ||
1428 | newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); | ||
1429 | newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); | ||
1430 | newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); | ||
1431 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); | ||
1432 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); | ||
1433 | newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]); | ||
1434 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); | ||
1435 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); | ||
1436 | newSettings.SunVector = new Vector3( | ||
1437 | Convert.ToSingle(row["sunvectorx"]), | ||
1438 | Convert.ToSingle(row["sunvectory"]), | ||
1439 | Convert.ToSingle(row["sunvectorz"]) | ||
1440 | ); | ||
1441 | newSettings.Covenant = new UUID((Guid)row["covenant"]); | ||
1442 | newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); | ||
1443 | newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); | ||
1444 | |||
1445 | if (row["loaded_creation_id"] is DBNull) | ||
1446 | newSettings.LoadedCreationID = ""; | ||
1447 | else | ||
1448 | newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; | ||
1449 | |||
1450 | newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]); | ||
1451 | newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]); | ||
1452 | newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]); | ||
1453 | |||
1454 | return newSettings; | ||
1455 | } | ||
1456 | |||
1457 | /// <summary> | ||
1458 | /// Builds the land data from a datarecord. | ||
1459 | /// </summary> | ||
1460 | /// <param name="row">datarecord with land data</param> | ||
1461 | /// <returns></returns> | ||
1462 | private static LandData BuildLandData(IDataRecord row) | ||
1463 | { | ||
1464 | LandData newData = new LandData(); | ||
1465 | |||
1466 | newData.GlobalID = new UUID((Guid)row["UUID"]); | ||
1467 | newData.LocalID = Convert.ToInt32(row["LocalLandID"]); | ||
1468 | |||
1469 | // Bitmap is a byte[512] | ||
1470 | newData.Bitmap = (Byte[])row["Bitmap"]; | ||
1471 | |||
1472 | newData.Name = (string)row["Name"]; | ||
1473 | newData.Description = (string)row["Description"]; | ||
1474 | newData.OwnerID = new UUID((Guid)row["OwnerUUID"]); | ||
1475 | newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); | ||
1476 | newData.Area = Convert.ToInt32(row["Area"]); | ||
1477 | newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented | ||
1478 | newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); | ||
1479 | //Enum libsecondlife.Parcel.ParcelCategory | ||
1480 | newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); | ||
1481 | newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); | ||
1482 | newData.GroupID = new UUID((Guid)row["GroupUUID"]); | ||
1483 | newData.SalePrice = Convert.ToInt32(row["SalePrice"]); | ||
1484 | newData.Status = (ParcelStatus)Convert.ToInt32(row["LandStatus"]); | ||
1485 | //Enum. libsecondlife.Parcel.ParcelStatus | ||
1486 | newData.Flags = Convert.ToUInt32(row["LandFlags"]); | ||
1487 | newData.LandingType = Convert.ToByte(row["LandingType"]); | ||
1488 | newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); | ||
1489 | newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]); | ||
1490 | newData.MediaURL = (string)row["MediaURL"]; | ||
1491 | newData.MusicURL = (string)row["MusicURL"]; | ||
1492 | newData.PassHours = Convert.ToSingle(row["PassHours"]); | ||
1493 | newData.PassPrice = Convert.ToInt32(row["PassPrice"]); | ||
1494 | |||
1495 | // UUID authedbuyer; | ||
1496 | // UUID snapshotID; | ||
1497 | // | ||
1498 | // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) | ||
1499 | // newData.AuthBuyerID = authedbuyer; | ||
1500 | // | ||
1501 | // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) | ||
1502 | // newData.SnapshotID = snapshotID; | ||
1503 | newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]); | ||
1504 | newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); | ||
1505 | |||
1506 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); | ||
1507 | |||
1508 | try | ||
1509 | { | ||
1510 | newData.UserLocation = | ||
1511 | new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), | ||
1512 | Convert.ToSingle(row["UserLocationZ"])); | ||
1513 | newData.UserLookAt = | ||
1514 | new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), | ||
1515 | Convert.ToSingle(row["UserLookAtZ"])); | ||
1516 | } | ||
1517 | catch (InvalidCastException) | ||
1518 | { | ||
1519 | newData.UserLocation = Vector3.Zero; | ||
1520 | newData.UserLookAt = Vector3.Zero; | ||
1521 | _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); | ||
1522 | } | ||
1523 | |||
1524 | newData.ParcelAccessList = new List<LandAccessEntry>(); | ||
1525 | newData.MediaDescription = (string)row["MediaDescription"]; | ||
1526 | newData.MediaType = (string)row["MediaType"]; | ||
1527 | newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]); | ||
1528 | newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]); | ||
1529 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); | ||
1530 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); | ||
1531 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); | ||
1532 | |||
1533 | return newData; | ||
1534 | } | ||
1535 | |||
1536 | /// <summary> | ||
1537 | /// Builds the landaccess data from a data record. | ||
1538 | /// </summary> | ||
1539 | /// <param name="row">datarecord with landaccess data</param> | ||
1540 | /// <returns></returns> | ||
1541 | private static LandAccessEntry BuildLandAccessData(IDataRecord row) | ||
1542 | { | ||
1543 | LandAccessEntry entry = new LandAccessEntry(); | ||
1544 | entry.AgentID = new UUID((Guid)row["AccessUUID"]); | ||
1545 | entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); | ||
1546 | entry.Expires = Convert.ToInt32(row["Expires"]); | ||
1547 | return entry; | ||
1548 | } | ||
1549 | |||
1550 | /// <summary> | ||
1551 | /// Builds the prim from a datarecord. | ||
1552 | /// </summary> | ||
1553 | /// <param name="primRow">datarecord</param> | ||
1554 | /// <returns></returns> | ||
1555 | private static SceneObjectPart BuildPrim(IDataRecord primRow) | ||
1556 | { | ||
1557 | SceneObjectPart prim = new SceneObjectPart(); | ||
1558 | |||
1559 | prim.UUID = new UUID((Guid)primRow["UUID"]); | ||
1560 | // explicit conversion of integers is required, which sort | ||
1561 | // of sucks. No idea if there is a shortcut here or not. | ||
1562 | prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]); | ||
1563 | prim.Name = (string)primRow["Name"]; | ||
1564 | // various text fields | ||
1565 | prim.Text = (string)primRow["Text"]; | ||
1566 | prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]), | ||
1567 | Convert.ToInt32(primRow["ColorR"]), | ||
1568 | Convert.ToInt32(primRow["ColorG"]), | ||
1569 | Convert.ToInt32(primRow["ColorB"])); | ||
1570 | prim.Description = (string)primRow["Description"]; | ||
1571 | prim.SitName = (string)primRow["SitName"]; | ||
1572 | prim.TouchName = (string)primRow["TouchName"]; | ||
1573 | // permissions | ||
1574 | prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); | ||
1575 | //prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); | ||
1576 | prim.CreatorIdentification = (string)primRow["CreatorID"]; | ||
1577 | prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); | ||
1578 | prim.GroupID = new UUID((Guid)primRow["GroupID"]); | ||
1579 | prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); | ||
1580 | prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]); | ||
1581 | prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]); | ||
1582 | prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]); | ||
1583 | prim.EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]); | ||
1584 | prim.BaseMask = Convert.ToUInt32(primRow["BaseMask"]); | ||
1585 | // vectors | ||
1586 | prim.OffsetPosition = new Vector3( | ||
1587 | Convert.ToSingle(primRow["PositionX"]), | ||
1588 | Convert.ToSingle(primRow["PositionY"]), | ||
1589 | Convert.ToSingle(primRow["PositionZ"])); | ||
1590 | |||
1591 | prim.GroupPosition = new Vector3( | ||
1592 | Convert.ToSingle(primRow["GroupPositionX"]), | ||
1593 | Convert.ToSingle(primRow["GroupPositionY"]), | ||
1594 | Convert.ToSingle(primRow["GroupPositionZ"])); | ||
1595 | |||
1596 | prim.Velocity = new Vector3( | ||
1597 | Convert.ToSingle(primRow["VelocityX"]), | ||
1598 | Convert.ToSingle(primRow["VelocityY"]), | ||
1599 | Convert.ToSingle(primRow["VelocityZ"])); | ||
1600 | |||
1601 | prim.AngularVelocity = new Vector3( | ||
1602 | Convert.ToSingle(primRow["AngularVelocityX"]), | ||
1603 | Convert.ToSingle(primRow["AngularVelocityY"]), | ||
1604 | Convert.ToSingle(primRow["AngularVelocityZ"])); | ||
1605 | |||
1606 | prim.Acceleration = new Vector3( | ||
1607 | Convert.ToSingle(primRow["AccelerationX"]), | ||
1608 | Convert.ToSingle(primRow["AccelerationY"]), | ||
1609 | Convert.ToSingle(primRow["AccelerationZ"])); | ||
1610 | |||
1611 | // quaternions | ||
1612 | prim.RotationOffset = new Quaternion( | ||
1613 | Convert.ToSingle(primRow["RotationX"]), | ||
1614 | Convert.ToSingle(primRow["RotationY"]), | ||
1615 | Convert.ToSingle(primRow["RotationZ"]), | ||
1616 | Convert.ToSingle(primRow["RotationW"])); | ||
1617 | |||
1618 | prim.SitTargetPositionLL = new Vector3( | ||
1619 | Convert.ToSingle(primRow["SitTargetOffsetX"]), | ||
1620 | Convert.ToSingle(primRow["SitTargetOffsetY"]), | ||
1621 | Convert.ToSingle(primRow["SitTargetOffsetZ"])); | ||
1622 | |||
1623 | prim.SitTargetOrientationLL = new Quaternion( | ||
1624 | Convert.ToSingle(primRow["SitTargetOrientX"]), | ||
1625 | Convert.ToSingle(primRow["SitTargetOrientY"]), | ||
1626 | Convert.ToSingle(primRow["SitTargetOrientZ"]), | ||
1627 | Convert.ToSingle(primRow["SitTargetOrientW"])); | ||
1628 | |||
1629 | prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]); | ||
1630 | prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]); | ||
1631 | prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]); | ||
1632 | prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]); | ||
1633 | prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]); | ||
1634 | |||
1635 | prim.Sound = new UUID((Guid)primRow["LoopedSound"]); | ||
1636 | prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]); | ||
1637 | prim.SoundFlags = 1; // If it's persisted at all, it's looped | ||
1638 | |||
1639 | if (!(primRow["TextureAnimation"] is DBNull)) | ||
1640 | prim.TextureAnimation = (Byte[])primRow["TextureAnimation"]; | ||
1641 | if (!(primRow["ParticleSystem"] is DBNull)) | ||
1642 | prim.ParticleSystem = (Byte[])primRow["ParticleSystem"]; | ||
1643 | |||
1644 | prim.AngularVelocity = new Vector3( | ||
1645 | Convert.ToSingle(primRow["OmegaX"]), | ||
1646 | Convert.ToSingle(primRow["OmegaY"]), | ||
1647 | Convert.ToSingle(primRow["OmegaZ"])); | ||
1648 | |||
1649 | prim.SetCameraEyeOffset(new Vector3( | ||
1650 | Convert.ToSingle(primRow["CameraEyeOffsetX"]), | ||
1651 | Convert.ToSingle(primRow["CameraEyeOffsetY"]), | ||
1652 | Convert.ToSingle(primRow["CameraEyeOffsetZ"]) | ||
1653 | )); | ||
1654 | |||
1655 | prim.SetCameraAtOffset(new Vector3( | ||
1656 | Convert.ToSingle(primRow["CameraAtOffsetX"]), | ||
1657 | Convert.ToSingle(primRow["CameraAtOffsetY"]), | ||
1658 | Convert.ToSingle(primRow["CameraAtOffsetZ"]) | ||
1659 | )); | ||
1660 | |||
1661 | if (Convert.ToInt16(primRow["ForceMouselook"]) != 0) | ||
1662 | prim.SetForceMouselook(true); | ||
1663 | |||
1664 | prim.ScriptAccessPin = Convert.ToInt32(primRow["ScriptAccessPin"]); | ||
1665 | |||
1666 | if (Convert.ToInt16(primRow["AllowedDrop"]) != 0) | ||
1667 | prim.AllowedDrop = true; | ||
1668 | |||
1669 | if (Convert.ToInt16(primRow["DieAtEdge"]) != 0) | ||
1670 | prim.DIE_AT_EDGE = true; | ||
1671 | |||
1672 | prim.SalePrice = Convert.ToInt32(primRow["SalePrice"]); | ||
1673 | prim.ObjectSaleType = Convert.ToByte(primRow["SaleType"]); | ||
1674 | |||
1675 | prim.Material = Convert.ToByte(primRow["Material"]); | ||
1676 | |||
1677 | if (!(primRow["ClickAction"] is DBNull)) | ||
1678 | prim.ClickAction = Convert.ToByte(primRow["ClickAction"]); | ||
1679 | |||
1680 | prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]); | ||
1681 | prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); | ||
1682 | if (Convert.ToInt16(primRow["PassTouches"]) != 0) | ||
1683 | prim.PassTouches = true; | ||
1684 | prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); | ||
1685 | |||
1686 | if (!(primRow["MediaURL"] is System.DBNull)) | ||
1687 | prim.MediaUrl = (string)primRow["MediaURL"]; | ||
1688 | |||
1689 | if (!(primRow["AttachedPosX"] is System.DBNull)) | ||
1690 | prim.AttachedPos = new Vector3( | ||
1691 | Convert.ToSingle(primRow["AttachedPosX"]), | ||
1692 | Convert.ToSingle(primRow["AttachedPosY"]), | ||
1693 | Convert.ToSingle(primRow["AttachedPosZ"])); | ||
1694 | |||
1695 | if (!(primRow["DynAttrs"] is System.DBNull)) | ||
1696 | prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]); | ||
1697 | else | ||
1698 | prim.DynAttrs = new DAMap(); | ||
1699 | |||
1700 | prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]); | ||
1701 | prim.Density = Convert.ToSingle(primRow["Density"]); | ||
1702 | prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]); | ||
1703 | prim.Friction = Convert.ToSingle(primRow["Friction"]); | ||
1704 | prim.Restitution = Convert.ToSingle(primRow["Restitution"]); | ||
1705 | |||
1706 | return prim; | ||
1707 | } | ||
1708 | |||
1709 | /// <summary> | ||
1710 | /// Builds the prim shape from a datarecord. | ||
1711 | /// </summary> | ||
1712 | /// <param name="shapeRow">The row.</param> | ||
1713 | /// <returns></returns> | ||
1714 | private static PrimitiveBaseShape BuildShape(IDataRecord shapeRow) | ||
1715 | { | ||
1716 | PrimitiveBaseShape baseShape = new PrimitiveBaseShape(); | ||
1717 | |||
1718 | baseShape.Scale = new Vector3( | ||
1719 | (float)Convert.ToDouble(shapeRow["ScaleX"]), | ||
1720 | (float)Convert.ToDouble(shapeRow["ScaleY"]), | ||
1721 | (float)Convert.ToDouble(shapeRow["ScaleZ"])); | ||
1722 | |||
1723 | // paths | ||
1724 | baseShape.PCode = Convert.ToByte(shapeRow["PCode"]); | ||
1725 | baseShape.PathBegin = Convert.ToUInt16(shapeRow["PathBegin"]); | ||
1726 | baseShape.PathEnd = Convert.ToUInt16(shapeRow["PathEnd"]); | ||
1727 | baseShape.PathScaleX = Convert.ToByte(shapeRow["PathScaleX"]); | ||
1728 | baseShape.PathScaleY = Convert.ToByte(shapeRow["PathScaleY"]); | ||
1729 | baseShape.PathShearX = Convert.ToByte(shapeRow["PathShearX"]); | ||
1730 | baseShape.PathShearY = Convert.ToByte(shapeRow["PathShearY"]); | ||
1731 | baseShape.PathSkew = Convert.ToSByte(shapeRow["PathSkew"]); | ||
1732 | baseShape.PathCurve = Convert.ToByte(shapeRow["PathCurve"]); | ||
1733 | baseShape.PathRadiusOffset = Convert.ToSByte(shapeRow["PathRadiusOffset"]); | ||
1734 | baseShape.PathRevolutions = Convert.ToByte(shapeRow["PathRevolutions"]); | ||
1735 | baseShape.PathTaperX = Convert.ToSByte(shapeRow["PathTaperX"]); | ||
1736 | baseShape.PathTaperY = Convert.ToSByte(shapeRow["PathTaperY"]); | ||
1737 | baseShape.PathTwist = Convert.ToSByte(shapeRow["PathTwist"]); | ||
1738 | baseShape.PathTwistBegin = Convert.ToSByte(shapeRow["PathTwistBegin"]); | ||
1739 | // profile | ||
1740 | baseShape.ProfileBegin = Convert.ToUInt16(shapeRow["ProfileBegin"]); | ||
1741 | baseShape.ProfileEnd = Convert.ToUInt16(shapeRow["ProfileEnd"]); | ||
1742 | baseShape.ProfileCurve = Convert.ToByte(shapeRow["ProfileCurve"]); | ||
1743 | baseShape.ProfileHollow = Convert.ToUInt16(shapeRow["ProfileHollow"]); | ||
1744 | |||
1745 | byte[] textureEntry = (byte[])shapeRow["Texture"]; | ||
1746 | baseShape.TextureEntry = textureEntry; | ||
1747 | |||
1748 | baseShape.ExtraParams = (byte[])shapeRow["ExtraParams"]; | ||
1749 | |||
1750 | try | ||
1751 | { | ||
1752 | baseShape.State = Convert.ToByte(shapeRow["State"]); | ||
1753 | } | ||
1754 | catch (InvalidCastException) | ||
1755 | { | ||
1756 | } | ||
1757 | |||
1758 | if (!(shapeRow["Media"] is System.DBNull)) | ||
1759 | { | ||
1760 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); | ||
1761 | } | ||
1762 | |||
1763 | return baseShape; | ||
1764 | } | ||
1765 | |||
1766 | /// <summary> | ||
1767 | /// Build a prim inventory item from the persisted data. | ||
1768 | /// </summary> | ||
1769 | /// <param name="inventoryRow"></param> | ||
1770 | /// <returns></returns> | ||
1771 | private static TaskInventoryItem BuildItem(IDataRecord inventoryRow) | ||
1772 | { | ||
1773 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
1774 | |||
1775 | taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]); | ||
1776 | taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]); | ||
1777 | taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]); | ||
1778 | taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]); | ||
1779 | |||
1780 | taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]); | ||
1781 | taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]); | ||
1782 | |||
1783 | taskItem.Name = (string)inventoryRow["name"]; | ||
1784 | taskItem.Description = (string)inventoryRow["description"]; | ||
1785 | taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); | ||
1786 | //taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); | ||
1787 | taskItem.CreatorIdentification = (string)inventoryRow["creatorID"]; | ||
1788 | taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); | ||
1789 | taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); | ||
1790 | taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); | ||
1791 | |||
1792 | taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]); | ||
1793 | taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]); | ||
1794 | taskItem.BasePermissions = Convert.ToUInt32(inventoryRow["basePermissions"]); | ||
1795 | taskItem.EveryonePermissions = Convert.ToUInt32(inventoryRow["everyonePermissions"]); | ||
1796 | taskItem.GroupPermissions = Convert.ToUInt32(inventoryRow["groupPermissions"]); | ||
1797 | taskItem.Flags = Convert.ToUInt32(inventoryRow["flags"]); | ||
1798 | |||
1799 | return taskItem; | ||
1800 | } | ||
1801 | |||
1802 | #endregion | ||
1803 | |||
1804 | #region Create parameters methods | ||
1805 | |||
1806 | /// <summary> | ||
1807 | /// Creates the prim inventory parameters. | ||
1808 | /// </summary> | ||
1809 | /// <param name="taskItem">item in inventory.</param> | ||
1810 | /// <returns></returns> | ||
1811 | private SqlParameter[] CreatePrimInventoryParameters(TaskInventoryItem taskItem) | ||
1812 | { | ||
1813 | List<SqlParameter> parameters = new List<SqlParameter>(); | ||
1814 | |||
1815 | parameters.Add(_Database.CreateParameter("itemID", taskItem.ItemID)); | ||
1816 | parameters.Add(_Database.CreateParameter("primID", taskItem.ParentPartID)); | ||
1817 | parameters.Add(_Database.CreateParameter("assetID", taskItem.AssetID)); | ||
1818 | parameters.Add(_Database.CreateParameter("parentFolderID", taskItem.ParentID)); | ||
1819 | parameters.Add(_Database.CreateParameter("invType", taskItem.InvType)); | ||
1820 | parameters.Add(_Database.CreateParameter("assetType", taskItem.Type)); | ||
1821 | |||
1822 | parameters.Add(_Database.CreateParameter("name", taskItem.Name)); | ||
1823 | parameters.Add(_Database.CreateParameter("description", taskItem.Description)); | ||
1824 | parameters.Add(_Database.CreateParameter("creationDate", taskItem.CreationDate)); | ||
1825 | parameters.Add(_Database.CreateParameter("creatorID", taskItem.CreatorID)); | ||
1826 | parameters.Add(_Database.CreateParameter("ownerID", taskItem.OwnerID)); | ||
1827 | parameters.Add(_Database.CreateParameter("lastOwnerID", taskItem.LastOwnerID)); | ||
1828 | parameters.Add(_Database.CreateParameter("groupID", taskItem.GroupID)); | ||
1829 | parameters.Add(_Database.CreateParameter("nextPermissions", taskItem.NextPermissions)); | ||
1830 | parameters.Add(_Database.CreateParameter("currentPermissions", taskItem.CurrentPermissions)); | ||
1831 | parameters.Add(_Database.CreateParameter("basePermissions", taskItem.BasePermissions)); | ||
1832 | parameters.Add(_Database.CreateParameter("everyonePermissions", taskItem.EveryonePermissions)); | ||
1833 | parameters.Add(_Database.CreateParameter("groupPermissions", taskItem.GroupPermissions)); | ||
1834 | parameters.Add(_Database.CreateParameter("flags", taskItem.Flags)); | ||
1835 | |||
1836 | return parameters.ToArray(); | ||
1837 | } | ||
1838 | |||
1839 | /// <summary> | ||
1840 | /// Creates the region setting parameters. | ||
1841 | /// </summary> | ||
1842 | /// <param name="settings">regionsettings.</param> | ||
1843 | /// <returns></returns> | ||
1844 | private SqlParameter[] CreateRegionSettingParameters(RegionSettings settings) | ||
1845 | { | ||
1846 | List<SqlParameter> parameters = new List<SqlParameter>(); | ||
1847 | |||
1848 | parameters.Add(_Database.CreateParameter("regionUUID", settings.RegionUUID)); | ||
1849 | parameters.Add(_Database.CreateParameter("block_terraform", settings.BlockTerraform)); | ||
1850 | parameters.Add(_Database.CreateParameter("block_fly", settings.BlockFly)); | ||
1851 | parameters.Add(_Database.CreateParameter("allow_damage", settings.AllowDamage)); | ||
1852 | parameters.Add(_Database.CreateParameter("restrict_pushing", settings.RestrictPushing)); | ||
1853 | parameters.Add(_Database.CreateParameter("allow_land_resell", settings.AllowLandResell)); | ||
1854 | parameters.Add(_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide)); | ||
1855 | parameters.Add(_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch)); | ||
1856 | parameters.Add(_Database.CreateParameter("agent_limit", settings.AgentLimit)); | ||
1857 | parameters.Add(_Database.CreateParameter("object_bonus", settings.ObjectBonus)); | ||
1858 | parameters.Add(_Database.CreateParameter("maturity", settings.Maturity)); | ||
1859 | parameters.Add(_Database.CreateParameter("disable_scripts", settings.DisableScripts)); | ||
1860 | parameters.Add(_Database.CreateParameter("disable_collisions", settings.DisableCollisions)); | ||
1861 | parameters.Add(_Database.CreateParameter("disable_physics", settings.DisablePhysics)); | ||
1862 | parameters.Add(_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1)); | ||
1863 | parameters.Add(_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2)); | ||
1864 | parameters.Add(_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3)); | ||
1865 | parameters.Add(_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4)); | ||
1866 | parameters.Add(_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW)); | ||
1867 | parameters.Add(_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW)); | ||
1868 | parameters.Add(_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE)); | ||
1869 | parameters.Add(_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE)); | ||
1870 | parameters.Add(_Database.CreateParameter("elevation_1_se", settings.Elevation1SE)); | ||
1871 | parameters.Add(_Database.CreateParameter("elevation_2_se", settings.Elevation2SE)); | ||
1872 | parameters.Add(_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW)); | ||
1873 | parameters.Add(_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW)); | ||
1874 | parameters.Add(_Database.CreateParameter("water_height", settings.WaterHeight)); | ||
1875 | parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit)); | ||
1876 | parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit)); | ||
1877 | parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun)); | ||
1878 | parameters.Add(_Database.CreateParameter("Sandbox", settings.Sandbox)); | ||
1879 | parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun)); | ||
1880 | parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition)); | ||
1881 | parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X)); | ||
1882 | parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y)); | ||
1883 | parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z)); | ||
1884 | parameters.Add(_Database.CreateParameter("covenant", settings.Covenant)); | ||
1885 | parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime)); | ||
1886 | parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); | ||
1887 | parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); | ||
1888 | parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID)); | ||
1889 | parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID)); | ||
1890 | parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject)); | ||
1891 | |||
1892 | return parameters.ToArray(); | ||
1893 | } | ||
1894 | |||
1895 | /// <summary> | ||
1896 | /// Creates the land parameters. | ||
1897 | /// </summary> | ||
1898 | /// <param name="land">land parameters.</param> | ||
1899 | /// <param name="regionUUID">region UUID.</param> | ||
1900 | /// <returns></returns> | ||
1901 | private SqlParameter[] CreateLandParameters(LandData land, UUID regionUUID) | ||
1902 | { | ||
1903 | List<SqlParameter> parameters = new List<SqlParameter>(); | ||
1904 | |||
1905 | parameters.Add(_Database.CreateParameter("UUID", land.GlobalID)); | ||
1906 | parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID)); | ||
1907 | parameters.Add(_Database.CreateParameter("LocalLandID", land.LocalID)); | ||
1908 | |||
1909 | // Bitmap is a byte[512] | ||
1910 | parameters.Add(_Database.CreateParameter("Bitmap", land.Bitmap)); | ||
1911 | |||
1912 | parameters.Add(_Database.CreateParameter("Name", land.Name)); | ||
1913 | parameters.Add(_Database.CreateParameter("Description", land.Description)); | ||
1914 | parameters.Add(_Database.CreateParameter("OwnerUUID", land.OwnerID)); | ||
1915 | parameters.Add(_Database.CreateParameter("IsGroupOwned", land.IsGroupOwned)); | ||
1916 | parameters.Add(_Database.CreateParameter("Area", land.Area)); | ||
1917 | parameters.Add(_Database.CreateParameter("AuctionID", land.AuctionID)); //Unemplemented | ||
1918 | parameters.Add(_Database.CreateParameter("Category", (int)land.Category)); //Enum libsecondlife.Parcel.ParcelCategory | ||
1919 | parameters.Add(_Database.CreateParameter("ClaimDate", land.ClaimDate)); | ||
1920 | parameters.Add(_Database.CreateParameter("ClaimPrice", land.ClaimPrice)); | ||
1921 | parameters.Add(_Database.CreateParameter("GroupUUID", land.GroupID)); | ||
1922 | parameters.Add(_Database.CreateParameter("SalePrice", land.SalePrice)); | ||
1923 | parameters.Add(_Database.CreateParameter("LandStatus", (int)land.Status)); //Enum. libsecondlife.Parcel.ParcelStatus | ||
1924 | parameters.Add(_Database.CreateParameter("LandFlags", land.Flags)); | ||
1925 | parameters.Add(_Database.CreateParameter("LandingType", land.LandingType)); | ||
1926 | parameters.Add(_Database.CreateParameter("MediaAutoScale", land.MediaAutoScale)); | ||
1927 | parameters.Add(_Database.CreateParameter("MediaTextureUUID", land.MediaID)); | ||
1928 | parameters.Add(_Database.CreateParameter("MediaURL", land.MediaURL)); | ||
1929 | parameters.Add(_Database.CreateParameter("MusicURL", land.MusicURL)); | ||
1930 | parameters.Add(_Database.CreateParameter("PassHours", land.PassHours)); | ||
1931 | parameters.Add(_Database.CreateParameter("PassPrice", land.PassPrice)); | ||
1932 | parameters.Add(_Database.CreateParameter("SnapshotUUID", land.SnapshotID)); | ||
1933 | parameters.Add(_Database.CreateParameter("UserLocationX", land.UserLocation.X)); | ||
1934 | parameters.Add(_Database.CreateParameter("UserLocationY", land.UserLocation.Y)); | ||
1935 | parameters.Add(_Database.CreateParameter("UserLocationZ", land.UserLocation.Z)); | ||
1936 | parameters.Add(_Database.CreateParameter("UserLookAtX", land.UserLookAt.X)); | ||
1937 | parameters.Add(_Database.CreateParameter("UserLookAtY", land.UserLookAt.Y)); | ||
1938 | parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); | ||
1939 | parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); | ||
1940 | parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); | ||
1941 | |||
1942 | return parameters.ToArray(); | ||
1943 | } | ||
1944 | |||
1945 | /// <summary> | ||
1946 | /// Creates the land access parameters. | ||
1947 | /// </summary> | ||
1948 | /// <param name="parcelAccessEntry">parcel access entry.</param> | ||
1949 | /// <param name="parcelID">parcel ID.</param> | ||
1950 | /// <returns></returns> | ||
1951 | private SqlParameter[] CreateLandAccessParameters(LandAccessEntry parcelAccessEntry, UUID parcelID) | ||
1952 | { | ||
1953 | List<SqlParameter> parameters = new List<SqlParameter>(); | ||
1954 | |||
1955 | parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); | ||
1956 | parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); | ||
1957 | parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); | ||
1958 | parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires)); | ||
1959 | |||
1960 | return parameters.ToArray(); | ||
1961 | } | ||
1962 | |||
1963 | /// <summary> | ||
1964 | /// Creates the prim parameters for storing in DB. | ||
1965 | /// </summary> | ||
1966 | /// <param name="prim">Basic data of SceneObjectpart prim.</param> | ||
1967 | /// <param name="sceneGroupID">The scenegroup ID.</param> | ||
1968 | /// <param name="regionUUID">The region ID.</param> | ||
1969 | /// <returns></returns> | ||
1970 | private SqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) | ||
1971 | { | ||
1972 | List<SqlParameter> parameters = new List<SqlParameter>(); | ||
1973 | |||
1974 | parameters.Add(_Database.CreateParameter("UUID", prim.UUID)); | ||
1975 | parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID)); | ||
1976 | parameters.Add(_Database.CreateParameter("CreationDate", prim.CreationDate)); | ||
1977 | parameters.Add(_Database.CreateParameter("Name", prim.Name)); | ||
1978 | parameters.Add(_Database.CreateParameter("SceneGroupID", sceneGroupID)); | ||
1979 | // the UUID of the root part for this SceneObjectGroup | ||
1980 | // various text fields | ||
1981 | parameters.Add(_Database.CreateParameter("Text", prim.Text)); | ||
1982 | parameters.Add(_Database.CreateParameter("ColorR", prim.Color.R)); | ||
1983 | parameters.Add(_Database.CreateParameter("ColorG", prim.Color.G)); | ||
1984 | parameters.Add(_Database.CreateParameter("ColorB", prim.Color.B)); | ||
1985 | parameters.Add(_Database.CreateParameter("ColorA", prim.Color.A)); | ||
1986 | parameters.Add(_Database.CreateParameter("Description", prim.Description)); | ||
1987 | parameters.Add(_Database.CreateParameter("SitName", prim.SitName)); | ||
1988 | parameters.Add(_Database.CreateParameter("TouchName", prim.TouchName)); | ||
1989 | // permissions | ||
1990 | parameters.Add(_Database.CreateParameter("ObjectFlags", (uint)prim.Flags)); | ||
1991 | parameters.Add(_Database.CreateParameter("CreatorID", prim.CreatorID)); | ||
1992 | parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID)); | ||
1993 | parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID)); | ||
1994 | parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID)); | ||
1995 | parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask)); | ||
1996 | parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask)); | ||
1997 | parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask)); | ||
1998 | parameters.Add(_Database.CreateParameter("EveryoneMask", prim.EveryoneMask)); | ||
1999 | parameters.Add(_Database.CreateParameter("BaseMask", prim.BaseMask)); | ||
2000 | // vectors | ||
2001 | parameters.Add(_Database.CreateParameter("PositionX", prim.OffsetPosition.X)); | ||
2002 | parameters.Add(_Database.CreateParameter("PositionY", prim.OffsetPosition.Y)); | ||
2003 | parameters.Add(_Database.CreateParameter("PositionZ", prim.OffsetPosition.Z)); | ||
2004 | parameters.Add(_Database.CreateParameter("GroupPositionX", prim.GroupPosition.X)); | ||
2005 | parameters.Add(_Database.CreateParameter("GroupPositionY", prim.GroupPosition.Y)); | ||
2006 | parameters.Add(_Database.CreateParameter("GroupPositionZ", prim.GroupPosition.Z)); | ||
2007 | parameters.Add(_Database.CreateParameter("VelocityX", prim.Velocity.X)); | ||
2008 | parameters.Add(_Database.CreateParameter("VelocityY", prim.Velocity.Y)); | ||
2009 | parameters.Add(_Database.CreateParameter("VelocityZ", prim.Velocity.Z)); | ||
2010 | parameters.Add(_Database.CreateParameter("AngularVelocityX", prim.AngularVelocity.X)); | ||
2011 | parameters.Add(_Database.CreateParameter("AngularVelocityY", prim.AngularVelocity.Y)); | ||
2012 | parameters.Add(_Database.CreateParameter("AngularVelocityZ", prim.AngularVelocity.Z)); | ||
2013 | parameters.Add(_Database.CreateParameter("AccelerationX", prim.Acceleration.X)); | ||
2014 | parameters.Add(_Database.CreateParameter("AccelerationY", prim.Acceleration.Y)); | ||
2015 | parameters.Add(_Database.CreateParameter("AccelerationZ", prim.Acceleration.Z)); | ||
2016 | // quaternions | ||
2017 | parameters.Add(_Database.CreateParameter("RotationX", prim.RotationOffset.X)); | ||
2018 | parameters.Add(_Database.CreateParameter("RotationY", prim.RotationOffset.Y)); | ||
2019 | parameters.Add(_Database.CreateParameter("RotationZ", prim.RotationOffset.Z)); | ||
2020 | parameters.Add(_Database.CreateParameter("RotationW", prim.RotationOffset.W)); | ||
2021 | |||
2022 | // Sit target | ||
2023 | Vector3 sitTargetPos = prim.SitTargetPositionLL; | ||
2024 | parameters.Add(_Database.CreateParameter("SitTargetOffsetX", sitTargetPos.X)); | ||
2025 | parameters.Add(_Database.CreateParameter("SitTargetOffsetY", sitTargetPos.Y)); | ||
2026 | parameters.Add(_Database.CreateParameter("SitTargetOffsetZ", sitTargetPos.Z)); | ||
2027 | |||
2028 | Quaternion sitTargetOrient = prim.SitTargetOrientationLL; | ||
2029 | parameters.Add(_Database.CreateParameter("SitTargetOrientW", sitTargetOrient.W)); | ||
2030 | parameters.Add(_Database.CreateParameter("SitTargetOrientX", sitTargetOrient.X)); | ||
2031 | parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y)); | ||
2032 | parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z)); | ||
2033 | |||
2034 | parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0])); | ||
2035 | parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1])); | ||
2036 | parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2])); | ||
2037 | parameters.Add(_Database.CreateParameter("PayButton3", prim.PayPrice[3])); | ||
2038 | parameters.Add(_Database.CreateParameter("PayButton4", prim.PayPrice[4])); | ||
2039 | |||
2040 | if ((prim.SoundFlags & 1) != 0) // Looped | ||
2041 | { | ||
2042 | parameters.Add(_Database.CreateParameter("LoopedSound", prim.Sound)); | ||
2043 | parameters.Add(_Database.CreateParameter("LoopedSoundGain", prim.SoundGain)); | ||
2044 | } | ||
2045 | else | ||
2046 | { | ||
2047 | parameters.Add(_Database.CreateParameter("LoopedSound", UUID.Zero)); | ||
2048 | parameters.Add(_Database.CreateParameter("LoopedSoundGain", 0.0f)); | ||
2049 | } | ||
2050 | |||
2051 | parameters.Add(_Database.CreateParameter("TextureAnimation", prim.TextureAnimation)); | ||
2052 | parameters.Add(_Database.CreateParameter("ParticleSystem", prim.ParticleSystem)); | ||
2053 | |||
2054 | parameters.Add(_Database.CreateParameter("OmegaX", prim.AngularVelocity.X)); | ||
2055 | parameters.Add(_Database.CreateParameter("OmegaY", prim.AngularVelocity.Y)); | ||
2056 | parameters.Add(_Database.CreateParameter("OmegaZ", prim.AngularVelocity.Z)); | ||
2057 | |||
2058 | parameters.Add(_Database.CreateParameter("CameraEyeOffsetX", prim.GetCameraEyeOffset().X)); | ||
2059 | parameters.Add(_Database.CreateParameter("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y)); | ||
2060 | parameters.Add(_Database.CreateParameter("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z)); | ||
2061 | |||
2062 | parameters.Add(_Database.CreateParameter("CameraAtOffsetX", prim.GetCameraAtOffset().X)); | ||
2063 | parameters.Add(_Database.CreateParameter("CameraAtOffsetY", prim.GetCameraAtOffset().Y)); | ||
2064 | parameters.Add(_Database.CreateParameter("CameraAtOffsetZ", prim.GetCameraAtOffset().Z)); | ||
2065 | |||
2066 | if (prim.GetForceMouselook()) | ||
2067 | parameters.Add(_Database.CreateParameter("ForceMouselook", 1)); | ||
2068 | else | ||
2069 | parameters.Add(_Database.CreateParameter("ForceMouselook", 0)); | ||
2070 | |||
2071 | parameters.Add(_Database.CreateParameter("ScriptAccessPin", prim.ScriptAccessPin)); | ||
2072 | |||
2073 | if (prim.AllowedDrop) | ||
2074 | parameters.Add(_Database.CreateParameter("AllowedDrop", 1)); | ||
2075 | else | ||
2076 | parameters.Add(_Database.CreateParameter("AllowedDrop", 0)); | ||
2077 | |||
2078 | if (prim.DIE_AT_EDGE) | ||
2079 | parameters.Add(_Database.CreateParameter("DieAtEdge", 1)); | ||
2080 | else | ||
2081 | parameters.Add(_Database.CreateParameter("DieAtEdge", 0)); | ||
2082 | |||
2083 | parameters.Add(_Database.CreateParameter("SalePrice", prim.SalePrice)); | ||
2084 | parameters.Add(_Database.CreateParameter("SaleType", prim.ObjectSaleType)); | ||
2085 | |||
2086 | byte clickAction = prim.ClickAction; | ||
2087 | parameters.Add(_Database.CreateParameter("ClickAction", clickAction)); | ||
2088 | |||
2089 | parameters.Add(_Database.CreateParameter("Material", prim.Material)); | ||
2090 | |||
2091 | parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); | ||
2092 | parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); | ||
2093 | if (prim.PassTouches) | ||
2094 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); | ||
2095 | else | ||
2096 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); | ||
2097 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); | ||
2098 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); | ||
2099 | parameters.Add(_Database.CreateParameter("AttachedPosX", prim.AttachedPos.X)); | ||
2100 | parameters.Add(_Database.CreateParameter("AttachedPosY", prim.AttachedPos.Y)); | ||
2101 | parameters.Add(_Database.CreateParameter("AttachedPosZ", prim.AttachedPos.Z)); | ||
2102 | |||
2103 | if (prim.DynAttrs.CountNamespaces > 0) | ||
2104 | parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); | ||
2105 | else | ||
2106 | parameters.Add(_Database.CreateParameter("DynAttrs", null)); | ||
2107 | |||
2108 | parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType)); | ||
2109 | parameters.Add(_Database.CreateParameter("Density", (double)prim.Density)); | ||
2110 | parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier)); | ||
2111 | parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction)); | ||
2112 | parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution)); | ||
2113 | |||
2114 | return parameters.ToArray(); | ||
2115 | } | ||
2116 | |||
2117 | /// <summary> | ||
2118 | /// Creates the primshape parameters for stroing in DB. | ||
2119 | /// </summary> | ||
2120 | /// <param name="prim">Basic data of SceneObjectpart prim.</param> | ||
2121 | /// <param name="sceneGroupID">The scene group ID.</param> | ||
2122 | /// <param name="regionUUID">The region UUID.</param> | ||
2123 | /// <returns></returns> | ||
2124 | private SqlParameter[] CreatePrimShapeParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) | ||
2125 | { | ||
2126 | List<SqlParameter> parameters = new List<SqlParameter>(); | ||
2127 | |||
2128 | PrimitiveBaseShape s = prim.Shape; | ||
2129 | parameters.Add(_Database.CreateParameter("UUID", prim.UUID)); | ||
2130 | // shape is an enum | ||
2131 | parameters.Add(_Database.CreateParameter("Shape", 0)); | ||
2132 | // vectors | ||
2133 | parameters.Add(_Database.CreateParameter("ScaleX", s.Scale.X)); | ||
2134 | parameters.Add(_Database.CreateParameter("ScaleY", s.Scale.Y)); | ||
2135 | parameters.Add(_Database.CreateParameter("ScaleZ", s.Scale.Z)); | ||
2136 | // paths | ||
2137 | parameters.Add(_Database.CreateParameter("PCode", s.PCode)); | ||
2138 | parameters.Add(_Database.CreateParameter("PathBegin", s.PathBegin)); | ||
2139 | parameters.Add(_Database.CreateParameter("PathEnd", s.PathEnd)); | ||
2140 | parameters.Add(_Database.CreateParameter("PathScaleX", s.PathScaleX)); | ||
2141 | parameters.Add(_Database.CreateParameter("PathScaleY", s.PathScaleY)); | ||
2142 | parameters.Add(_Database.CreateParameter("PathShearX", s.PathShearX)); | ||
2143 | parameters.Add(_Database.CreateParameter("PathShearY", s.PathShearY)); | ||
2144 | parameters.Add(_Database.CreateParameter("PathSkew", s.PathSkew)); | ||
2145 | parameters.Add(_Database.CreateParameter("PathCurve", s.PathCurve)); | ||
2146 | parameters.Add(_Database.CreateParameter("PathRadiusOffset", s.PathRadiusOffset)); | ||
2147 | parameters.Add(_Database.CreateParameter("PathRevolutions", s.PathRevolutions)); | ||
2148 | parameters.Add(_Database.CreateParameter("PathTaperX", s.PathTaperX)); | ||
2149 | parameters.Add(_Database.CreateParameter("PathTaperY", s.PathTaperY)); | ||
2150 | parameters.Add(_Database.CreateParameter("PathTwist", s.PathTwist)); | ||
2151 | parameters.Add(_Database.CreateParameter("PathTwistBegin", s.PathTwistBegin)); | ||
2152 | // profile | ||
2153 | parameters.Add(_Database.CreateParameter("ProfileBegin", s.ProfileBegin)); | ||
2154 | parameters.Add(_Database.CreateParameter("ProfileEnd", s.ProfileEnd)); | ||
2155 | parameters.Add(_Database.CreateParameter("ProfileCurve", s.ProfileCurve)); | ||
2156 | parameters.Add(_Database.CreateParameter("ProfileHollow", s.ProfileHollow)); | ||
2157 | parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry)); | ||
2158 | parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); | ||
2159 | parameters.Add(_Database.CreateParameter("State", s.State)); | ||
2160 | |||
2161 | if (null == s.Media) | ||
2162 | { | ||
2163 | parameters.Add(_Database.CreateParameter("Media", DBNull.Value)); | ||
2164 | } | ||
2165 | else | ||
2166 | { | ||
2167 | parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml())); | ||
2168 | } | ||
2169 | |||
2170 | return parameters.ToArray(); | ||
2171 | } | ||
2172 | |||
2173 | #endregion | ||
2174 | |||
2175 | #endregion | ||
2176 | |||
2177 | private void LoadSpawnPoints(RegionSettings rs) | ||
2178 | { | ||
2179 | rs.ClearSpawnPoints(); | ||
2180 | |||
2181 | string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID"; | ||
2182 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
2183 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
2184 | { | ||
2185 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString())); | ||
2186 | conn.Open(); | ||
2187 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
2188 | { | ||
2189 | if (reader.Read()) | ||
2190 | { | ||
2191 | SpawnPoint sp = new SpawnPoint(); | ||
2192 | |||
2193 | sp.Yaw = (float)reader["Yaw"]; | ||
2194 | sp.Pitch = (float)reader["Pitch"]; | ||
2195 | sp.Distance = (float)reader["Distance"]; | ||
2196 | |||
2197 | rs.AddSpawnPoint(sp); | ||
2198 | } | ||
2199 | } | ||
2200 | } | ||
2201 | } | ||
2202 | |||
2203 | private void SaveSpawnPoints(RegionSettings rs) | ||
2204 | { | ||
2205 | string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID"; | ||
2206 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
2207 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
2208 | { | ||
2209 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID)); | ||
2210 | conn.Open(); | ||
2211 | cmd.ExecuteNonQuery(); | ||
2212 | } | ||
2213 | foreach (SpawnPoint p in rs.SpawnPoints()) | ||
2214 | { | ||
2215 | sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)"; | ||
2216 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
2217 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
2218 | { | ||
2219 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID)); | ||
2220 | cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw)); | ||
2221 | cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch)); | ||
2222 | cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance)); | ||
2223 | conn.Open(); | ||
2224 | cmd.ExecuteNonQuery(); | ||
2225 | } | ||
2226 | } | ||
2227 | } | ||
2228 | |||
2229 | public void SaveExtra(UUID regionID, string name, string value) | ||
2230 | { | ||
2231 | } | ||
2232 | |||
2233 | public void RemoveExtra(UUID regionID, string name) | ||
2234 | { | ||
2235 | } | ||
2236 | |||
2237 | public Dictionary<string, string> GetExtra(UUID regionID) | ||
2238 | { | ||
2239 | return null; | ||
2240 | } | ||
2241 | } | ||
2242 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs deleted file mode 100644 index 7feec91..0000000 --- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs +++ /dev/null | |||
@@ -1,246 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using System.Data.SqlClient; | ||
35 | using System.Text; | ||
36 | |||
37 | namespace OpenSim.Data.MSSQL | ||
38 | { | ||
39 | public class MSSQLUserAccountData : MSSQLGenericTableHandler<UserAccountData>,IUserAccountData | ||
40 | { | ||
41 | public MSSQLUserAccountData(string connectionString, string realm) : | ||
42 | base(connectionString, realm, "UserAccount") | ||
43 | { | ||
44 | } | ||
45 | //private string m_Realm; | ||
46 | //private List<string> m_ColumnNames = null; | ||
47 | //private MSSQLManager m_database; | ||
48 | |||
49 | //public MSSQLUserAccountData(string connectionString, string realm) | ||
50 | //{ | ||
51 | // m_Realm = realm; | ||
52 | // m_ConnectionString = connectionString; | ||
53 | // m_database = new MSSQLManager(connectionString); | ||
54 | |||
55 | // using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
56 | // { | ||
57 | // conn.Open(); | ||
58 | // Migration m = new Migration(conn, GetType().Assembly, "UserStore"); | ||
59 | // m.Update(); | ||
60 | // } | ||
61 | //} | ||
62 | |||
63 | //public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query) | ||
64 | //{ | ||
65 | // return null; | ||
66 | //} | ||
67 | |||
68 | //public UserAccountData Get(UUID principalID, UUID scopeID) | ||
69 | //{ | ||
70 | // UserAccountData ret = new UserAccountData(); | ||
71 | // ret.Data = new Dictionary<string, string>(); | ||
72 | |||
73 | // string sql = string.Format("select * from {0} where UUID = @principalID", m_Realm); | ||
74 | // if (scopeID != UUID.Zero) | ||
75 | // sql += " and ScopeID = @scopeID"; | ||
76 | |||
77 | // using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
78 | // using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
79 | // { | ||
80 | // cmd.Parameters.Add(m_database.CreateParameter("@principalID", principalID)); | ||
81 | // cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
82 | |||
83 | // conn.Open(); | ||
84 | // using (SqlDataReader result = cmd.ExecuteReader()) | ||
85 | // { | ||
86 | // if (result.Read()) | ||
87 | // { | ||
88 | // ret.PrincipalID = principalID; | ||
89 | // UUID scope; | ||
90 | // UUID.TryParse(result["ScopeID"].ToString(), out scope); | ||
91 | // ret.ScopeID = scope; | ||
92 | |||
93 | // if (m_ColumnNames == null) | ||
94 | // { | ||
95 | // m_ColumnNames = new List<string>(); | ||
96 | |||
97 | // DataTable schemaTable = result.GetSchemaTable(); | ||
98 | // foreach (DataRow row in schemaTable.Rows) | ||
99 | // m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
100 | // } | ||
101 | |||
102 | // foreach (string s in m_ColumnNames) | ||
103 | // { | ||
104 | // if (s == "UUID") | ||
105 | // continue; | ||
106 | // if (s == "ScopeID") | ||
107 | // continue; | ||
108 | |||
109 | // ret.Data[s] = result[s].ToString(); | ||
110 | // } | ||
111 | // return ret; | ||
112 | // } | ||
113 | // } | ||
114 | // } | ||
115 | // return null; | ||
116 | //} | ||
117 | |||
118 | //public bool Store(UserAccountData data) | ||
119 | //{ | ||
120 | // if (data.Data.ContainsKey("UUID")) | ||
121 | // data.Data.Remove("UUID"); | ||
122 | // if (data.Data.ContainsKey("ScopeID")) | ||
123 | // data.Data.Remove("ScopeID"); | ||
124 | |||
125 | // string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
126 | |||
127 | // using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
128 | // using (SqlCommand cmd = new SqlCommand()) | ||
129 | // { | ||
130 | // StringBuilder updateBuilder = new StringBuilder(); | ||
131 | // updateBuilder.AppendFormat("update {0} set ", m_Realm); | ||
132 | // bool first = true; | ||
133 | // foreach (string field in fields) | ||
134 | // { | ||
135 | // if (!first) | ||
136 | // updateBuilder.Append(", "); | ||
137 | // updateBuilder.AppendFormat("{0} = @{0}", field); | ||
138 | |||
139 | // first = false; | ||
140 | // cmd.Parameters.Add(m_database.CreateParameter("@" + field, data.Data[field])); | ||
141 | // } | ||
142 | |||
143 | // updateBuilder.Append(" where UUID = @principalID"); | ||
144 | |||
145 | // if (data.ScopeID != UUID.Zero) | ||
146 | // updateBuilder.Append(" and ScopeID = @scopeID"); | ||
147 | |||
148 | // cmd.CommandText = updateBuilder.ToString(); | ||
149 | // cmd.Connection = conn; | ||
150 | // cmd.Parameters.Add(m_database.CreateParameter("@principalID", data.PrincipalID)); | ||
151 | // cmd.Parameters.Add(m_database.CreateParameter("@scopeID", data.ScopeID)); | ||
152 | // conn.Open(); | ||
153 | |||
154 | // if (cmd.ExecuteNonQuery() < 1) | ||
155 | // { | ||
156 | // StringBuilder insertBuilder = new StringBuilder(); | ||
157 | // insertBuilder.AppendFormat("insert into {0} (UUID, ScopeID, ", m_Realm); | ||
158 | // insertBuilder.Append(String.Join(", ", fields)); | ||
159 | // insertBuilder.Append(") values (@principalID, @scopeID, @"); | ||
160 | // insertBuilder.Append(String.Join(", @", fields)); | ||
161 | // insertBuilder.Append(")"); | ||
162 | |||
163 | // cmd.CommandText = insertBuilder.ToString(); | ||
164 | |||
165 | // if (cmd.ExecuteNonQuery() < 1) | ||
166 | // { | ||
167 | // return false; | ||
168 | // } | ||
169 | // } | ||
170 | // } | ||
171 | // return true; | ||
172 | //} | ||
173 | |||
174 | //public bool Store(UserAccountData data, UUID principalID, string token) | ||
175 | //{ | ||
176 | // return false; | ||
177 | //} | ||
178 | |||
179 | //public bool SetDataItem(UUID principalID, string item, string value) | ||
180 | //{ | ||
181 | // string sql = string.Format("update {0} set {1} = @{1} where UUID = @UUID", m_Realm, item); | ||
182 | // using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
183 | // using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
184 | // { | ||
185 | // cmd.Parameters.Add(m_database.CreateParameter("@" + item, value)); | ||
186 | // cmd.Parameters.Add(m_database.CreateParameter("@UUID", principalID)); | ||
187 | |||
188 | // conn.Open(); | ||
189 | |||
190 | // if (cmd.ExecuteNonQuery() > 0) | ||
191 | // return true; | ||
192 | // } | ||
193 | // return false; | ||
194 | //} | ||
195 | |||
196 | //public UserAccountData[] Get(string[] keys, string[] vals) | ||
197 | //{ | ||
198 | // return null; | ||
199 | //} | ||
200 | |||
201 | public UserAccountData[] GetUsers(UUID scopeID, string query) | ||
202 | { | ||
203 | string[] words = query.Split(new char[] { ' ' }); | ||
204 | |||
205 | for (int i = 0; i < words.Length; i++) | ||
206 | { | ||
207 | if (words[i].Length < 3) | ||
208 | { | ||
209 | if (i != words.Length - 1) | ||
210 | Array.Copy(words, i + 1, words, i, words.Length - i - 1); | ||
211 | Array.Resize(ref words, words.Length - 1); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | if (words.Length == 0) | ||
216 | return new UserAccountData[0]; | ||
217 | |||
218 | if (words.Length > 2) | ||
219 | return new UserAccountData[0]; | ||
220 | |||
221 | string sql = ""; | ||
222 | |||
223 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
224 | using (SqlCommand cmd = new SqlCommand()) | ||
225 | { | ||
226 | if (words.Length == 1) | ||
227 | { | ||
228 | sql = String.Format("select * from {0} where ([ScopeID]=@ScopeID or [ScopeID]='00000000-0000-0000-0000-000000000000') and ([FirstName] like @search or [LastName] like @search)", m_Realm); | ||
229 | cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); | ||
230 | cmd.Parameters.Add(m_database.CreateParameter("@search", "%" + words[0] + "%")); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | sql = String.Format("select * from {0} where ([ScopeID]=@ScopeID or [ScopeID]='00000000-0000-0000-0000-000000000000') and ([FirstName] like @searchFirst or [LastName] like @searchLast)", m_Realm); | ||
235 | cmd.Parameters.Add(m_database.CreateParameter("@searchFirst", "%" + words[0] + "%")); | ||
236 | cmd.Parameters.Add(m_database.CreateParameter("@searchLast", "%" + words[1] + "%")); | ||
237 | cmd.Parameters.Add(m_database.CreateParameter("@ScopeID", scopeID.ToString())); | ||
238 | } | ||
239 | cmd.Connection = conn; | ||
240 | cmd.CommandText = sql; | ||
241 | conn.Open(); | ||
242 | return DoQuery(cmd); | ||
243 | } | ||
244 | } | ||
245 | } | ||
246 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs deleted file mode 100644 index bfef682..0000000 --- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs +++ /dev/null | |||
@@ -1,305 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ''AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using System.Data.SqlClient; | ||
35 | using System.Reflection; | ||
36 | using System.Text; | ||
37 | using log4net; | ||
38 | |||
39 | namespace OpenSim.Data.MSSQL | ||
40 | { | ||
41 | public class MSSQLXInventoryData : IXInventoryData | ||
42 | { | ||
43 | // private static readonly ILog m_log = LogManager.GetLogger( | ||
44 | // MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private MSSQLFolderHandler m_Folders; | ||
47 | private MSSQLItemHandler m_Items; | ||
48 | |||
49 | public MSSQLXInventoryData(string conn, string realm) | ||
50 | { | ||
51 | m_Folders = new MSSQLFolderHandler( | ||
52 | conn, "inventoryfolders", "InventoryStore"); | ||
53 | m_Items = new MSSQLItemHandler( | ||
54 | conn, "inventoryitems", String.Empty); | ||
55 | } | ||
56 | |||
57 | public XInventoryFolder[] GetFolders(string[] fields, string[] vals) | ||
58 | { | ||
59 | return m_Folders.Get(fields, vals); | ||
60 | } | ||
61 | |||
62 | public XInventoryItem[] GetItems(string[] fields, string[] vals) | ||
63 | { | ||
64 | return m_Items.Get(fields, vals); | ||
65 | } | ||
66 | |||
67 | public bool StoreFolder(XInventoryFolder folder) | ||
68 | { | ||
69 | if (folder.folderName.Length > 64) | ||
70 | folder.folderName = folder.folderName.Substring(0, 64); | ||
71 | return m_Folders.Store(folder); | ||
72 | } | ||
73 | |||
74 | public bool StoreItem(XInventoryItem item) | ||
75 | { | ||
76 | if (item.inventoryName.Length > 64) | ||
77 | item.inventoryName = item.inventoryName.Substring(0, 64); | ||
78 | if (item.inventoryDescription.Length > 128) | ||
79 | item.inventoryDescription = item.inventoryDescription.Substring(0, 128); | ||
80 | |||
81 | return m_Items.Store(item); | ||
82 | } | ||
83 | |||
84 | public bool DeleteFolders(string field, string val) | ||
85 | { | ||
86 | return m_Folders.Delete(field, val); | ||
87 | } | ||
88 | |||
89 | public bool DeleteFolders(string[] fields, string[] vals) | ||
90 | { | ||
91 | return m_Folders.Delete(fields, vals); | ||
92 | } | ||
93 | |||
94 | public bool DeleteItems(string field, string val) | ||
95 | { | ||
96 | return m_Items.Delete(field, val); | ||
97 | } | ||
98 | |||
99 | public bool DeleteItems(string[] fields, string[] vals) | ||
100 | { | ||
101 | return m_Items.Delete(fields, vals); | ||
102 | } | ||
103 | |||
104 | public bool MoveItem(string id, string newParent) | ||
105 | { | ||
106 | return m_Items.MoveItem(id, newParent); | ||
107 | } | ||
108 | |||
109 | public bool MoveFolder(string id, string newParent) | ||
110 | { | ||
111 | return m_Folders.MoveFolder(id, newParent); | ||
112 | } | ||
113 | |||
114 | public XInventoryItem[] GetActiveGestures(UUID principalID) | ||
115 | { | ||
116 | return m_Items.GetActiveGestures(principalID); | ||
117 | } | ||
118 | |||
119 | public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
120 | { | ||
121 | return m_Items.GetAssetPermissions(principalID, assetID); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public class MSSQLItemHandler : MSSQLInventoryHandler<XInventoryItem> | ||
126 | { | ||
127 | public MSSQLItemHandler(string c, string t, string m) : | ||
128 | base(c, t, m) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | public bool MoveItem(string id, string newParent) | ||
133 | { | ||
134 | XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id }); | ||
135 | if (retrievedItems.Length == 0) | ||
136 | return false; | ||
137 | |||
138 | UUID oldParent = retrievedItems[0].parentFolderID; | ||
139 | |||
140 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
141 | { | ||
142 | using (SqlCommand cmd = new SqlCommand()) | ||
143 | { | ||
144 | |||
145 | cmd.CommandText = String.Format("update {0} set parentFolderID = @ParentFolderID where inventoryID = @InventoryID", m_Realm); | ||
146 | cmd.Parameters.Add(m_database.CreateParameter("@ParentFolderID", newParent)); | ||
147 | cmd.Parameters.Add(m_database.CreateParameter("@InventoryID", id)); | ||
148 | cmd.Connection = conn; | ||
149 | conn.Open(); | ||
150 | |||
151 | if (cmd.ExecuteNonQuery() == 0) | ||
152 | return false; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | IncrementFolderVersion(oldParent); | ||
157 | IncrementFolderVersion(newParent); | ||
158 | |||
159 | return true; | ||
160 | } | ||
161 | |||
162 | public XInventoryItem[] GetActiveGestures(UUID principalID) | ||
163 | { | ||
164 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
165 | { | ||
166 | using (SqlCommand cmd = new SqlCommand()) | ||
167 | { | ||
168 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = @uuid and assetType = @type and flags = 1", m_Realm); | ||
169 | |||
170 | cmd.Parameters.Add(m_database.CreateParameter("@uuid", principalID.ToString())); | ||
171 | cmd.Parameters.Add(m_database.CreateParameter("@type", (int)AssetType.Gesture)); | ||
172 | cmd.Connection = conn; | ||
173 | conn.Open(); | ||
174 | return DoQuery(cmd); | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
179 | public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
180 | { | ||
181 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
182 | { | ||
183 | using (SqlCommand cmd = new SqlCommand()) | ||
184 | { | ||
185 | cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = @PrincipalID and assetID = @AssetID group by assetID", m_Realm); | ||
186 | cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString())); | ||
187 | cmd.Parameters.Add(m_database.CreateParameter("@AssetID", assetID.ToString())); | ||
188 | cmd.Connection = conn; | ||
189 | conn.Open(); | ||
190 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
191 | { | ||
192 | |||
193 | int perms = 0; | ||
194 | |||
195 | if (reader.Read()) | ||
196 | { | ||
197 | perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]); | ||
198 | } | ||
199 | |||
200 | return perms; | ||
201 | } | ||
202 | |||
203 | } | ||
204 | } | ||
205 | } | ||
206 | |||
207 | public override bool Store(XInventoryItem item) | ||
208 | { | ||
209 | if (!base.Store(item)) | ||
210 | return false; | ||
211 | |||
212 | IncrementFolderVersion(item.parentFolderID); | ||
213 | |||
214 | return true; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | public class MSSQLFolderHandler : MSSQLInventoryHandler<XInventoryFolder> | ||
219 | { | ||
220 | public MSSQLFolderHandler(string c, string t, string m) : | ||
221 | base(c, t, m) | ||
222 | { | ||
223 | } | ||
224 | |||
225 | public bool MoveFolder(string id, string newParentFolderID) | ||
226 | { | ||
227 | XInventoryFolder[] folders = Get(new string[] { "folderID" }, new string[] { id }); | ||
228 | |||
229 | if (folders.Length == 0) | ||
230 | return false; | ||
231 | |||
232 | UUID oldParentFolderUUID = folders[0].parentFolderID; | ||
233 | |||
234 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
235 | { | ||
236 | using (SqlCommand cmd = new SqlCommand()) | ||
237 | { | ||
238 | |||
239 | cmd.CommandText = String.Format("update {0} set parentFolderID = @ParentFolderID where folderID = @folderID", m_Realm); | ||
240 | cmd.Parameters.Add(m_database.CreateParameter("@ParentFolderID", newParentFolderID)); | ||
241 | cmd.Parameters.Add(m_database.CreateParameter("@folderID", id)); | ||
242 | cmd.Connection = conn; | ||
243 | conn.Open(); | ||
244 | |||
245 | if (cmd.ExecuteNonQuery() == 0) | ||
246 | return false; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | IncrementFolderVersion(oldParentFolderUUID); | ||
251 | IncrementFolderVersion(newParentFolderID); | ||
252 | |||
253 | return true; | ||
254 | } | ||
255 | |||
256 | public override bool Store(XInventoryFolder folder) | ||
257 | { | ||
258 | if (!base.Store(folder)) | ||
259 | return false; | ||
260 | |||
261 | IncrementFolderVersion(folder.parentFolderID); | ||
262 | |||
263 | return true; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | public class MSSQLInventoryHandler<T> : MSSQLGenericTableHandler<T> where T: class, new() | ||
268 | { | ||
269 | public MSSQLInventoryHandler(string c, string t, string m) : base(c, t, m) {} | ||
270 | |||
271 | protected bool IncrementFolderVersion(UUID folderID) | ||
272 | { | ||
273 | return IncrementFolderVersion(folderID.ToString()); | ||
274 | } | ||
275 | |||
276 | protected bool IncrementFolderVersion(string folderID) | ||
277 | { | ||
278 | // m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); | ||
279 | // Util.PrintCallStack(); | ||
280 | |||
281 | string sql = "update inventoryfolders set version=version+1 where folderID = @folderID"; | ||
282 | |||
283 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | ||
284 | { | ||
285 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
286 | { | ||
287 | conn.Open(); | ||
288 | |||
289 | cmd.Parameters.AddWithValue("@folderID", folderID); | ||
290 | |||
291 | try | ||
292 | { | ||
293 | cmd.ExecuteNonQuery(); | ||
294 | } | ||
295 | catch (Exception) | ||
296 | { | ||
297 | return false; | ||
298 | } | ||
299 | } | ||
300 | } | ||
301 | |||
302 | return true; | ||
303 | } | ||
304 | } | ||
305 | } \ No newline at end of file | ||
diff --git a/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs b/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs deleted file mode 100644 index ad1203b..0000000 --- a/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | |||
31 | // General information about an assembly is controlled through the following | ||
32 | // set of attributes. Change these attribute values to modify the information | ||
33 | // associated with an assembly. | ||
34 | |||
35 | [assembly : AssemblyTitle("OpenSim.Data.MSSQL")] | ||
36 | [assembly : AssemblyDescription("")] | ||
37 | [assembly : AssemblyConfiguration("")] | ||
38 | [assembly : AssemblyCompany("http://opensimulator.org")] | ||
39 | [assembly : AssemblyProduct("OpenSim.Data.MSSQL")] | ||
40 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] | ||
41 | [assembly : AssemblyTrademark("")] | ||
42 | [assembly : AssemblyCulture("")] | ||
43 | |||
44 | // Setting ComVisible to false makes the types in this assembly not visible | ||
45 | // to COM components. If you need to access a type in this assembly from | ||
46 | // COM, set the ComVisible attribute to true on that type. | ||
47 | |||
48 | [assembly : ComVisible(false)] | ||
49 | |||
50 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
51 | |||
52 | [assembly : Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] | ||
53 | |||
54 | // Version information for an assembly consists of the following four values: | ||
55 | // | ||
56 | // Major Version | ||
57 | // Minor Version | ||
58 | // Build Number | ||
59 | // Revision | ||
60 | // | ||
61 | // You can specify all the values or you can default the Revision and Build Numbers | ||
62 | // by using the '*' as shown below: | ||
63 | |||
64 | [assembly : AssemblyVersion("0.8.1.*")] | ||
65 | |||
diff --git a/OpenSim/Data/MSSQL/Resources/AssetStore.migrations b/OpenSim/Data/MSSQL/Resources/AssetStore.migrations deleted file mode 100644 index 8664ce9..0000000 --- a/OpenSim/Data/MSSQL/Resources/AssetStore.migrations +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | CREATE TABLE [assets] ( | ||
4 | [id] [varchar](36) NOT NULL, | ||
5 | [name] [varchar](64) NOT NULL, | ||
6 | [description] [varchar](64) NOT NULL, | ||
7 | [assetType] [tinyint] NOT NULL, | ||
8 | [local] [tinyint] NOT NULL, | ||
9 | [temporary] [tinyint] NOT NULL, | ||
10 | [data] [image] NOT NULL, | ||
11 | PRIMARY KEY CLUSTERED | ||
12 | ( | ||
13 | [id] ASC | ||
14 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
15 | ) ON [PRIMARY] | ||
16 | |||
17 | |||
18 | :VERSION 2 | ||
19 | |||
20 | BEGIN TRANSACTION | ||
21 | |||
22 | CREATE TABLE Tmp_assets | ||
23 | ( | ||
24 | id varchar(36) NOT NULL, | ||
25 | name varchar(64) NOT NULL, | ||
26 | description varchar(64) NOT NULL, | ||
27 | assetType tinyint NOT NULL, | ||
28 | local bit NOT NULL, | ||
29 | temporary bit NOT NULL, | ||
30 | data image NOT NULL | ||
31 | ) ON [PRIMARY] | ||
32 | TEXTIMAGE_ON [PRIMARY] | ||
33 | |||
34 | IF EXISTS(SELECT * FROM assets) | ||
35 | EXEC('INSERT INTO Tmp_assets (id, name, description, assetType, local, temporary, data) | ||
36 | SELECT id, name, description, assetType, CONVERT(bit, local), CONVERT(bit, temporary), data FROM assets WITH (HOLDLOCK TABLOCKX)') | ||
37 | |||
38 | DROP TABLE assets | ||
39 | |||
40 | EXECUTE sp_rename N'Tmp_assets', N'assets', 'OBJECT' | ||
41 | |||
42 | ALTER TABLE dbo.assets ADD CONSTRAINT | ||
43 | PK__assets__id PRIMARY KEY CLUSTERED | ||
44 | ( | ||
45 | id | ||
46 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
47 | |||
48 | COMMIT | ||
49 | |||
50 | |||
51 | :VERSION 3 | ||
52 | |||
53 | BEGIN TRANSACTION | ||
54 | |||
55 | ALTER TABLE assets add create_time integer default 0 | ||
56 | ALTER TABLE assets add access_time integer default 0 | ||
57 | |||
58 | COMMIT | ||
59 | |||
60 | |||
61 | :VERSION 4 | ||
62 | |||
63 | BEGIN TRANSACTION | ||
64 | |||
65 | CREATE TABLE dbo.Tmp_assets | ||
66 | ( | ||
67 | id uniqueidentifier NOT NULL, | ||
68 | name varchar(64) NOT NULL, | ||
69 | description varchar(64) NOT NULL, | ||
70 | assetType tinyint NOT NULL, | ||
71 | local bit NOT NULL, | ||
72 | temporary bit NOT NULL, | ||
73 | data image NOT NULL, | ||
74 | create_time int NULL, | ||
75 | access_time int NULL | ||
76 | ) ON [PRIMARY] | ||
77 | TEXTIMAGE_ON [PRIMARY] | ||
78 | |||
79 | IF EXISTS(SELECT * FROM dbo.assets) | ||
80 | EXEC('INSERT INTO dbo.Tmp_assets (id, name, description, assetType, local, temporary, data, create_time, access_time) | ||
81 | SELECT CONVERT(uniqueidentifier, id), name, description, assetType, local, temporary, data, create_time, access_time FROM dbo.assets WITH (HOLDLOCK TABLOCKX)') | ||
82 | |||
83 | DROP TABLE assets | ||
84 | |||
85 | EXECUTE sp_rename N'Tmp_assets', N'assets', 'OBJECT' | ||
86 | |||
87 | ALTER TABLE dbo.assets ADD CONSTRAINT | ||
88 | PK__assets__id PRIMARY KEY CLUSTERED | ||
89 | ( | ||
90 | id | ||
91 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
92 | |||
93 | COMMIT | ||
94 | |||
95 | |||
96 | :VERSION 5 | ||
97 | |||
98 | DELETE FROM assets WHERE id = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621'; | ||
99 | |||
100 | :VERSION 6 | ||
101 | |||
102 | ALTER TABLE assets ADD asset_flags INTEGER NOT NULL DEFAULT 0; | ||
103 | |||
104 | :VERSION 7 | ||
105 | |||
106 | alter table assets add creatorid varchar(36) not null default ''; | ||
diff --git a/OpenSim/Data/MSSQL/Resources/AuthStore.migrations b/OpenSim/Data/MSSQL/Resources/AuthStore.migrations deleted file mode 100644 index eb91296..0000000 --- a/OpenSim/Data/MSSQL/Resources/AuthStore.migrations +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [auth] ( | ||
6 | [uuid] [uniqueidentifier] NOT NULL default '00000000-0000-0000-0000-000000000000', | ||
7 | [passwordHash] [varchar](32) NOT NULL, | ||
8 | [passwordSalt] [varchar](32) NOT NULL, | ||
9 | [webLoginKey] [varchar](255) NOT NULL, | ||
10 | [accountType] VARCHAR(32) NOT NULL DEFAULT 'UserAccount', | ||
11 | ) ON [PRIMARY] | ||
12 | |||
13 | CREATE TABLE [tokens] ( | ||
14 | [uuid] [uniqueidentifier] NOT NULL default '00000000-0000-0000-0000-000000000000', | ||
15 | [token] [varchar](255) NOT NULL, | ||
16 | [validity] [datetime] NOT NULL ) | ||
17 | ON [PRIMARY] | ||
18 | |||
19 | COMMIT | ||
20 | |||
21 | :VERSION 2 | ||
22 | |||
23 | BEGIN TRANSACTION | ||
24 | |||
25 | IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users]') AND type in (N'U')) | ||
26 | INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey, accountType) SELECT [UUID] AS UUID, [passwordHash] AS passwordHash, [passwordSalt] AS passwordSalt, [webLoginKey] AS webLoginKey, 'UserAccount' as [accountType] FROM users; | ||
27 | |||
28 | COMMIT | ||
29 | |||
30 | |||
31 | |||
32 | |||
diff --git a/OpenSim/Data/MSSQL/Resources/Avatar.migrations b/OpenSim/Data/MSSQL/Resources/Avatar.migrations deleted file mode 100644 index 61f7b56..0000000 --- a/OpenSim/Data/MSSQL/Resources/Avatar.migrations +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [Avatars] ( | ||
6 | [PrincipalID] uniqueidentifier NOT NULL, | ||
7 | [Name] varchar(32) NOT NULL, | ||
8 | [Value] varchar(255) NOT NULL DEFAULT '', | ||
9 | PRIMARY KEY CLUSTERED | ||
10 | ( | ||
11 | [PrincipalID] ASC, [Name] ASC | ||
12 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
13 | ) ON [PRIMARY] | ||
14 | |||
15 | |||
16 | COMMIT | ||
17 | |||
18 | :VERSION 2 | ||
19 | |||
20 | BEGIN TRANSACTION | ||
21 | |||
22 | CREATE TABLE dbo.Tmp_Avatars | ||
23 | ( | ||
24 | PrincipalID uniqueidentifier NOT NULL, | ||
25 | [Name] varchar(32) NOT NULL, | ||
26 | Value text NOT NULL DEFAULT '', | ||
27 | ) ON [PRIMARY] | ||
28 | TEXTIMAGE_ON [PRIMARY] | ||
29 | |||
30 | IF EXISTS(SELECT * FROM dbo.Avatars) | ||
31 | EXEC('INSERT INTO dbo.Tmp_Avatars (PrincipalID, Name, Value) | ||
32 | SELECT PrincipalID, CONVERT(text, Name), Value FROM dbo.Avatars WITH (HOLDLOCK TABLOCKX)') | ||
33 | |||
34 | DROP TABLE dbo.Avatars | ||
35 | |||
36 | EXECUTE sp_rename N'dbo.Tmp_Avatars', N'Avatars', 'OBJECT' | ||
37 | |||
38 | COMMIT | ||
39 | |||
40 | :VERSION 3 | ||
41 | |||
42 | BEGIN TRANSACTION | ||
43 | |||
44 | CREATE TABLE dbo.Tmp_Avatars | ||
45 | ( | ||
46 | PrincipalID uniqueidentifier NOT NULL, | ||
47 | [Name] varchar(32) NOT NULL, | ||
48 | Value text NOT NULL DEFAULT '', | ||
49 | PRIMARY KEY CLUSTERED | ||
50 | ( | ||
51 | [PrincipalID] ASC, [Name] ASC | ||
52 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
53 | ) ON [PRIMARY] | ||
54 | TEXTIMAGE_ON [PRIMARY] | ||
55 | |||
56 | IF EXISTS(SELECT * FROM dbo.Avatars) | ||
57 | EXEC('INSERT INTO dbo.Tmp_Avatars (PrincipalID, Name, Value) | ||
58 | SELECT PrincipalID, CONVERT(text, Name), Value FROM dbo.Avatars WITH (HOLDLOCK TABLOCKX)') | ||
59 | |||
60 | DROP TABLE dbo.Avatars | ||
61 | |||
62 | EXECUTE sp_rename N'dbo.Tmp_Avatars', N'Avatars', 'OBJECT' | ||
63 | COMMIT | ||
64 | |||
diff --git a/OpenSim/Data/MSSQL/Resources/EstateStore.migrations b/OpenSim/Data/MSSQL/Resources/EstateStore.migrations deleted file mode 100644 index b5b1b18..0000000 --- a/OpenSim/Data/MSSQL/Resources/EstateStore.migrations +++ /dev/null | |||
@@ -1,342 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [dbo].[estate_managers]( | ||
6 | [EstateID] [int] NOT NULL, | ||
7 | [uuid] [varchar](36) NOT NULL, | ||
8 | CONSTRAINT [PK_estate_managers] PRIMARY KEY CLUSTERED | ||
9 | ( | ||
10 | [EstateID] ASC | ||
11 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
12 | ) ON [PRIMARY]; | ||
13 | |||
14 | CREATE TABLE [dbo].[estate_groups]( | ||
15 | [EstateID] [int] NOT NULL, | ||
16 | [uuid] [varchar](36) NOT NULL, | ||
17 | CONSTRAINT [PK_estate_groups] PRIMARY KEY CLUSTERED | ||
18 | ( | ||
19 | [EstateID] ASC | ||
20 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
21 | ) ON [PRIMARY]; | ||
22 | |||
23 | |||
24 | CREATE TABLE [dbo].[estate_users]( | ||
25 | [EstateID] [int] NOT NULL, | ||
26 | [uuid] [varchar](36) NOT NULL, | ||
27 | CONSTRAINT [PK_estate_users] PRIMARY KEY CLUSTERED | ||
28 | ( | ||
29 | [EstateID] ASC | ||
30 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
31 | ) ON [PRIMARY]; | ||
32 | |||
33 | |||
34 | CREATE TABLE [dbo].[estateban]( | ||
35 | [EstateID] [int] NOT NULL, | ||
36 | [bannedUUID] [varchar](36) NOT NULL, | ||
37 | [bannedIp] [varchar](16) NOT NULL, | ||
38 | [bannedIpHostMask] [varchar](16) NOT NULL, | ||
39 | [bannedNameMask] [varchar](64) NULL DEFAULT (NULL), | ||
40 | CONSTRAINT [PK_estateban] PRIMARY KEY CLUSTERED | ||
41 | ( | ||
42 | [EstateID] ASC | ||
43 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
44 | ) ON [PRIMARY]; | ||
45 | |||
46 | CREATE TABLE [dbo].[estate_settings]( | ||
47 | [EstateID] [int] IDENTITY(1,100) NOT NULL, | ||
48 | [EstateName] [varchar](64) NULL DEFAULT (NULL), | ||
49 | [AbuseEmailToEstateOwner] [bit] NOT NULL, | ||
50 | [DenyAnonymous] [bit] NOT NULL, | ||
51 | [ResetHomeOnTeleport] [bit] NOT NULL, | ||
52 | [FixedSun] [bit] NOT NULL, | ||
53 | [DenyTransacted] [bit] NOT NULL, | ||
54 | [BlockDwell] [bit] NOT NULL, | ||
55 | [DenyIdentified] [bit] NOT NULL, | ||
56 | [AllowVoice] [bit] NOT NULL, | ||
57 | [UseGlobalTime] [bit] NOT NULL, | ||
58 | [PricePerMeter] [int] NOT NULL, | ||
59 | [TaxFree] [bit] NOT NULL, | ||
60 | [AllowDirectTeleport] [bit] NOT NULL, | ||
61 | [RedirectGridX] [int] NOT NULL, | ||
62 | [RedirectGridY] [int] NOT NULL, | ||
63 | [ParentEstateID] [int] NOT NULL, | ||
64 | [SunPosition] [float] NOT NULL, | ||
65 | [EstateSkipScripts] [bit] NOT NULL, | ||
66 | [BillableFactor] [float] NOT NULL, | ||
67 | [PublicAccess] [bit] NOT NULL, | ||
68 | [AbuseEmail] [varchar](255) NOT NULL, | ||
69 | [EstateOwner] [varchar](36) NOT NULL, | ||
70 | [DenyMinors] [bit] NOT NULL, | ||
71 | CONSTRAINT [PK_estate_settings] PRIMARY KEY CLUSTERED | ||
72 | ( | ||
73 | [EstateID] ASC | ||
74 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
75 | ) ON [PRIMARY]; | ||
76 | |||
77 | |||
78 | CREATE TABLE [dbo].[estate_map]( | ||
79 | [RegionID] [varchar](36) NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
80 | [EstateID] [int] NOT NULL, | ||
81 | CONSTRAINT [PK_estate_map] PRIMARY KEY CLUSTERED | ||
82 | ( | ||
83 | [RegionID] ASC | ||
84 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
85 | ) ON [PRIMARY]; | ||
86 | |||
87 | COMMIT | ||
88 | |||
89 | :VERSION 2 | ||
90 | |||
91 | BEGIN TRANSACTION | ||
92 | |||
93 | ALTER TABLE dbo.estate_managers DROP CONSTRAINT PK_estate_managers | ||
94 | |||
95 | CREATE NONCLUSTERED INDEX IX_estate_managers ON dbo.estate_managers | ||
96 | ( | ||
97 | EstateID | ||
98 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
99 | |||
100 | ALTER TABLE dbo.estate_groups DROP CONSTRAINT PK_estate_groups | ||
101 | |||
102 | CREATE NONCLUSTERED INDEX IX_estate_groups ON dbo.estate_groups | ||
103 | ( | ||
104 | EstateID | ||
105 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
106 | |||
107 | |||
108 | ALTER TABLE dbo.estate_users DROP CONSTRAINT PK_estate_users | ||
109 | |||
110 | CREATE NONCLUSTERED INDEX IX_estate_users ON dbo.estate_users | ||
111 | ( | ||
112 | EstateID | ||
113 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
114 | |||
115 | COMMIT | ||
116 | |||
117 | |||
118 | :VERSION 3 | ||
119 | |||
120 | BEGIN TRANSACTION | ||
121 | |||
122 | CREATE TABLE dbo.Tmp_estateban | ||
123 | ( | ||
124 | EstateID int NOT NULL, | ||
125 | bannedUUID varchar(36) NOT NULL, | ||
126 | bannedIp varchar(16) NULL, | ||
127 | bannedIpHostMask varchar(16) NULL, | ||
128 | bannedNameMask varchar(64) NULL | ||
129 | ) ON [PRIMARY] | ||
130 | |||
131 | IF EXISTS(SELECT * FROM dbo.estateban) | ||
132 | EXEC('INSERT INTO dbo.Tmp_estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) | ||
133 | SELECT EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask FROM dbo.estateban') | ||
134 | |||
135 | DROP TABLE dbo.estateban | ||
136 | |||
137 | EXECUTE sp_rename N'dbo.Tmp_estateban', N'estateban', 'OBJECT' | ||
138 | |||
139 | CREATE NONCLUSTERED INDEX IX_estateban ON dbo.estateban | ||
140 | ( | ||
141 | EstateID | ||
142 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
143 | |||
144 | COMMIT | ||
145 | |||
146 | |||
147 | :VERSION 4 | ||
148 | |||
149 | BEGIN TRANSACTION | ||
150 | |||
151 | CREATE TABLE dbo.Tmp_estate_managers | ||
152 | ( | ||
153 | EstateID int NOT NULL, | ||
154 | uuid uniqueidentifier NOT NULL | ||
155 | ) ON [PRIMARY] | ||
156 | |||
157 | IF EXISTS(SELECT * FROM dbo.estate_managers) | ||
158 | EXEC('INSERT INTO dbo.Tmp_estate_managers (EstateID, uuid) | ||
159 | SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_managers WITH (HOLDLOCK TABLOCKX)') | ||
160 | |||
161 | DROP TABLE dbo.estate_managers | ||
162 | |||
163 | EXECUTE sp_rename N'dbo.Tmp_estate_managers', N'estate_managers', 'OBJECT' | ||
164 | |||
165 | CREATE NONCLUSTERED INDEX IX_estate_managers ON dbo.estate_managers | ||
166 | ( | ||
167 | EstateID | ||
168 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
169 | |||
170 | COMMIT | ||
171 | |||
172 | |||
173 | :VERSION 5 | ||
174 | |||
175 | BEGIN TRANSACTION | ||
176 | |||
177 | CREATE TABLE dbo.Tmp_estate_groups | ||
178 | ( | ||
179 | EstateID int NOT NULL, | ||
180 | uuid uniqueidentifier NOT NULL | ||
181 | ) ON [PRIMARY] | ||
182 | |||
183 | IF EXISTS(SELECT * FROM dbo.estate_groups) | ||
184 | EXEC('INSERT INTO dbo.Tmp_estate_groups (EstateID, uuid) | ||
185 | SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_groups WITH (HOLDLOCK TABLOCKX)') | ||
186 | |||
187 | DROP TABLE dbo.estate_groups | ||
188 | |||
189 | EXECUTE sp_rename N'dbo.Tmp_estate_groups', N'estate_groups', 'OBJECT' | ||
190 | |||
191 | CREATE NONCLUSTERED INDEX IX_estate_groups ON dbo.estate_groups | ||
192 | ( | ||
193 | EstateID | ||
194 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
195 | |||
196 | COMMIT | ||
197 | |||
198 | |||
199 | :VERSION 6 | ||
200 | |||
201 | BEGIN TRANSACTION | ||
202 | |||
203 | CREATE TABLE dbo.Tmp_estate_users | ||
204 | ( | ||
205 | EstateID int NOT NULL, | ||
206 | uuid uniqueidentifier NOT NULL | ||
207 | ) ON [PRIMARY] | ||
208 | |||
209 | IF EXISTS(SELECT * FROM dbo.estate_users) | ||
210 | EXEC('INSERT INTO dbo.Tmp_estate_users (EstateID, uuid) | ||
211 | SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_users WITH (HOLDLOCK TABLOCKX)') | ||
212 | |||
213 | DROP TABLE dbo.estate_users | ||
214 | |||
215 | EXECUTE sp_rename N'dbo.Tmp_estate_users', N'estate_users', 'OBJECT' | ||
216 | |||
217 | CREATE NONCLUSTERED INDEX IX_estate_users ON dbo.estate_users | ||
218 | ( | ||
219 | EstateID | ||
220 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
221 | |||
222 | COMMIT | ||
223 | |||
224 | |||
225 | :VERSION 7 | ||
226 | |||
227 | BEGIN TRANSACTION | ||
228 | |||
229 | CREATE TABLE dbo.Tmp_estateban | ||
230 | ( | ||
231 | EstateID int NOT NULL, | ||
232 | bannedUUID uniqueidentifier NOT NULL, | ||
233 | bannedIp varchar(16) NULL, | ||
234 | bannedIpHostMask varchar(16) NULL, | ||
235 | bannedNameMask varchar(64) NULL | ||
236 | ) ON [PRIMARY] | ||
237 | |||
238 | IF EXISTS(SELECT * FROM dbo.estateban) | ||
239 | EXEC('INSERT INTO dbo.Tmp_estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) | ||
240 | SELECT EstateID, CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask, bannedNameMask FROM dbo.estateban WITH (HOLDLOCK TABLOCKX)') | ||
241 | |||
242 | DROP TABLE dbo.estateban | ||
243 | |||
244 | EXECUTE sp_rename N'dbo.Tmp_estateban', N'estateban', 'OBJECT' | ||
245 | |||
246 | CREATE NONCLUSTERED INDEX IX_estateban ON dbo.estateban | ||
247 | ( | ||
248 | EstateID | ||
249 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
250 | |||
251 | COMMIT | ||
252 | |||
253 | |||
254 | :VERSION 8 | ||
255 | |||
256 | BEGIN TRANSACTION | ||
257 | |||
258 | CREATE TABLE dbo.Tmp_estate_settings | ||
259 | ( | ||
260 | EstateID int NOT NULL IDENTITY (1, 100), | ||
261 | EstateName varchar(64) NULL DEFAULT (NULL), | ||
262 | AbuseEmailToEstateOwner bit NOT NULL, | ||
263 | DenyAnonymous bit NOT NULL, | ||
264 | ResetHomeOnTeleport bit NOT NULL, | ||
265 | FixedSun bit NOT NULL, | ||
266 | DenyTransacted bit NOT NULL, | ||
267 | BlockDwell bit NOT NULL, | ||
268 | DenyIdentified bit NOT NULL, | ||
269 | AllowVoice bit NOT NULL, | ||
270 | UseGlobalTime bit NOT NULL, | ||
271 | PricePerMeter int NOT NULL, | ||
272 | TaxFree bit NOT NULL, | ||
273 | AllowDirectTeleport bit NOT NULL, | ||
274 | RedirectGridX int NOT NULL, | ||
275 | RedirectGridY int NOT NULL, | ||
276 | ParentEstateID int NOT NULL, | ||
277 | SunPosition float(53) NOT NULL, | ||
278 | EstateSkipScripts bit NOT NULL, | ||
279 | BillableFactor float(53) NOT NULL, | ||
280 | PublicAccess bit NOT NULL, | ||
281 | AbuseEmail varchar(255) NOT NULL, | ||
282 | EstateOwner uniqueidentifier NOT NULL, | ||
283 | DenyMinors bit NOT NULL | ||
284 | ) ON [PRIMARY] | ||
285 | |||
286 | SET IDENTITY_INSERT dbo.Tmp_estate_settings ON | ||
287 | |||
288 | IF EXISTS(SELECT * FROM dbo.estate_settings) | ||
289 | EXEC('INSERT INTO dbo.Tmp_estate_settings (EstateID, EstateName, AbuseEmailToEstateOwner, DenyAnonymous, ResetHomeOnTeleport, FixedSun, DenyTransacted, BlockDwell, DenyIdentified, AllowVoice, UseGlobalTime, PricePerMeter, TaxFree, AllowDirectTeleport, RedirectGridX, RedirectGridY, ParentEstateID, SunPosition, EstateSkipScripts, BillableFactor, PublicAccess, AbuseEmail, EstateOwner, DenyMinors) | ||
290 | SELECT EstateID, EstateName, AbuseEmailToEstateOwner, DenyAnonymous, ResetHomeOnTeleport, FixedSun, DenyTransacted, BlockDwell, DenyIdentified, AllowVoice, UseGlobalTime, PricePerMeter, TaxFree, AllowDirectTeleport, RedirectGridX, RedirectGridY, ParentEstateID, SunPosition, EstateSkipScripts, BillableFactor, PublicAccess, AbuseEmail, CONVERT(uniqueidentifier, EstateOwner), DenyMinors FROM dbo.estate_settings WITH (HOLDLOCK TABLOCKX)') | ||
291 | |||
292 | SET IDENTITY_INSERT dbo.Tmp_estate_settings OFF | ||
293 | |||
294 | DROP TABLE dbo.estate_settings | ||
295 | |||
296 | EXECUTE sp_rename N'dbo.Tmp_estate_settings', N'estate_settings', 'OBJECT' | ||
297 | |||
298 | ALTER TABLE dbo.estate_settings ADD CONSTRAINT | ||
299 | PK_estate_settings PRIMARY KEY CLUSTERED | ||
300 | ( | ||
301 | EstateID | ||
302 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
303 | |||
304 | COMMIT | ||
305 | |||
306 | |||
307 | :VERSION 9 | ||
308 | |||
309 | BEGIN TRANSACTION | ||
310 | |||
311 | CREATE TABLE dbo.Tmp_estate_map | ||
312 | ( | ||
313 | RegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
314 | EstateID int NOT NULL | ||
315 | ) ON [PRIMARY] | ||
316 | |||
317 | IF EXISTS(SELECT * FROM dbo.estate_map) | ||
318 | EXEC('INSERT INTO dbo.Tmp_estate_map (RegionID, EstateID) | ||
319 | SELECT CONVERT(uniqueidentifier, RegionID), EstateID FROM dbo.estate_map WITH (HOLDLOCK TABLOCKX)') | ||
320 | |||
321 | DROP TABLE dbo.estate_map | ||
322 | |||
323 | EXECUTE sp_rename N'dbo.Tmp_estate_map', N'estate_map', 'OBJECT' | ||
324 | |||
325 | ALTER TABLE dbo.estate_map ADD CONSTRAINT | ||
326 | PK_estate_map PRIMARY KEY CLUSTERED | ||
327 | ( | ||
328 | RegionID | ||
329 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
330 | |||
331 | |||
332 | COMMIT | ||
333 | |||
334 | :VERSION 10 | ||
335 | |||
336 | BEGIN transaction | ||
337 | |||
338 | ALTER TABLE estate_settings ADD AllowLandmark tinyint NOT NULL default 1; | ||
339 | ALTER TABLE estate_settings ADD AllowParcelChanges tinyint NOT NULL default 1; | ||
340 | ALTER TABLE estate_settings ADD AllowSetHome tinyint NOT NULL default 1; | ||
341 | |||
342 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations b/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations deleted file mode 100644 index cc94c4e..0000000 --- a/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [Friends] ( | ||
6 | [PrincipalID] uniqueidentifier NOT NULL, | ||
7 | [Friend] varchar(255) NOT NULL, | ||
8 | [Flags] char(16) NOT NULL DEFAULT '0', | ||
9 | [Offered] varchar(32) NOT NULL DEFAULT 0) | ||
10 | ON [PRIMARY] | ||
11 | |||
12 | COMMIT | ||
13 | |||
14 | :VERSION 2 | ||
15 | |||
16 | BEGIN TRANSACTION | ||
17 | |||
18 | IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[userfriends]') AND type in (N'U')) | ||
19 | INSERT INTO Friends (PrincipalID, Friend, Flags, Offered) | ||
20 | SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends; | ||
21 | |||
22 | COMMIT | ||
23 | |||
24 | :VERSION 3 | ||
25 | |||
26 | BEGIN TRANSACTION | ||
27 | |||
28 | CREATE TABLE [Tmp_Friends] | ||
29 | ([PrincipalID] varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
30 | [Friend] varchar(255) NOT NULL, | ||
31 | [Flags] char(16) NOT NULL DEFAULT '0', | ||
32 | [Offered] varchar(32) NOT NULL DEFAULT 0) | ||
33 | ON [PRIMARY] | ||
34 | |||
35 | |||
36 | IF EXISTS(SELECT * FROM dbo.Friends) | ||
37 | EXEC('INSERT INTO dbo.Tmp_Friends (PrincipalID, Friend, Flags, Offered) | ||
38 | SELECT CONVERT(varchar(255),PrincipalID), Friend, Flags, Offered FROM dbo.Friends WITH (HOLDLOCK TABLOCKX)') | ||
39 | |||
40 | DROP TABLE dbo.Friends | ||
41 | |||
42 | EXECUTE sp_rename N'dbo.Tmp_Friends', N'Friends', 'OBJECT' | ||
43 | |||
44 | ALTER TABLE dbo.Friends ADD | ||
45 | PRIMARY KEY CLUSTERED | ||
46 | ( | ||
47 | [PrincipalID] ASC, [Friend] ASC | ||
48 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
49 | |||
50 | COMMIT \ No newline at end of file | ||
diff --git a/OpenSim/Data/MSSQL/Resources/GridStore.migrations b/OpenSim/Data/MSSQL/Resources/GridStore.migrations deleted file mode 100644 index de0cea7..0000000 --- a/OpenSim/Data/MSSQL/Resources/GridStore.migrations +++ /dev/null | |||
@@ -1,245 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [dbo].[regions]( | ||
6 | [regionHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
7 | [regionName] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
8 | [uuid] [varchar](255) COLLATE Latin1_General_CI_AS NOT NULL, | ||
9 | [regionRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
10 | [regionSecret] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
11 | [regionSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
12 | [regionDataURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
13 | [serverIP] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
14 | [serverPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
15 | [serverURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
16 | [locX] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
17 | [locY] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
18 | [locZ] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
19 | [eastOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
20 | [westOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
21 | [southOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
22 | [northOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
23 | [regionAssetURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
24 | [regionAssetRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
25 | [regionAssetSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
26 | [regionUserURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
27 | [regionUserRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
28 | [regionUserSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
29 | [regionMapTexture] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
30 | [serverHttpPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
31 | [serverRemotingPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL, | ||
32 | [owner_uuid] [varchar](36) COLLATE Latin1_General_CI_AS NULL, | ||
33 | PRIMARY KEY CLUSTERED | ||
34 | ( | ||
35 | [uuid] ASC | ||
36 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
37 | ) ON [PRIMARY] | ||
38 | |||
39 | COMMIT | ||
40 | |||
41 | |||
42 | :VERSION 2 | ||
43 | |||
44 | BEGIN TRANSACTION | ||
45 | |||
46 | CREATE TABLE Tmp_regions | ||
47 | ( | ||
48 | uuid varchar(36) COLLATE Latin1_General_CI_AS NOT NULL, | ||
49 | regionHandle bigint NULL, | ||
50 | regionName varchar(20) NULL, | ||
51 | regionRecvKey varchar(128) NULL, | ||
52 | regionSendKey varchar(128) NULL, | ||
53 | regionSecret varchar(128) NULL, | ||
54 | regionDataURI varchar(128) NULL, | ||
55 | serverIP varchar(64) NULL, | ||
56 | serverPort int NULL, | ||
57 | serverURI varchar(255) NULL, | ||
58 | locX int NULL, | ||
59 | locY int NULL, | ||
60 | locZ int NULL, | ||
61 | eastOverrideHandle bigint NULL, | ||
62 | westOverrideHandle bigint NULL, | ||
63 | southOverrideHandle bigint NULL, | ||
64 | northOverrideHandle bigint NULL, | ||
65 | regionAssetURI varchar(255) NULL, | ||
66 | regionAssetRecvKey varchar(128) NULL, | ||
67 | regionAssetSendKey varchar(128) NULL, | ||
68 | regionUserURI varchar(255) NULL, | ||
69 | regionUserRecvKey varchar(128) NULL, | ||
70 | regionUserSendKey varchar(128) NULL, | ||
71 | regionMapTexture varchar(36) NULL, | ||
72 | serverHttpPort int NULL, | ||
73 | serverRemotingPort int NULL, | ||
74 | owner_uuid varchar(36) NULL, | ||
75 | originUUID varchar(36) NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000') | ||
76 | ) ON [PRIMARY] | ||
77 | |||
78 | IF EXISTS(SELECT * FROM regions) | ||
79 | EXEC('INSERT INTO Tmp_regions (uuid, regionHandle, regionName, regionRecvKey, regionSendKey, regionSecret, regionDataURI, serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid) | ||
80 | SELECT CONVERT(varchar(36), uuid), CONVERT(bigint, regionHandle), CONVERT(varchar(20), regionName), CONVERT(varchar(128), regionRecvKey), CONVERT(varchar(128), regionSendKey), CONVERT(varchar(128), regionSecret), CONVERT(varchar(128), regionDataURI), CONVERT(varchar(64), serverIP), CONVERT(int, serverPort), serverURI, CONVERT(int, locX), CONVERT(int, locY), CONVERT(int, locZ), CONVERT(bigint, eastOverrideHandle), CONVERT(bigint, westOverrideHandle), CONVERT(bigint, southOverrideHandle), CONVERT(bigint, northOverrideHandle), regionAssetURI, CONVERT(varchar(128), regionAssetRecvKey), CONVERT(varchar(128), regionAssetSendKey), regionUserURI, CONVERT(varchar(128), regionUserRecvKey), CONVERT(varchar(128), regionUserSendKey), CONVERT(varchar(36), regionMapTexture), CONVERT(int, serverHttpPort), CONVERT(int, serverRemotingPort), owner_uuid FROM regions') | ||
81 | |||
82 | DROP TABLE regions | ||
83 | |||
84 | EXECUTE sp_rename N'Tmp_regions', N'regions', 'OBJECT' | ||
85 | |||
86 | ALTER TABLE regions ADD CONSTRAINT | ||
87 | PK__regions__uuid PRIMARY KEY CLUSTERED | ||
88 | ( | ||
89 | uuid | ||
90 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
91 | |||
92 | COMMIT | ||
93 | |||
94 | :VERSION 3 | ||
95 | |||
96 | BEGIN TRANSACTION | ||
97 | |||
98 | CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions | ||
99 | ( | ||
100 | regionName | ||
101 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
102 | |||
103 | CREATE NONCLUSTERED INDEX IX_regions_handle ON dbo.regions | ||
104 | ( | ||
105 | regionHandle | ||
106 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
107 | |||
108 | |||
109 | CREATE NONCLUSTERED INDEX IX_regions_override ON dbo.regions | ||
110 | ( | ||
111 | eastOverrideHandle, | ||
112 | westOverrideHandle, | ||
113 | southOverrideHandle, | ||
114 | northOverrideHandle | ||
115 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
116 | |||
117 | COMMIT | ||
118 | |||
119 | |||
120 | :VERSION 4 | ||
121 | |||
122 | /* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/ | ||
123 | BEGIN TRANSACTION | ||
124 | |||
125 | CREATE TABLE dbo.Tmp_regions | ||
126 | ( | ||
127 | uuid uniqueidentifier NOT NULL, | ||
128 | regionHandle bigint NULL, | ||
129 | regionName varchar(20) NULL, | ||
130 | regionRecvKey varchar(128) NULL, | ||
131 | regionSendKey varchar(128) NULL, | ||
132 | regionSecret varchar(128) NULL, | ||
133 | regionDataURI varchar(128) NULL, | ||
134 | serverIP varchar(64) NULL, | ||
135 | serverPort int NULL, | ||
136 | serverURI varchar(255) NULL, | ||
137 | locX int NULL, | ||
138 | locY int NULL, | ||
139 | locZ int NULL, | ||
140 | eastOverrideHandle bigint NULL, | ||
141 | westOverrideHandle bigint NULL, | ||
142 | southOverrideHandle bigint NULL, | ||
143 | northOverrideHandle bigint NULL, | ||
144 | regionAssetURI varchar(255) NULL, | ||
145 | regionAssetRecvKey varchar(128) NULL, | ||
146 | regionAssetSendKey varchar(128) NULL, | ||
147 | regionUserURI varchar(255) NULL, | ||
148 | regionUserRecvKey varchar(128) NULL, | ||
149 | regionUserSendKey varchar(128) NULL, | ||
150 | regionMapTexture uniqueidentifier NULL, | ||
151 | serverHttpPort int NULL, | ||
152 | serverRemotingPort int NULL, | ||
153 | owner_uuid uniqueidentifier NOT NULL, | ||
154 | originUUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000') | ||
155 | ) ON [PRIMARY] | ||
156 | |||
157 | IF EXISTS(SELECT * FROM dbo.regions) | ||
158 | EXEC('INSERT INTO dbo.Tmp_regions (uuid, regionHandle, regionName, regionRecvKey, regionSendKey, regionSecret, regionDataURI, serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID) | ||
159 | SELECT CONVERT(uniqueidentifier, uuid), regionHandle, regionName, regionRecvKey, regionSendKey, regionSecret, regionDataURI, serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, CONVERT(uniqueidentifier, regionMapTexture), serverHttpPort, serverRemotingPort, CONVERT(uniqueidentifier, owner_uuid), CONVERT(uniqueidentifier, originUUID) FROM dbo.regions WITH (HOLDLOCK TABLOCKX)') | ||
160 | |||
161 | DROP TABLE dbo.regions | ||
162 | |||
163 | EXECUTE sp_rename N'dbo.Tmp_regions', N'regions', 'OBJECT' | ||
164 | |||
165 | ALTER TABLE dbo.regions ADD CONSTRAINT | ||
166 | PK__regions__uuid PRIMARY KEY CLUSTERED | ||
167 | ( | ||
168 | uuid | ||
169 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
170 | |||
171 | CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions | ||
172 | ( | ||
173 | regionName | ||
174 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
175 | |||
176 | CREATE NONCLUSTERED INDEX IX_regions_handle ON dbo.regions | ||
177 | ( | ||
178 | regionHandle | ||
179 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
180 | |||
181 | CREATE NONCLUSTERED INDEX IX_regions_override ON dbo.regions | ||
182 | ( | ||
183 | eastOverrideHandle, | ||
184 | westOverrideHandle, | ||
185 | southOverrideHandle, | ||
186 | northOverrideHandle | ||
187 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
188 | |||
189 | COMMIT | ||
190 | |||
191 | |||
192 | :VERSION 5 | ||
193 | |||
194 | BEGIN TRANSACTION | ||
195 | |||
196 | ALTER TABLE regions ADD access int default 0; | ||
197 | |||
198 | COMMIT | ||
199 | |||
200 | |||
201 | :VERSION 6 | ||
202 | |||
203 | BEGIN TRANSACTION | ||
204 | |||
205 | ALTER TABLE regions ADD scopeid uniqueidentifier default '00000000-0000-0000-0000-000000000000'; | ||
206 | ALTER TABLE regions ADD DEFAULT ('00000000-0000-0000-0000-000000000000') FOR [owner_uuid]; | ||
207 | ALTER TABLE regions ADD sizeX integer not null default 0; | ||
208 | ALTER TABLE regions ADD sizeY integer not null default 0; | ||
209 | |||
210 | COMMIT | ||
211 | |||
212 | |||
213 | :VERSION 7 | ||
214 | |||
215 | BEGIN TRANSACTION | ||
216 | |||
217 | ALTER TABLE regions ADD [flags] integer NOT NULL DEFAULT 0; | ||
218 | CREATE INDEX [flags] ON regions(flags); | ||
219 | ALTER TABLE [regions] ADD [last_seen] integer NOT NULL DEFAULT 0; | ||
220 | ALTER TABLE [regions] ADD [PrincipalID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
221 | ALTER TABLE [regions] ADD [Token] varchar(255) NOT NULL DEFAULT 0; | ||
222 | |||
223 | COMMIT | ||
224 | |||
225 | :VERSION 8 | ||
226 | |||
227 | BEGIN TRANSACTION | ||
228 | ALTER TABLE regions ALTER COLUMN regionName VarChar(128) | ||
229 | |||
230 | DROP INDEX IX_regions_name ON dbo.regions | ||
231 | ALTER TABLE regions ALTER COLUMN regionName VarChar(128) null | ||
232 | |||
233 | CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions | ||
234 | ( | ||
235 | regionName | ||
236 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
237 | |||
238 | COMMIT | ||
239 | |||
240 | :VERSION 9 | ||
241 | |||
242 | BEGIN TRANSACTION | ||
243 | ALTER TABLE regions ADD parcelMapTexture uniqueidentifier NULL; | ||
244 | |||
245 | COMMIT | ||
diff --git a/OpenSim/Data/MSSQL/Resources/GridUserStore.migrations b/OpenSim/Data/MSSQL/Resources/GridUserStore.migrations deleted file mode 100644 index ecd3f4d..0000000 --- a/OpenSim/Data/MSSQL/Resources/GridUserStore.migrations +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | :VERSION 1 # -------------------------- | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE "GridUser" ( | ||
6 | "UserID" VARCHAR(255) NOT NULL, | ||
7 | "HomeRegionID" CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
8 | "HomePosition" CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
9 | "HomeLookAt" CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
10 | "LastRegionID" CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
11 | "LastPosition" CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
12 | "LastLookAt" CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
13 | "Online" CHAR(5) NOT NULL DEFAULT 'false', | ||
14 | "Login" CHAR(16) NOT NULL DEFAULT '0', | ||
15 | "Logout" CHAR(16) NOT NULL DEFAULT '0', | ||
16 | PRIMARY KEY ("UserID") | ||
17 | ) | ||
18 | |||
19 | COMMIT | ||
20 | |||
21 | :VERSION 2 # -------------------------- | ||
22 | |||
23 | BEGIN TRANSACTION | ||
24 | |||
25 | CREATE TABLE [GridUser_tmp] ( | ||
26 | [UserID] VARCHAR(255) NOT NULL, | ||
27 | [HomeRegionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
28 | [HomePosition] CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
29 | [HomeLookAt] CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
30 | [LastRegionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
31 | [LastPosition] CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
32 | [LastLookAt] CHAR(64) NOT NULL DEFAULT '<0,0,0>', | ||
33 | [Online] CHAR(5) NOT NULL DEFAULT 'false', | ||
34 | [Login] CHAR(16) NOT NULL DEFAULT '0', | ||
35 | [Logout] CHAR(16) NOT NULL DEFAULT '0', | ||
36 | |||
37 | PRIMARY KEY CLUSTERED | ||
38 | ( | ||
39 | [UserID] ASC | ||
40 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
41 | ) ON [PRIMARY] | ||
42 | |||
43 | COMMIT | ||
44 | |||
45 | IF EXISTS(SELECT * FROM dbo.GridUser) | ||
46 | EXEC('INSERT INTO dbo.GridUser_tmp ([UserID] | ||
47 | ,[HomeRegionID] | ||
48 | ,[HomePosition] | ||
49 | ,[HomeLookAt] | ||
50 | ,[LastRegionID] | ||
51 | ,[LastPosition] | ||
52 | ,[LastLookAt] | ||
53 | ,[Online] | ||
54 | ,[Login] | ||
55 | ,[Logout]) | ||
56 | SELECT CONVERT(varchar(36), [HomeRegionID]), [HomePosition] ,[HomeLookAt] , CONVERT(varchar(36),[LastRegionID]) | ||
57 | ,[LastPosition] | ||
58 | ,[LastLookAt] | ||
59 | ,[Online] | ||
60 | ,[Login] | ||
61 | ,[Logout] FROM dbo.GridUser WITH (HOLDLOCK TABLOCKX)') | ||
62 | |||
63 | DROP TABLE dbo.GridUser | ||
64 | |||
65 | EXECUTE sp_rename N'dbo.GridUser_tmp', N'GridUser', 'OBJECT' \ No newline at end of file | ||
diff --git a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations b/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations deleted file mode 100644 index 4e43653..0000000 --- a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations +++ /dev/null | |||
@@ -1,279 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [inventoryfolders] ( | ||
6 | [folderID] [varchar](36) NOT NULL default '', | ||
7 | [agentID] [varchar](36) default NULL, | ||
8 | [parentFolderID] [varchar](36) default NULL, | ||
9 | [folderName] [varchar](64) default NULL, | ||
10 | [type] [smallint] NOT NULL default 0, | ||
11 | [version] [int] NOT NULL default 0, | ||
12 | PRIMARY KEY CLUSTERED | ||
13 | ( | ||
14 | [folderID] ASC | ||
15 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
16 | ) ON [PRIMARY] | ||
17 | |||
18 | CREATE NONCLUSTERED INDEX [owner] ON [inventoryfolders] | ||
19 | ( | ||
20 | [agentID] ASC | ||
21 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
22 | |||
23 | CREATE NONCLUSTERED INDEX [parent] ON [inventoryfolders] | ||
24 | ( | ||
25 | [parentFolderID] ASC | ||
26 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
27 | |||
28 | |||
29 | CREATE TABLE [inventoryitems] ( | ||
30 | [inventoryID] [varchar](36) NOT NULL default '', | ||
31 | [assetID] [varchar](36) default NULL, | ||
32 | [assetType] [int] default NULL, | ||
33 | [parentFolderID] [varchar](36) default NULL, | ||
34 | [avatarID] [varchar](36) default NULL, | ||
35 | [inventoryName] [varchar](64) default NULL, | ||
36 | [inventoryDescription] [varchar](128) default NULL, | ||
37 | [inventoryNextPermissions] [int] default NULL, | ||
38 | [inventoryCurrentPermissions] [int] default NULL, | ||
39 | [invType] [int] default NULL, | ||
40 | [creatorID] [varchar](36) default NULL, | ||
41 | [inventoryBasePermissions] [int] NOT NULL default 0, | ||
42 | [inventoryEveryOnePermissions] [int] NOT NULL default 0, | ||
43 | [salePrice] [int] default NULL, | ||
44 | [saleType] [tinyint] default NULL, | ||
45 | [creationDate] [int] default NULL, | ||
46 | [groupID] [varchar](36) default NULL, | ||
47 | [groupOwned] [bit] default NULL, | ||
48 | [flags] [int] default NULL, | ||
49 | PRIMARY KEY CLUSTERED | ||
50 | ( | ||
51 | [inventoryID] ASC | ||
52 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
53 | ) ON [PRIMARY] | ||
54 | |||
55 | |||
56 | CREATE NONCLUSTERED INDEX [owner] ON [inventoryitems] | ||
57 | ( | ||
58 | [avatarID] ASC | ||
59 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
60 | |||
61 | CREATE NONCLUSTERED INDEX [folder] ON [inventoryitems] | ||
62 | ( | ||
63 | [parentFolderID] ASC | ||
64 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
65 | |||
66 | COMMIT | ||
67 | |||
68 | |||
69 | :VERSION 2 | ||
70 | |||
71 | BEGIN TRANSACTION | ||
72 | |||
73 | ALTER TABLE inventoryitems ADD inventoryGroupPermissions INTEGER NOT NULL default 0 | ||
74 | |||
75 | COMMIT | ||
76 | |||
77 | :VERSION 3 | ||
78 | |||
79 | /* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/ | ||
80 | BEGIN TRANSACTION | ||
81 | |||
82 | CREATE TABLE dbo.Tmp_inventoryfolders | ||
83 | ( | ||
84 | folderID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
85 | agentID uniqueidentifier NULL DEFAULT (NULL), | ||
86 | parentFolderID uniqueidentifier NULL DEFAULT (NULL), | ||
87 | folderName varchar(64) NULL DEFAULT (NULL), | ||
88 | type smallint NOT NULL DEFAULT ((0)), | ||
89 | version int NOT NULL DEFAULT ((0)) | ||
90 | ) ON [PRIMARY] | ||
91 | |||
92 | IF EXISTS(SELECT * FROM dbo.inventoryfolders) | ||
93 | EXEC('INSERT INTO dbo.Tmp_inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) | ||
94 | SELECT CONVERT(uniqueidentifier, folderID), CONVERT(uniqueidentifier, agentID), CONVERT(uniqueidentifier, parentFolderID), folderName, type, version FROM dbo.inventoryfolders WITH (HOLDLOCK TABLOCKX)') | ||
95 | |||
96 | DROP TABLE dbo.inventoryfolders | ||
97 | |||
98 | EXECUTE sp_rename N'dbo.Tmp_inventoryfolders', N'inventoryfolders', 'OBJECT' | ||
99 | |||
100 | ALTER TABLE dbo.inventoryfolders ADD CONSTRAINT | ||
101 | PK__inventor__C2FABFB3173876EA PRIMARY KEY CLUSTERED | ||
102 | ( | ||
103 | folderID | ||
104 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
105 | |||
106 | CREATE NONCLUSTERED INDEX owner ON dbo.inventoryfolders | ||
107 | ( | ||
108 | agentID | ||
109 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
110 | |||
111 | CREATE NONCLUSTERED INDEX parent ON dbo.inventoryfolders | ||
112 | ( | ||
113 | parentFolderID | ||
114 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
115 | |||
116 | COMMIT | ||
117 | |||
118 | |||
119 | :VERSION 4 | ||
120 | |||
121 | BEGIN TRANSACTION | ||
122 | |||
123 | CREATE TABLE dbo.Tmp_inventoryitems | ||
124 | ( | ||
125 | inventoryID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
126 | assetID uniqueidentifier NULL DEFAULT (NULL), | ||
127 | assetType int NULL DEFAULT (NULL), | ||
128 | parentFolderID uniqueidentifier NULL DEFAULT (NULL), | ||
129 | avatarID uniqueidentifier NULL DEFAULT (NULL), | ||
130 | inventoryName varchar(64) NULL DEFAULT (NULL), | ||
131 | inventoryDescription varchar(128) NULL DEFAULT (NULL), | ||
132 | inventoryNextPermissions int NULL DEFAULT (NULL), | ||
133 | inventoryCurrentPermissions int NULL DEFAULT (NULL), | ||
134 | invType int NULL DEFAULT (NULL), | ||
135 | creatorID uniqueidentifier NULL DEFAULT (NULL), | ||
136 | inventoryBasePermissions int NOT NULL DEFAULT ((0)), | ||
137 | inventoryEveryOnePermissions int NOT NULL DEFAULT ((0)), | ||
138 | salePrice int NULL DEFAULT (NULL), | ||
139 | saleType tinyint NULL DEFAULT (NULL), | ||
140 | creationDate int NULL DEFAULT (NULL), | ||
141 | groupID uniqueidentifier NULL DEFAULT (NULL), | ||
142 | groupOwned bit NULL DEFAULT (NULL), | ||
143 | flags int NULL DEFAULT (NULL), | ||
144 | inventoryGroupPermissions int NOT NULL DEFAULT ((0)) | ||
145 | ) ON [PRIMARY] | ||
146 | |||
147 | IF EXISTS(SELECT * FROM dbo.inventoryitems) | ||
148 | EXEC('INSERT INTO dbo.Tmp_inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryGroupPermissions) | ||
149 | SELECT CONVERT(uniqueidentifier, inventoryID), CONVERT(uniqueidentifier, assetID), assetType, CONVERT(uniqueidentifier, parentFolderID), CONVERT(uniqueidentifier, avatarID), inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, CONVERT(uniqueidentifier, creatorID), inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, CONVERT(uniqueidentifier, groupID), groupOwned, flags, inventoryGroupPermissions FROM dbo.inventoryitems WITH (HOLDLOCK TABLOCKX)') | ||
150 | |||
151 | DROP TABLE dbo.inventoryitems | ||
152 | |||
153 | EXECUTE sp_rename N'dbo.Tmp_inventoryitems', N'inventoryitems', 'OBJECT' | ||
154 | |||
155 | ALTER TABLE dbo.inventoryitems ADD CONSTRAINT | ||
156 | PK__inventor__C4B7BC2220C1E124 PRIMARY KEY CLUSTERED | ||
157 | ( | ||
158 | inventoryID | ||
159 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
160 | |||
161 | |||
162 | CREATE NONCLUSTERED INDEX owner ON dbo.inventoryitems | ||
163 | ( | ||
164 | avatarID | ||
165 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
166 | |||
167 | CREATE NONCLUSTERED INDEX folder ON dbo.inventoryitems | ||
168 | ( | ||
169 | parentFolderID | ||
170 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
171 | |||
172 | COMMIT | ||
173 | |||
174 | :VERSION 5 | ||
175 | |||
176 | # It would be totally crazy to have to recreate the whole table just to change one column type, | ||
177 | # just because MS SQL treats each DEFAULT as a constraint object that must be dropped | ||
178 | # before anything can be done to the column. Since all defaults here are unnamed, there is | ||
179 | # no easy way to drop them! The hairy piece of code below removes all DEFAULT constraints | ||
180 | # from InventoryItems. | ||
181 | |||
182 | # SO: anything that's NULLable is by default NULL, so please don't declare DEFAULT(NULL), | ||
183 | # they do nothing but prevent changes to the columns. If you really | ||
184 | # need to have DEFAULTs or other constraints, give them names so they can be dropped when needed! | ||
185 | |||
186 | BEGIN TRANSACTION | ||
187 | DECLARE @nm varchar(80); | ||
188 | DECLARE x CURSOR LOCAL FORWARD_ONLY READ_ONLY | ||
189 | FOR SELECT name FROM sys.default_constraints where parent_object_id = OBJECT_ID('inventoryitems'); | ||
190 | OPEN x; | ||
191 | FETCH NEXT FROM x INTO @nm; | ||
192 | WHILE @@FETCH_STATUS = 0 | ||
193 | BEGIN | ||
194 | EXEC('alter table inventoryitems drop ' + @nm); | ||
195 | FETCH NEXT FROM x INTO @nm; | ||
196 | END | ||
197 | CLOSE x | ||
198 | DEALLOCATE x | ||
199 | COMMIT | ||
200 | |||
201 | # all DEFAULTs dropped! | ||
202 | |||
203 | :GO | ||
204 | |||
205 | BEGIN TRANSACTION | ||
206 | |||
207 | # Restoring defaults: | ||
208 | # NOTE: [inventoryID] does NOT need one: it's NOT NULL PK and a unique Guid must be provided every time anyway! | ||
209 | |||
210 | alter table inventoryitems | ||
211 | add constraint def_baseperm default 0 for inventoryBasePermissions | ||
212 | alter table inventoryitems | ||
213 | add constraint def_allperm default 0 for inventoryEveryOnePermissions | ||
214 | alter table inventoryitems | ||
215 | add constraint def_grpperm default 0 for inventoryGroupPermissions | ||
216 | |||
217 | COMMIT | ||
218 | |||
219 | :VERSION 7 | ||
220 | |||
221 | BEGIN TRANSACTION | ||
222 | |||
223 | # CreatorID goes back to VARCHAR(36) (???) | ||
224 | |||
225 | exec sp_rename 'inventoryitems.CreatorID', 'cr_old', 'COLUMN' | ||
226 | |||
227 | :GO | ||
228 | |||
229 | alter table inventoryitems | ||
230 | add creatorID varchar(36) NULL | ||
231 | |||
232 | :GO | ||
233 | |||
234 | update inventoryitems set creatorID = CONVERT(VARCHAR(36), cr_old) | ||
235 | |||
236 | alter table inventoryitems | ||
237 | drop column cr_old | ||
238 | |||
239 | COMMIT | ||
240 | |||
241 | :VERSION 8 | ||
242 | |||
243 | ALTER TABLE inventoryitems | ||
244 | ADD CONSTRAINT DF_inventoryitems_creatorID | ||
245 | DEFAULT '00000000-0000-0000-0000-000000000000' FOR creatorID | ||
246 | |||
247 | :GO | ||
248 | |||
249 | :VERSION 9 | ||
250 | |||
251 | BEGIN TRANSACTION | ||
252 | |||
253 | # CreatorID goes up to VARCHAR(255) | ||
254 | |||
255 | exec sp_rename 'inventoryitems.CreatorID', 'cr_old', 'COLUMN' | ||
256 | |||
257 | :GO | ||
258 | |||
259 | alter table inventoryitems | ||
260 | add creatorID varchar(255) NULL | ||
261 | |||
262 | :GO | ||
263 | |||
264 | update inventoryitems set creatorID = cr_old | ||
265 | |||
266 | alter table inventoryitems | ||
267 | drop CONSTRAINT DF_inventoryitems_creatorID | ||
268 | :GO | ||
269 | |||
270 | alter table inventoryitems | ||
271 | drop column cr_old | ||
272 | :GO | ||
273 | COMMIT | ||
274 | |||
275 | ALTER TABLE inventoryitems | ||
276 | ADD CONSTRAINT DF_inventoryitems_creatorID | ||
277 | DEFAULT '00000000-0000-0000-0000-000000000000' FOR creatorID | ||
278 | |||
279 | :GO \ No newline at end of file | ||
diff --git a/OpenSim/Data/MSSQL/Resources/LogStore.migrations b/OpenSim/Data/MSSQL/Resources/LogStore.migrations deleted file mode 100644 index 1430d8d..0000000 --- a/OpenSim/Data/MSSQL/Resources/LogStore.migrations +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [logs] ( | ||
6 | [logID] [int] NOT NULL, | ||
7 | [target] [varchar](36) default NULL, | ||
8 | [server] [varchar](64) default NULL, | ||
9 | [method] [varchar](64) default NULL, | ||
10 | [arguments] [varchar](255) default NULL, | ||
11 | [priority] [int] default NULL, | ||
12 | [message] [ntext], | ||
13 | PRIMARY KEY CLUSTERED | ||
14 | ( | ||
15 | [logID] ASC | ||
16 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
17 | ) ON [PRIMARY] | ||
18 | |||
19 | COMMIT | ||
diff --git a/OpenSim/Data/MSSQL/Resources/Presence.migrations b/OpenSim/Data/MSSQL/Resources/Presence.migrations deleted file mode 100644 index f84275d..0000000 --- a/OpenSim/Data/MSSQL/Resources/Presence.migrations +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION | ||
4 | |||
5 | CREATE TABLE [Presence] ( | ||
6 | [UserID] varchar(255) NOT NULL, | ||
7 | [RegionID] uniqueidentifier NOT NULL, | ||
8 | [SessionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
9 | [SecureSessionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
10 | |||
11 | ) | ||
12 | ON [PRIMARY] | ||
13 | |||
14 | COMMIT | ||
15 | |||
16 | :VERSION 2 | ||
17 | |||
18 | BEGIN TRANSACTION | ||
19 | |||
20 | CREATE UNIQUE INDEX SessionID ON Presence(SessionID); | ||
21 | CREATE INDEX UserID ON Presence(UserID); | ||
22 | |||
23 | COMMIT | ||
24 | |||
25 | :VERSION 2 | ||
26 | |||
27 | BEGIN TRANSACTION | ||
28 | |||
29 | ALTER TABLE Presence ADD LastSeen DateTime; | ||
30 | |||
31 | COMMIT | ||
32 | |||
33 | :VERSION 3 | ||
34 | |||
35 | BEGIN TRANSACTION | ||
36 | |||
37 | CREATE INDEX RegionID ON Presence(RegionID); | ||
38 | |||
39 | COMMIT | ||
diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations deleted file mode 100644 index 46b1988..0000000 --- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations +++ /dev/null | |||
@@ -1,1182 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | CREATE TABLE [dbo].[prims]( | ||
4 | [UUID] [varchar](255) NOT NULL, | ||
5 | [RegionUUID] [varchar](255) NULL, | ||
6 | [ParentID] [int] NULL, | ||
7 | [CreationDate] [int] NULL, | ||
8 | [Name] [varchar](255) NULL, | ||
9 | [SceneGroupID] [varchar](255) NULL, | ||
10 | [Text] [varchar](255) NULL, | ||
11 | [Description] [varchar](255) NULL, | ||
12 | [SitName] [varchar](255) NULL, | ||
13 | [TouchName] [varchar](255) NULL, | ||
14 | [ObjectFlags] [int] NULL, | ||
15 | [CreatorID] [varchar](255) NULL, | ||
16 | [OwnerID] [varchar](255) NULL, | ||
17 | [GroupID] [varchar](255) NULL, | ||
18 | [LastOwnerID] [varchar](255) NULL, | ||
19 | [OwnerMask] [int] NULL, | ||
20 | [NextOwnerMask] [int] NULL, | ||
21 | [GroupMask] [int] NULL, | ||
22 | [EveryoneMask] [int] NULL, | ||
23 | [BaseMask] [int] NULL, | ||
24 | [PositionX] [float] NULL, | ||
25 | [PositionY] [float] NULL, | ||
26 | [PositionZ] [float] NULL, | ||
27 | [GroupPositionX] [float] NULL, | ||
28 | [GroupPositionY] [float] NULL, | ||
29 | [GroupPositionZ] [float] NULL, | ||
30 | [VelocityX] [float] NULL, | ||
31 | [VelocityY] [float] NULL, | ||
32 | [VelocityZ] [float] NULL, | ||
33 | [AngularVelocityX] [float] NULL, | ||
34 | [AngularVelocityY] [float] NULL, | ||
35 | [AngularVelocityZ] [float] NULL, | ||
36 | [AccelerationX] [float] NULL, | ||
37 | [AccelerationY] [float] NULL, | ||
38 | [AccelerationZ] [float] NULL, | ||
39 | [RotationX] [float] NULL, | ||
40 | [RotationY] [float] NULL, | ||
41 | [RotationZ] [float] NULL, | ||
42 | [RotationW] [float] NULL, | ||
43 | [SitTargetOffsetX] [float] NULL, | ||
44 | [SitTargetOffsetY] [float] NULL, | ||
45 | [SitTargetOffsetZ] [float] NULL, | ||
46 | [SitTargetOrientW] [float] NULL, | ||
47 | [SitTargetOrientX] [float] NULL, | ||
48 | [SitTargetOrientY] [float] NULL, | ||
49 | [SitTargetOrientZ] [float] NULL, | ||
50 | PRIMARY KEY CLUSTERED | ||
51 | ( | ||
52 | [UUID] ASC | ||
53 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
54 | ) ON [PRIMARY] | ||
55 | |||
56 | CREATE TABLE [dbo].[primshapes]( | ||
57 | [UUID] [varchar](255) NOT NULL, | ||
58 | [Shape] [int] NULL, | ||
59 | [ScaleX] [float] NULL, | ||
60 | [ScaleY] [float] NULL, | ||
61 | [ScaleZ] [float] NULL, | ||
62 | [PCode] [int] NULL, | ||
63 | [PathBegin] [int] NULL, | ||
64 | [PathEnd] [int] NULL, | ||
65 | [PathScaleX] [int] NULL, | ||
66 | [PathScaleY] [int] NULL, | ||
67 | [PathShearX] [int] NULL, | ||
68 | [PathShearY] [int] NULL, | ||
69 | [PathSkew] [int] NULL, | ||
70 | [PathCurve] [int] NULL, | ||
71 | [PathRadiusOffset] [int] NULL, | ||
72 | [PathRevolutions] [int] NULL, | ||
73 | [PathTaperX] [int] NULL, | ||
74 | [PathTaperY] [int] NULL, | ||
75 | [PathTwist] [int] NULL, | ||
76 | [PathTwistBegin] [int] NULL, | ||
77 | [ProfileBegin] [int] NULL, | ||
78 | [ProfileEnd] [int] NULL, | ||
79 | [ProfileCurve] [int] NULL, | ||
80 | [ProfileHollow] [int] NULL, | ||
81 | [State] [int] NULL, | ||
82 | [Texture] [image] NULL, | ||
83 | [ExtraParams] [image] NULL, | ||
84 | PRIMARY KEY CLUSTERED | ||
85 | ( | ||
86 | [UUID] ASC | ||
87 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
88 | ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] | ||
89 | |||
90 | CREATE TABLE [dbo].[primitems]( | ||
91 | [itemID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
92 | [primID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
93 | [assetID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
94 | [parentFolderID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
95 | [invType] [int] NULL, | ||
96 | [assetType] [int] NULL, | ||
97 | [name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
98 | [description] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
99 | [creationDate] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
100 | [creatorID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
101 | [ownerID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
102 | [lastOwnerID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
103 | [groupID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
104 | [nextPermissions] [int] NULL, | ||
105 | [currentPermissions] [int] NULL, | ||
106 | [basePermissions] [int] NULL, | ||
107 | [everyonePermissions] [int] NULL, | ||
108 | [groupPermissions] [int] NULL, | ||
109 | PRIMARY KEY CLUSTERED | ||
110 | ( | ||
111 | [itemID] ASC | ||
112 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
113 | ) ON [PRIMARY] | ||
114 | |||
115 | CREATE TABLE [dbo].[terrain]( | ||
116 | [RegionUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
117 | [Revision] [int] NULL, | ||
118 | [Heightfield] [image] NULL | ||
119 | ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] | ||
120 | |||
121 | CREATE TABLE [dbo].[land]( | ||
122 | [UUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
123 | [RegionUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
124 | [LocalLandID] [int] NULL, | ||
125 | [Bitmap] [image] NULL, | ||
126 | [Name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
127 | [Description] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
128 | [OwnerUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
129 | [IsGroupOwned] [int] NULL, | ||
130 | [Area] [int] NULL, | ||
131 | [AuctionID] [int] NULL, | ||
132 | [Category] [int] NULL, | ||
133 | [ClaimDate] [int] NULL, | ||
134 | [ClaimPrice] [int] NULL, | ||
135 | [GroupUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
136 | [SalePrice] [int] NULL, | ||
137 | [LandStatus] [int] NULL, | ||
138 | [LandFlags] [int] NULL, | ||
139 | [LandingType] [int] NULL, | ||
140 | [MediaAutoScale] [int] NULL, | ||
141 | [MediaTextureUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
142 | [MediaURL] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
143 | [MusicURL] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
144 | [PassHours] [float] NULL, | ||
145 | [PassPrice] [int] NULL, | ||
146 | [SnapshotUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
147 | [UserLocationX] [float] NULL, | ||
148 | [UserLocationY] [float] NULL, | ||
149 | [UserLocationZ] [float] NULL, | ||
150 | [UserLookAtX] [float] NULL, | ||
151 | [UserLookAtY] [float] NULL, | ||
152 | [UserLookAtZ] [float] NULL, | ||
153 | PRIMARY KEY CLUSTERED | ||
154 | ( | ||
155 | [UUID] ASC | ||
156 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
157 | ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] | ||
158 | |||
159 | CREATE TABLE [dbo].[landaccesslist]( | ||
160 | [LandUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
161 | [AccessUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
162 | [Flags] [int] NULL | ||
163 | ) ON [PRIMARY] | ||
164 | |||
165 | :VERSION 2 | ||
166 | |||
167 | BEGIN TRANSACTION | ||
168 | |||
169 | CREATE TABLE regionban ( | ||
170 | [regionUUID] VARCHAR(36) NOT NULL, | ||
171 | [bannedUUID] VARCHAR(36) NOT NULL, | ||
172 | [bannedIp] VARCHAR(16) NOT NULL, | ||
173 | [bannedIpHostMask] VARCHAR(16) NOT NULL) | ||
174 | |||
175 | create table [dbo].[regionsettings] ( | ||
176 | [regionUUID] [varchar](36) not null, | ||
177 | [block_terraform] [bit] not null, | ||
178 | [block_fly] [bit] not null, | ||
179 | [allow_damage] [bit] not null, | ||
180 | [restrict_pushing] [bit] not null, | ||
181 | [allow_land_resell] [bit] not null, | ||
182 | [allow_land_join_divide] [bit] not null, | ||
183 | [block_show_in_search] [bit] not null, | ||
184 | [agent_limit] [int] not null, | ||
185 | [object_bonus] [float] not null, | ||
186 | [maturity] [int] not null, | ||
187 | [disable_scripts] [bit] not null, | ||
188 | [disable_collisions] [bit] not null, | ||
189 | [disable_physics] [bit] not null, | ||
190 | [terrain_texture_1] [varchar](36) not null, | ||
191 | [terrain_texture_2] [varchar](36) not null, | ||
192 | [terrain_texture_3] [varchar](36) not null, | ||
193 | [terrain_texture_4] [varchar](36) not null, | ||
194 | [elevation_1_nw] [float] not null, | ||
195 | [elevation_2_nw] [float] not null, | ||
196 | [elevation_1_ne] [float] not null, | ||
197 | [elevation_2_ne] [float] not null, | ||
198 | [elevation_1_se] [float] not null, | ||
199 | [elevation_2_se] [float] not null, | ||
200 | [elevation_1_sw] [float] not null, | ||
201 | [elevation_2_sw] [float] not null, | ||
202 | [water_height] [float] not null, | ||
203 | [terrain_raise_limit] [float] not null, | ||
204 | [terrain_lower_limit] [float] not null, | ||
205 | [use_estate_sun] [bit] not null, | ||
206 | [fixed_sun] [bit] not null, | ||
207 | [sun_position] [float] not null, | ||
208 | [covenant] [varchar](36) default NULL, | ||
209 | [Sandbox] [bit] NOT NULL, | ||
210 | PRIMARY KEY CLUSTERED | ||
211 | ( | ||
212 | [regionUUID] ASC | ||
213 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
214 | ) ON [PRIMARY] | ||
215 | |||
216 | COMMIT | ||
217 | |||
218 | :VERSION 3 | ||
219 | |||
220 | BEGIN TRANSACTION | ||
221 | |||
222 | CREATE TABLE dbo.Tmp_prims | ||
223 | ( | ||
224 | UUID varchar(36) NOT NULL, | ||
225 | RegionUUID varchar(36) NULL, | ||
226 | ParentID int NULL, | ||
227 | CreationDate int NULL, | ||
228 | Name varchar(255) NULL, | ||
229 | SceneGroupID varchar(36) NULL, | ||
230 | Text varchar(255) NULL, | ||
231 | Description varchar(255) NULL, | ||
232 | SitName varchar(255) NULL, | ||
233 | TouchName varchar(255) NULL, | ||
234 | ObjectFlags int NULL, | ||
235 | CreatorID varchar(36) NULL, | ||
236 | OwnerID varchar(36) NULL, | ||
237 | GroupID varchar(36) NULL, | ||
238 | LastOwnerID varchar(36) NULL, | ||
239 | OwnerMask int NULL, | ||
240 | NextOwnerMask int NULL, | ||
241 | GroupMask int NULL, | ||
242 | EveryoneMask int NULL, | ||
243 | BaseMask int NULL, | ||
244 | PositionX float(53) NULL, | ||
245 | PositionY float(53) NULL, | ||
246 | PositionZ float(53) NULL, | ||
247 | GroupPositionX float(53) NULL, | ||
248 | GroupPositionY float(53) NULL, | ||
249 | GroupPositionZ float(53) NULL, | ||
250 | VelocityX float(53) NULL, | ||
251 | VelocityY float(53) NULL, | ||
252 | VelocityZ float(53) NULL, | ||
253 | AngularVelocityX float(53) NULL, | ||
254 | AngularVelocityY float(53) NULL, | ||
255 | AngularVelocityZ float(53) NULL, | ||
256 | AccelerationX float(53) NULL, | ||
257 | AccelerationY float(53) NULL, | ||
258 | AccelerationZ float(53) NULL, | ||
259 | RotationX float(53) NULL, | ||
260 | RotationY float(53) NULL, | ||
261 | RotationZ float(53) NULL, | ||
262 | RotationW float(53) NULL, | ||
263 | SitTargetOffsetX float(53) NULL, | ||
264 | SitTargetOffsetY float(53) NULL, | ||
265 | SitTargetOffsetZ float(53) NULL, | ||
266 | SitTargetOrientW float(53) NULL, | ||
267 | SitTargetOrientX float(53) NULL, | ||
268 | SitTargetOrientY float(53) NULL, | ||
269 | SitTargetOrientZ float(53) NULL | ||
270 | ) ON [PRIMARY] | ||
271 | |||
272 | IF EXISTS(SELECT * FROM dbo.prims) | ||
273 | EXEC('INSERT INTO dbo.Tmp_prims (UUID, RegionUUID, ParentID, CreationDate, Name, SceneGroupID, Text, Description, SitName, TouchName, ObjectFlags, CreatorID, OwnerID, GroupID, LastOwnerID, OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ) | ||
274 | SELECT CONVERT(varchar(36), UUID), CONVERT(varchar(36), RegionUUID), ParentID, CreationDate, Name, CONVERT(varchar(36), SceneGroupID), Text, Description, SitName, TouchName, ObjectFlags, CONVERT(varchar(36), CreatorID), CONVERT(varchar(36), OwnerID), CONVERT(varchar(36), GroupID), CONVERT(varchar(36), LastOwnerID), OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ FROM dbo.prims WITH (HOLDLOCK TABLOCKX)') | ||
275 | |||
276 | DROP TABLE dbo.prims | ||
277 | |||
278 | EXECUTE sp_rename N'dbo.Tmp_prims', N'prims', 'OBJECT' | ||
279 | |||
280 | ALTER TABLE dbo.prims ADD CONSTRAINT | ||
281 | PK__prims__10566F31 PRIMARY KEY CLUSTERED | ||
282 | ( | ||
283 | UUID | ||
284 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
285 | |||
286 | COMMIT | ||
287 | |||
288 | :VERSION 4 | ||
289 | |||
290 | BEGIN TRANSACTION | ||
291 | |||
292 | CREATE TABLE Tmp_primitems | ||
293 | ( | ||
294 | itemID varchar(36) NOT NULL, | ||
295 | primID varchar(36) NULL, | ||
296 | assetID varchar(36) NULL, | ||
297 | parentFolderID varchar(36) NULL, | ||
298 | invType int NULL, | ||
299 | assetType int NULL, | ||
300 | name varchar(255) NULL, | ||
301 | description varchar(255) NULL, | ||
302 | creationDate varchar(255) NULL, | ||
303 | creatorID varchar(36) NULL, | ||
304 | ownerID varchar(36) NULL, | ||
305 | lastOwnerID varchar(36) NULL, | ||
306 | groupID varchar(36) NULL, | ||
307 | nextPermissions int NULL, | ||
308 | currentPermissions int NULL, | ||
309 | basePermissions int NULL, | ||
310 | everyonePermissions int NULL, | ||
311 | groupPermissions int NULL | ||
312 | ) ON [PRIMARY] | ||
313 | |||
314 | IF EXISTS(SELECT * FROM primitems) | ||
315 | EXEC('INSERT INTO Tmp_primitems (itemID, primID, assetID, parentFolderID, invType, assetType, name, description, creationDate, creatorID, ownerID, lastOwnerID, groupID, nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions) | ||
316 | SELECT CONVERT(varchar(36), itemID), CONVERT(varchar(36), primID), CONVERT(varchar(36), assetID), CONVERT(varchar(36), parentFolderID), invType, assetType, name, description, creationDate, CONVERT(varchar(36), creatorID), CONVERT(varchar(36), ownerID), CONVERT(varchar(36), lastOwnerID), CONVERT(varchar(36), groupID), nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions') | ||
317 | |||
318 | DROP TABLE primitems | ||
319 | |||
320 | EXECUTE sp_rename N'Tmp_primitems', N'primitems', 'OBJECT' | ||
321 | |||
322 | ALTER TABLE primitems ADD CONSTRAINT | ||
323 | PK__primitems__0A688BB1 PRIMARY KEY CLUSTERED | ||
324 | ( | ||
325 | itemID | ||
326 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
327 | |||
328 | |||
329 | COMMIT | ||
330 | |||
331 | |||
332 | :VERSION 5 | ||
333 | |||
334 | BEGIN TRANSACTION | ||
335 | |||
336 | CREATE TABLE Tmp_primshapes | ||
337 | ( | ||
338 | UUID varchar(36) NOT NULL, | ||
339 | Shape int NULL, | ||
340 | ScaleX float(53) NULL, | ||
341 | ScaleY float(53) NULL, | ||
342 | ScaleZ float(53) NULL, | ||
343 | PCode int NULL, | ||
344 | PathBegin int NULL, | ||
345 | PathEnd int NULL, | ||
346 | PathScaleX int NULL, | ||
347 | PathScaleY int NULL, | ||
348 | PathShearX int NULL, | ||
349 | PathShearY int NULL, | ||
350 | PathSkew int NULL, | ||
351 | PathCurve int NULL, | ||
352 | PathRadiusOffset int NULL, | ||
353 | PathRevolutions int NULL, | ||
354 | PathTaperX int NULL, | ||
355 | PathTaperY int NULL, | ||
356 | PathTwist int NULL, | ||
357 | PathTwistBegin int NULL, | ||
358 | ProfileBegin int NULL, | ||
359 | ProfileEnd int NULL, | ||
360 | ProfileCurve int NULL, | ||
361 | ProfileHollow int NULL, | ||
362 | State int NULL, | ||
363 | Texture image NULL, | ||
364 | ExtraParams image NULL | ||
365 | ) ON [PRIMARY] | ||
366 | TEXTIMAGE_ON [PRIMARY] | ||
367 | |||
368 | IF EXISTS(SELECT * FROM primshapes) | ||
369 | EXEC('INSERT INTO Tmp_primshapes (UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams) | ||
370 | SELECT CONVERT(varchar(36), UUID), Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams FROM primshapes WITH (HOLDLOCK TABLOCKX)') | ||
371 | |||
372 | DROP TABLE primshapes | ||
373 | |||
374 | EXECUTE sp_rename N'Tmp_primshapes', N'primshapes', 'OBJECT' | ||
375 | |||
376 | ALTER TABLE primshapes ADD CONSTRAINT | ||
377 | PK__primshapes__0880433F PRIMARY KEY CLUSTERED | ||
378 | ( | ||
379 | UUID | ||
380 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
381 | |||
382 | COMMIT | ||
383 | |||
384 | |||
385 | :VERSION 6 | ||
386 | |||
387 | BEGIN TRANSACTION | ||
388 | |||
389 | ALTER TABLE prims ADD PayPrice int not null default 0 | ||
390 | ALTER TABLE prims ADD PayButton1 int not null default 0 | ||
391 | ALTER TABLE prims ADD PayButton2 int not null default 0 | ||
392 | ALTER TABLE prims ADD PayButton3 int not null default 0 | ||
393 | ALTER TABLE prims ADD PayButton4 int not null default 0 | ||
394 | ALTER TABLE prims ADD LoopedSound varchar(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
395 | ALTER TABLE prims ADD LoopedSoundGain float not null default 0.0; | ||
396 | ALTER TABLE prims ADD TextureAnimation image | ||
397 | ALTER TABLE prims ADD OmegaX float not null default 0.0 | ||
398 | ALTER TABLE prims ADD OmegaY float not null default 0.0 | ||
399 | ALTER TABLE prims ADD OmegaZ float not null default 0.0 | ||
400 | ALTER TABLE prims ADD CameraEyeOffsetX float not null default 0.0 | ||
401 | ALTER TABLE prims ADD CameraEyeOffsetY float not null default 0.0 | ||
402 | ALTER TABLE prims ADD CameraEyeOffsetZ float not null default 0.0 | ||
403 | ALTER TABLE prims ADD CameraAtOffsetX float not null default 0.0 | ||
404 | ALTER TABLE prims ADD CameraAtOffsetY float not null default 0.0 | ||
405 | ALTER TABLE prims ADD CameraAtOffsetZ float not null default 0.0 | ||
406 | ALTER TABLE prims ADD ForceMouselook tinyint not null default 0 | ||
407 | ALTER TABLE prims ADD ScriptAccessPin int not null default 0 | ||
408 | ALTER TABLE prims ADD AllowedDrop tinyint not null default 0 | ||
409 | ALTER TABLE prims ADD DieAtEdge tinyint not null default 0 | ||
410 | ALTER TABLE prims ADD SalePrice int not null default 10 | ||
411 | ALTER TABLE prims ADD SaleType tinyint not null default 0 | ||
412 | |||
413 | ALTER TABLE primitems add flags integer not null default 0 | ||
414 | |||
415 | ALTER TABLE land ADD AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000' | ||
416 | |||
417 | CREATE index prims_regionuuid on prims(RegionUUID) | ||
418 | CREATE index prims_parentid on prims(ParentID) | ||
419 | |||
420 | CREATE index primitems_primid on primitems(primID) | ||
421 | |||
422 | COMMIT | ||
423 | |||
424 | |||
425 | :VERSION 7 | ||
426 | |||
427 | BEGIN TRANSACTION | ||
428 | |||
429 | ALTER TABLE prims ADD ColorR int not null default 0; | ||
430 | ALTER TABLE prims ADD ColorG int not null default 0; | ||
431 | ALTER TABLE prims ADD ColorB int not null default 0; | ||
432 | ALTER TABLE prims ADD ColorA int not null default 0; | ||
433 | ALTER TABLE prims ADD ParticleSystem IMAGE; | ||
434 | ALTER TABLE prims ADD ClickAction tinyint NOT NULL default 0; | ||
435 | |||
436 | COMMIT | ||
437 | |||
438 | |||
439 | :VERSION 8 | ||
440 | |||
441 | BEGIN TRANSACTION | ||
442 | |||
443 | ALTER TABLE land ADD OtherCleanTime integer NOT NULL default 0; | ||
444 | ALTER TABLE land ADD Dwell integer NOT NULL default 0; | ||
445 | |||
446 | COMMIT | ||
447 | |||
448 | :VERSION 9 | ||
449 | |||
450 | BEGIN TRANSACTION | ||
451 | |||
452 | ALTER TABLE prims ADD Material tinyint NOT NULL default 3 | ||
453 | |||
454 | COMMIT | ||
455 | |||
456 | |||
457 | :VERSION 10 | ||
458 | |||
459 | BEGIN TRANSACTION | ||
460 | |||
461 | ALTER TABLE regionsettings ADD sunvectorx float NOT NULL default 0; | ||
462 | ALTER TABLE regionsettings ADD sunvectory float NOT NULL default 0; | ||
463 | ALTER TABLE regionsettings ADD sunvectorz float NOT NULL default 0; | ||
464 | |||
465 | COMMIT | ||
466 | |||
467 | |||
468 | :VERSION 11 | ||
469 | |||
470 | BEGIN TRANSACTION | ||
471 | |||
472 | ALTER TABLE prims ADD CollisionSound char(36) not null default '00000000-0000-0000-0000-000000000000' | ||
473 | ALTER TABLE prims ADD CollisionSoundVolume float not null default 0.0 | ||
474 | |||
475 | COMMIT | ||
476 | |||
477 | |||
478 | :VERSION 12 | ||
479 | |||
480 | BEGIN TRANSACTION | ||
481 | |||
482 | ALTER TABLE prims ADD LinkNumber integer not null default 0 | ||
483 | |||
484 | COMMIT | ||
485 | |||
486 | |||
487 | :VERSION 13 | ||
488 | |||
489 | BEGIN TRANSACTION | ||
490 | |||
491 | CREATE TABLE dbo.Tmp_prims | ||
492 | ( | ||
493 | UUID uniqueidentifier NOT NULL, | ||
494 | RegionUUID uniqueidentifier NULL, | ||
495 | ParentID int NULL, | ||
496 | CreationDate int NULL, | ||
497 | Name varchar(255) NULL, | ||
498 | SceneGroupID uniqueidentifier NULL, | ||
499 | Text varchar(255) NULL, | ||
500 | Description varchar(255) NULL, | ||
501 | SitName varchar(255) NULL, | ||
502 | TouchName varchar(255) NULL, | ||
503 | ObjectFlags int NULL, | ||
504 | CreatorID uniqueidentifier NULL, | ||
505 | OwnerID uniqueidentifier NULL, | ||
506 | GroupID uniqueidentifier NULL, | ||
507 | LastOwnerID uniqueidentifier NULL, | ||
508 | OwnerMask int NULL, | ||
509 | NextOwnerMask int NULL, | ||
510 | GroupMask int NULL, | ||
511 | EveryoneMask int NULL, | ||
512 | BaseMask int NULL, | ||
513 | PositionX float(53) NULL, | ||
514 | PositionY float(53) NULL, | ||
515 | PositionZ float(53) NULL, | ||
516 | GroupPositionX float(53) NULL, | ||
517 | GroupPositionY float(53) NULL, | ||
518 | GroupPositionZ float(53) NULL, | ||
519 | VelocityX float(53) NULL, | ||
520 | VelocityY float(53) NULL, | ||
521 | VelocityZ float(53) NULL, | ||
522 | AngularVelocityX float(53) NULL, | ||
523 | AngularVelocityY float(53) NULL, | ||
524 | AngularVelocityZ float(53) NULL, | ||
525 | AccelerationX float(53) NULL, | ||
526 | AccelerationY float(53) NULL, | ||
527 | AccelerationZ float(53) NULL, | ||
528 | RotationX float(53) NULL, | ||
529 | RotationY float(53) NULL, | ||
530 | RotationZ float(53) NULL, | ||
531 | RotationW float(53) NULL, | ||
532 | SitTargetOffsetX float(53) NULL, | ||
533 | SitTargetOffsetY float(53) NULL, | ||
534 | SitTargetOffsetZ float(53) NULL, | ||
535 | SitTargetOrientW float(53) NULL, | ||
536 | SitTargetOrientX float(53) NULL, | ||
537 | SitTargetOrientY float(53) NULL, | ||
538 | SitTargetOrientZ float(53) NULL, | ||
539 | PayPrice int NOT NULL DEFAULT ((0)), | ||
540 | PayButton1 int NOT NULL DEFAULT ((0)), | ||
541 | PayButton2 int NOT NULL DEFAULT ((0)), | ||
542 | PayButton3 int NOT NULL DEFAULT ((0)), | ||
543 | PayButton4 int NOT NULL DEFAULT ((0)), | ||
544 | LoopedSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
545 | LoopedSoundGain float(53) NOT NULL DEFAULT ((0.0)), | ||
546 | TextureAnimation image NULL, | ||
547 | OmegaX float(53) NOT NULL DEFAULT ((0.0)), | ||
548 | OmegaY float(53) NOT NULL DEFAULT ((0.0)), | ||
549 | OmegaZ float(53) NOT NULL DEFAULT ((0.0)), | ||
550 | CameraEyeOffsetX float(53) NOT NULL DEFAULT ((0.0)), | ||
551 | CameraEyeOffsetY float(53) NOT NULL DEFAULT ((0.0)), | ||
552 | CameraEyeOffsetZ float(53) NOT NULL DEFAULT ((0.0)), | ||
553 | CameraAtOffsetX float(53) NOT NULL DEFAULT ((0.0)), | ||
554 | CameraAtOffsetY float(53) NOT NULL DEFAULT ((0.0)), | ||
555 | CameraAtOffsetZ float(53) NOT NULL DEFAULT ((0.0)), | ||
556 | ForceMouselook tinyint NOT NULL DEFAULT ((0)), | ||
557 | ScriptAccessPin int NOT NULL DEFAULT ((0)), | ||
558 | AllowedDrop tinyint NOT NULL DEFAULT ((0)), | ||
559 | DieAtEdge tinyint NOT NULL DEFAULT ((0)), | ||
560 | SalePrice int NOT NULL DEFAULT ((10)), | ||
561 | SaleType tinyint NOT NULL DEFAULT ((0)), | ||
562 | ColorR int NOT NULL DEFAULT ((0)), | ||
563 | ColorG int NOT NULL DEFAULT ((0)), | ||
564 | ColorB int NOT NULL DEFAULT ((0)), | ||
565 | ColorA int NOT NULL DEFAULT ((0)), | ||
566 | ParticleSystem image NULL, | ||
567 | ClickAction tinyint NOT NULL DEFAULT ((0)), | ||
568 | Material tinyint NOT NULL DEFAULT ((3)), | ||
569 | CollisionSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
570 | CollisionSoundVolume float(53) NOT NULL DEFAULT ((0.0)), | ||
571 | LinkNumber int NOT NULL DEFAULT ((0)) | ||
572 | ) ON [PRIMARY] | ||
573 | TEXTIMAGE_ON [PRIMARY] | ||
574 | |||
575 | IF EXISTS(SELECT * FROM dbo.prims) | ||
576 | EXEC('INSERT INTO dbo.Tmp_prims (UUID, RegionUUID, ParentID, CreationDate, Name, SceneGroupID, Text, Description, SitName, TouchName, ObjectFlags, CreatorID, OwnerID, GroupID, LastOwnerID, OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, LinkNumber) | ||
577 | SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), ParentID, CreationDate, Name, CONVERT(uniqueidentifier, SceneGroupID), Text, Description, SitName, TouchName, ObjectFlags, CONVERT(uniqueidentifier, CreatorID), CONVERT(uniqueidentifier, OwnerID), CONVERT(uniqueidentifier, GroupID), CONVERT(uniqueidentifier, LastOwnerID), OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, CONVERT(uniqueidentifier, LoopedSound), LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CONVERT(uniqueidentifier, CollisionSound), CollisionSoundVolume, LinkNumber FROM dbo.prims WITH (HOLDLOCK TABLOCKX)') | ||
578 | |||
579 | DROP TABLE dbo.prims | ||
580 | |||
581 | EXECUTE sp_rename N'dbo.Tmp_prims', N'prims', 'OBJECT' | ||
582 | |||
583 | ALTER TABLE dbo.prims ADD CONSTRAINT | ||
584 | PK__prims__10566F31 PRIMARY KEY CLUSTERED | ||
585 | ( | ||
586 | UUID | ||
587 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
588 | |||
589 | |||
590 | CREATE NONCLUSTERED INDEX prims_regionuuid ON dbo.prims | ||
591 | ( | ||
592 | RegionUUID | ||
593 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
594 | |||
595 | CREATE NONCLUSTERED INDEX prims_parentid ON dbo.prims | ||
596 | ( | ||
597 | ParentID | ||
598 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
599 | |||
600 | COMMIT | ||
601 | |||
602 | |||
603 | :VERSION 14 | ||
604 | |||
605 | BEGIN TRANSACTION | ||
606 | |||
607 | CREATE TABLE dbo.Tmp_primshapes | ||
608 | ( | ||
609 | UUID uniqueidentifier NOT NULL, | ||
610 | Shape int NULL, | ||
611 | ScaleX float(53) NULL, | ||
612 | ScaleY float(53) NULL, | ||
613 | ScaleZ float(53) NULL, | ||
614 | PCode int NULL, | ||
615 | PathBegin int NULL, | ||
616 | PathEnd int NULL, | ||
617 | PathScaleX int NULL, | ||
618 | PathScaleY int NULL, | ||
619 | PathShearX int NULL, | ||
620 | PathShearY int NULL, | ||
621 | PathSkew int NULL, | ||
622 | PathCurve int NULL, | ||
623 | PathRadiusOffset int NULL, | ||
624 | PathRevolutions int NULL, | ||
625 | PathTaperX int NULL, | ||
626 | PathTaperY int NULL, | ||
627 | PathTwist int NULL, | ||
628 | PathTwistBegin int NULL, | ||
629 | ProfileBegin int NULL, | ||
630 | ProfileEnd int NULL, | ||
631 | ProfileCurve int NULL, | ||
632 | ProfileHollow int NULL, | ||
633 | State int NULL, | ||
634 | Texture image NULL, | ||
635 | ExtraParams image NULL | ||
636 | ) ON [PRIMARY] | ||
637 | TEXTIMAGE_ON [PRIMARY] | ||
638 | |||
639 | IF EXISTS(SELECT * FROM dbo.primshapes) | ||
640 | EXEC('INSERT INTO dbo.Tmp_primshapes (UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams) | ||
641 | SELECT CONVERT(uniqueidentifier, UUID), Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams FROM dbo.primshapes WITH (HOLDLOCK TABLOCKX)') | ||
642 | |||
643 | DROP TABLE dbo.primshapes | ||
644 | |||
645 | EXECUTE sp_rename N'dbo.Tmp_primshapes', N'primshapes', 'OBJECT' | ||
646 | |||
647 | ALTER TABLE dbo.primshapes ADD CONSTRAINT | ||
648 | PK__primshapes__0880433F PRIMARY KEY CLUSTERED | ||
649 | ( | ||
650 | UUID | ||
651 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
652 | |||
653 | COMMIT | ||
654 | |||
655 | |||
656 | :VERSION 15 | ||
657 | |||
658 | BEGIN TRANSACTION | ||
659 | |||
660 | CREATE TABLE dbo.Tmp_primitems | ||
661 | ( | ||
662 | itemID uniqueidentifier NOT NULL, | ||
663 | primID uniqueidentifier NULL, | ||
664 | assetID uniqueidentifier NULL, | ||
665 | parentFolderID uniqueidentifier NULL, | ||
666 | invType int NULL, | ||
667 | assetType int NULL, | ||
668 | name varchar(255) NULL, | ||
669 | description varchar(255) NULL, | ||
670 | creationDate varchar(255) NULL, | ||
671 | creatorID uniqueidentifier NULL, | ||
672 | ownerID uniqueidentifier NULL, | ||
673 | lastOwnerID uniqueidentifier NULL, | ||
674 | groupID uniqueidentifier NULL, | ||
675 | nextPermissions int NULL, | ||
676 | currentPermissions int NULL, | ||
677 | basePermissions int NULL, | ||
678 | everyonePermissions int NULL, | ||
679 | groupPermissions int NULL, | ||
680 | flags int NOT NULL DEFAULT ((0)) | ||
681 | ) ON [PRIMARY] | ||
682 | |||
683 | IF EXISTS(SELECT * FROM dbo.primitems) | ||
684 | EXEC('INSERT INTO dbo.Tmp_primitems (itemID, primID, assetID, parentFolderID, invType, assetType, name, description, creationDate, creatorID, ownerID, lastOwnerID, groupID, nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags) | ||
685 | SELECT CONVERT(uniqueidentifier, itemID), CONVERT(uniqueidentifier, primID), CONVERT(uniqueidentifier, assetID), CONVERT(uniqueidentifier, parentFolderID), invType, assetType, name, description, creationDate, CONVERT(uniqueidentifier, creatorID), CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, lastOwnerID), CONVERT(uniqueidentifier, groupID), nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags FROM dbo.primitems WITH (HOLDLOCK TABLOCKX)') | ||
686 | |||
687 | DROP TABLE dbo.primitems | ||
688 | |||
689 | EXECUTE sp_rename N'dbo.Tmp_primitems', N'primitems', 'OBJECT' | ||
690 | |||
691 | ALTER TABLE dbo.primitems ADD CONSTRAINT | ||
692 | PK__primitems__0A688BB1 PRIMARY KEY CLUSTERED | ||
693 | ( | ||
694 | itemID | ||
695 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
696 | |||
697 | CREATE NONCLUSTERED INDEX primitems_primid ON dbo.primitems | ||
698 | ( | ||
699 | primID | ||
700 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
701 | |||
702 | COMMIT | ||
703 | |||
704 | |||
705 | :VERSION 16 | ||
706 | |||
707 | |||
708 | BEGIN TRANSACTION | ||
709 | |||
710 | CREATE TABLE dbo.Tmp_terrain | ||
711 | ( | ||
712 | RegionUUID uniqueidentifier NULL, | ||
713 | Revision int NULL, | ||
714 | Heightfield image NULL | ||
715 | ) ON [PRIMARY] | ||
716 | TEXTIMAGE_ON [PRIMARY] | ||
717 | |||
718 | IF EXISTS(SELECT * FROM dbo.terrain) | ||
719 | EXEC('INSERT INTO dbo.Tmp_terrain (RegionUUID, Revision, Heightfield) | ||
720 | SELECT CONVERT(uniqueidentifier, RegionUUID), Revision, Heightfield FROM dbo.terrain WITH (HOLDLOCK TABLOCKX)') | ||
721 | |||
722 | DROP TABLE dbo.terrain | ||
723 | |||
724 | EXECUTE sp_rename N'dbo.Tmp_terrain', N'terrain', 'OBJECT' | ||
725 | |||
726 | COMMIT | ||
727 | |||
728 | |||
729 | :VERSION 17 | ||
730 | |||
731 | BEGIN TRANSACTION | ||
732 | |||
733 | CREATE TABLE dbo.Tmp_land | ||
734 | ( | ||
735 | UUID uniqueidentifier NOT NULL, | ||
736 | RegionUUID uniqueidentifier NULL, | ||
737 | LocalLandID int NULL, | ||
738 | Bitmap image NULL, | ||
739 | Name varchar(255) NULL, | ||
740 | Description varchar(255) NULL, | ||
741 | OwnerUUID uniqueidentifier NULL, | ||
742 | IsGroupOwned int NULL, | ||
743 | Area int NULL, | ||
744 | AuctionID int NULL, | ||
745 | Category int NULL, | ||
746 | ClaimDate int NULL, | ||
747 | ClaimPrice int NULL, | ||
748 | GroupUUID uniqueidentifier NULL, | ||
749 | SalePrice int NULL, | ||
750 | LandStatus int NULL, | ||
751 | LandFlags int NULL, | ||
752 | LandingType int NULL, | ||
753 | MediaAutoScale int NULL, | ||
754 | MediaTextureUUID uniqueidentifier NULL, | ||
755 | MediaURL varchar(255) NULL, | ||
756 | MusicURL varchar(255) NULL, | ||
757 | PassHours float(53) NULL, | ||
758 | PassPrice int NULL, | ||
759 | SnapshotUUID uniqueidentifier NULL, | ||
760 | UserLocationX float(53) NULL, | ||
761 | UserLocationY float(53) NULL, | ||
762 | UserLocationZ float(53) NULL, | ||
763 | UserLookAtX float(53) NULL, | ||
764 | UserLookAtY float(53) NULL, | ||
765 | UserLookAtZ float(53) NULL, | ||
766 | AuthbuyerID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
767 | OtherCleanTime int NOT NULL DEFAULT ((0)), | ||
768 | Dwell int NOT NULL DEFAULT ((0)) | ||
769 | ) ON [PRIMARY] | ||
770 | TEXTIMAGE_ON [PRIMARY] | ||
771 | |||
772 | IF EXISTS(SELECT * FROM dbo.land) | ||
773 | EXEC('INSERT INTO dbo.Tmp_land (UUID, RegionUUID, LocalLandID, Bitmap, Name, Description, OwnerUUID, IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, GroupUUID, SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, MediaTextureUUID, MediaURL, MusicURL, PassHours, PassPrice, SnapshotUUID, UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, AuthbuyerID, OtherCleanTime, Dwell) | ||
774 | SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), LocalLandID, Bitmap, Name, Description, CONVERT(uniqueidentifier, OwnerUUID), IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, CONVERT(uniqueidentifier, GroupUUID), SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, CONVERT(uniqueidentifier, MediaTextureUUID), MediaURL, MusicURL, PassHours, PassPrice, CONVERT(uniqueidentifier, SnapshotUUID), UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, CONVERT(uniqueidentifier, AuthbuyerID), OtherCleanTime, Dwell FROM dbo.land WITH (HOLDLOCK TABLOCKX)') | ||
775 | |||
776 | DROP TABLE dbo.land | ||
777 | |||
778 | EXECUTE sp_rename N'dbo.Tmp_land', N'land', 'OBJECT' | ||
779 | |||
780 | ALTER TABLE dbo.land ADD CONSTRAINT | ||
781 | PK__land__65A475E71BFD2C07 PRIMARY KEY CLUSTERED | ||
782 | ( | ||
783 | UUID | ||
784 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
785 | |||
786 | COMMIT | ||
787 | |||
788 | |||
789 | |||
790 | :VERSION 18 | ||
791 | |||
792 | BEGIN TRANSACTION | ||
793 | |||
794 | CREATE TABLE dbo.Tmp_landaccesslist | ||
795 | ( | ||
796 | LandUUID uniqueidentifier NULL, | ||
797 | AccessUUID uniqueidentifier NULL, | ||
798 | Flags int NULL | ||
799 | ) ON [PRIMARY] | ||
800 | |||
801 | IF EXISTS(SELECT * FROM dbo.landaccesslist) | ||
802 | EXEC('INSERT INTO dbo.Tmp_landaccesslist (LandUUID, AccessUUID, Flags) | ||
803 | SELECT CONVERT(uniqueidentifier, LandUUID), CONVERT(uniqueidentifier, AccessUUID), Flags FROM dbo.landaccesslist WITH (HOLDLOCK TABLOCKX)') | ||
804 | |||
805 | DROP TABLE dbo.landaccesslist | ||
806 | |||
807 | EXECUTE sp_rename N'dbo.Tmp_landaccesslist', N'landaccesslist', 'OBJECT' | ||
808 | |||
809 | COMMIT | ||
810 | |||
811 | |||
812 | |||
813 | :VERSION 19 | ||
814 | |||
815 | BEGIN TRANSACTION | ||
816 | |||
817 | CREATE TABLE dbo.Tmp_regionban | ||
818 | ( | ||
819 | regionUUID uniqueidentifier NOT NULL, | ||
820 | bannedUUID uniqueidentifier NOT NULL, | ||
821 | bannedIp varchar(16) NOT NULL, | ||
822 | bannedIpHostMask varchar(16) NOT NULL | ||
823 | ) ON [PRIMARY] | ||
824 | |||
825 | IF EXISTS(SELECT * FROM dbo.regionban) | ||
826 | EXEC('INSERT INTO dbo.Tmp_regionban (regionUUID, bannedUUID, bannedIp, bannedIpHostMask) | ||
827 | SELECT CONVERT(uniqueidentifier, regionUUID), CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask FROM dbo.regionban WITH (HOLDLOCK TABLOCKX)') | ||
828 | |||
829 | DROP TABLE dbo.regionban | ||
830 | |||
831 | EXECUTE sp_rename N'dbo.Tmp_regionban', N'regionban', 'OBJECT' | ||
832 | |||
833 | COMMIT | ||
834 | |||
835 | |||
836 | :VERSION 20 | ||
837 | |||
838 | BEGIN TRANSACTION | ||
839 | |||
840 | CREATE TABLE dbo.Tmp_regionsettings | ||
841 | ( | ||
842 | regionUUID uniqueidentifier NOT NULL, | ||
843 | block_terraform bit NOT NULL, | ||
844 | block_fly bit NOT NULL, | ||
845 | allow_damage bit NOT NULL, | ||
846 | restrict_pushing bit NOT NULL, | ||
847 | allow_land_resell bit NOT NULL, | ||
848 | allow_land_join_divide bit NOT NULL, | ||
849 | block_show_in_search bit NOT NULL, | ||
850 | agent_limit int NOT NULL, | ||
851 | object_bonus float(53) NOT NULL, | ||
852 | maturity int NOT NULL, | ||
853 | disable_scripts bit NOT NULL, | ||
854 | disable_collisions bit NOT NULL, | ||
855 | disable_physics bit NOT NULL, | ||
856 | terrain_texture_1 uniqueidentifier NOT NULL, | ||
857 | terrain_texture_2 uniqueidentifier NOT NULL, | ||
858 | terrain_texture_3 uniqueidentifier NOT NULL, | ||
859 | terrain_texture_4 uniqueidentifier NOT NULL, | ||
860 | elevation_1_nw float(53) NOT NULL, | ||
861 | elevation_2_nw float(53) NOT NULL, | ||
862 | elevation_1_ne float(53) NOT NULL, | ||
863 | elevation_2_ne float(53) NOT NULL, | ||
864 | elevation_1_se float(53) NOT NULL, | ||
865 | elevation_2_se float(53) NOT NULL, | ||
866 | elevation_1_sw float(53) NOT NULL, | ||
867 | elevation_2_sw float(53) NOT NULL, | ||
868 | water_height float(53) NOT NULL, | ||
869 | terrain_raise_limit float(53) NOT NULL, | ||
870 | terrain_lower_limit float(53) NOT NULL, | ||
871 | use_estate_sun bit NOT NULL, | ||
872 | fixed_sun bit NOT NULL, | ||
873 | sun_position float(53) NOT NULL, | ||
874 | covenant uniqueidentifier NULL DEFAULT (NULL), | ||
875 | Sandbox bit NOT NULL, | ||
876 | sunvectorx float(53) NOT NULL DEFAULT ((0)), | ||
877 | sunvectory float(53) NOT NULL DEFAULT ((0)), | ||
878 | sunvectorz float(53) NOT NULL DEFAULT ((0)) | ||
879 | ) ON [PRIMARY] | ||
880 | |||
881 | IF EXISTS(SELECT * FROM dbo.regionsettings) | ||
882 | EXEC('INSERT INTO dbo.Tmp_regionsettings (regionUUID, block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, terrain_texture_1, terrain_texture_2, terrain_texture_3, terrain_texture_4, elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, covenant, Sandbox, sunvectorx, sunvectory, sunvectorz) | ||
883 | SELECT CONVERT(uniqueidentifier, regionUUID), block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, CONVERT(uniqueidentifier, terrain_texture_1), CONVERT(uniqueidentifier, terrain_texture_2), CONVERT(uniqueidentifier, terrain_texture_3), CONVERT(uniqueidentifier, terrain_texture_4), elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, CONVERT(uniqueidentifier, covenant), Sandbox, sunvectorx, sunvectory, sunvectorz FROM dbo.regionsettings WITH (HOLDLOCK TABLOCKX)') | ||
884 | |||
885 | DROP TABLE dbo.regionsettings | ||
886 | |||
887 | EXECUTE sp_rename N'dbo.Tmp_regionsettings', N'regionsettings', 'OBJECT' | ||
888 | |||
889 | ALTER TABLE dbo.regionsettings ADD CONSTRAINT | ||
890 | PK__regionse__5B35159D21B6055D PRIMARY KEY CLUSTERED | ||
891 | ( | ||
892 | regionUUID | ||
893 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
894 | |||
895 | COMMIT | ||
896 | |||
897 | |||
898 | :VERSION 21 | ||
899 | |||
900 | BEGIN TRANSACTION | ||
901 | |||
902 | ALTER TABLE prims ADD PassTouches bit not null default 0 | ||
903 | |||
904 | COMMIT | ||
905 | |||
906 | |||
907 | :VERSION 22 | ||
908 | |||
909 | BEGIN TRANSACTION | ||
910 | |||
911 | ALTER TABLE regionsettings ADD loaded_creation_date varchar(20) | ||
912 | ALTER TABLE regionsettings ADD loaded_creation_time varchar(20) | ||
913 | ALTER TABLE regionsettings ADD loaded_creation_id varchar(64) | ||
914 | |||
915 | COMMIT | ||
916 | |||
917 | :VERSION 23 | ||
918 | |||
919 | BEGIN TRANSACTION | ||
920 | |||
921 | ALTER TABLE regionsettings DROP COLUMN loaded_creation_date | ||
922 | ALTER TABLE regionsettings DROP COLUMN loaded_creation_time | ||
923 | ALTER TABLE regionsettings ADD loaded_creation_datetime int NOT NULL default 0 | ||
924 | |||
925 | COMMIT | ||
926 | |||
927 | :VERSION 24 | ||
928 | |||
929 | BEGIN TRANSACTION | ||
930 | |||
931 | ALTER TABLE prims ADD MediaURL varchar(255) | ||
932 | ALTER TABLE primshapes ADD Media TEXT NULL | ||
933 | |||
934 | COMMIT | ||
935 | |||
936 | :VERSION 25 | ||
937 | |||
938 | BEGIN TRANSACTION | ||
939 | CREATE TABLE "regionwindlight" ( | ||
940 | "region_id" varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', | ||
941 | "water_color_r" [float] NOT NULL DEFAULT '4.000000', | ||
942 | "water_color_g" [float] NOT NULL DEFAULT '38.000000', | ||
943 | "water_color_b" [float] NOT NULL DEFAULT '64.000000', | ||
944 | "water_fog_density_exponent" [float] NOT NULL DEFAULT '4.0', | ||
945 | "underwater_fog_modifier" [float] NOT NULL DEFAULT '0.25', | ||
946 | "reflection_wavelet_scale_1" [float] NOT NULL DEFAULT '2.0', | ||
947 | "reflection_wavelet_scale_2" [float] NOT NULL DEFAULT '2.0', | ||
948 | "reflection_wavelet_scale_3" [float] NOT NULL DEFAULT '2.0', | ||
949 | "fresnel_scale" [float] NOT NULL DEFAULT '0.40', | ||
950 | "fresnel_offset" [float] NOT NULL DEFAULT '0.50', | ||
951 | "refract_scale_above" [float] NOT NULL DEFAULT '0.03', | ||
952 | "refract_scale_below" [float] NOT NULL DEFAULT '0.20', | ||
953 | "blur_multiplier" [float] NOT NULL DEFAULT '0.040', | ||
954 | "big_wave_direction_x" [float] NOT NULL DEFAULT '1.05', | ||
955 | "big_wave_direction_y" [float] NOT NULL DEFAULT '-0.42', | ||
956 | "little_wave_direction_x" [float] NOT NULL DEFAULT '1.11', | ||
957 | "little_wave_direction_y" [float] NOT NULL DEFAULT '-1.16', | ||
958 | "normal_map_texture" varchar(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4', | ||
959 | "horizon_r" [float] NOT NULL DEFAULT '0.25', | ||
960 | "horizon_g" [float] NOT NULL DEFAULT '0.25', | ||
961 | "horizon_b" [float] NOT NULL DEFAULT '0.32', | ||
962 | "horizon_i" [float] NOT NULL DEFAULT '0.32', | ||
963 | "haze_horizon" [float] NOT NULL DEFAULT '0.19', | ||
964 | "blue_density_r" [float] NOT NULL DEFAULT '0.12', | ||
965 | "blue_density_g" [float] NOT NULL DEFAULT '0.22', | ||
966 | "blue_density_b" [float] NOT NULL DEFAULT '0.38', | ||
967 | "blue_density_i" [float] NOT NULL DEFAULT '0.38', | ||
968 | "haze_density" [float] NOT NULL DEFAULT '0.70', | ||
969 | "density_multiplier" [float] NOT NULL DEFAULT '0.18', | ||
970 | "distance_multiplier" [float] NOT NULL DEFAULT '0.8', | ||
971 | "max_altitude" int NOT NULL DEFAULT '1605', | ||
972 | "sun_moon_color_r" [float] NOT NULL DEFAULT '0.24', | ||
973 | "sun_moon_color_g" [float] NOT NULL DEFAULT '0.26', | ||
974 | "sun_moon_color_b" [float] NOT NULL DEFAULT '0.30', | ||
975 | "sun_moon_color_i" [float] NOT NULL DEFAULT '0.30', | ||
976 | "sun_moon_position" [float] NOT NULL DEFAULT '0.317', | ||
977 | "ambient_r" [float] NOT NULL DEFAULT '0.35', | ||
978 | "ambient_g" [float] NOT NULL DEFAULT '0.35', | ||
979 | "ambient_b" [float] NOT NULL DEFAULT '0.35', | ||
980 | "ambient_i" [float] NOT NULL DEFAULT '0.35', | ||
981 | "east_angle" [float] NOT NULL DEFAULT '0.00', | ||
982 | "sun_glow_focus" [float] NOT NULL DEFAULT '0.10', | ||
983 | "sun_glow_size" [float] NOT NULL DEFAULT '1.75', | ||
984 | "scene_gamma" [float] NOT NULL DEFAULT '1.00', | ||
985 | "star_brightness" [float] NOT NULL DEFAULT '0.00', | ||
986 | "cloud_color_r" [float] NOT NULL DEFAULT '0.41', | ||
987 | "cloud_color_g" [float] NOT NULL DEFAULT '0.41', | ||
988 | "cloud_color_b" [float] NOT NULL DEFAULT '0.41', | ||
989 | "cloud_color_i" [float] NOT NULL DEFAULT '0.41', | ||
990 | "cloud_x" [float] NOT NULL DEFAULT '1.00', | ||
991 | "cloud_y" [float] NOT NULL DEFAULT '0.53', | ||
992 | "cloud_density" [float] NOT NULL DEFAULT '1.00', | ||
993 | "cloud_coverage" [float] NOT NULL DEFAULT '0.27', | ||
994 | "cloud_scale" [float] NOT NULL DEFAULT '0.42', | ||
995 | "cloud_detail_x" [float] NOT NULL DEFAULT '1.00', | ||
996 | "cloud_detail_y" [float] NOT NULL DEFAULT '0.53', | ||
997 | "cloud_detail_density" [float] NOT NULL DEFAULT '0.12', | ||
998 | "cloud_scroll_x" [float] NOT NULL DEFAULT '0.20', | ||
999 | "cloud_scroll_x_lock" tinyint NOT NULL DEFAULT '0', | ||
1000 | "cloud_scroll_y" [float] NOT NULL DEFAULT '0.01', | ||
1001 | "cloud_scroll_y_lock" tinyint NOT NULL DEFAULT '0', | ||
1002 | "draw_classic_clouds" tinyint NOT NULL DEFAULT '1', | ||
1003 | PRIMARY KEY ("region_id") | ||
1004 | ) | ||
1005 | |||
1006 | COMMIT | ||
1007 | |||
1008 | :VERSION 26 | ||
1009 | |||
1010 | BEGIN TRANSACTION | ||
1011 | |||
1012 | ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' | ||
1013 | |||
1014 | COMMIT | ||
1015 | |||
1016 | :VERSION 27 #--------------------- | ||
1017 | |||
1018 | BEGIN TRANSACTION | ||
1019 | ALTER TABLE land ADD MediaType VARCHAR(32) NOT NULL DEFAULT 'none/none' | ||
1020 | ALTER TABLE land ADD MediaDescription VARCHAR(255) NOT NULL DEFAULT '' | ||
1021 | ALTER TABLE land ADD MediaSize VARCHAR(16) NOT NULL DEFAULT '0,0' | ||
1022 | ALTER TABLE land ADD MediaLoop bit NOT NULL DEFAULT 0 | ||
1023 | ALTER TABLE land ADD ObscureMusic bit NOT NULL DEFAULT 0 | ||
1024 | ALTER TABLE land ADD ObscureMedia bit NOT NULL DEFAULT 0 | ||
1025 | COMMIT | ||
1026 | |||
1027 | :VERSION 28 #--------------------- | ||
1028 | |||
1029 | BEGIN TRANSACTION | ||
1030 | |||
1031 | ALTER TABLE prims | ||
1032 | ADD CONSTRAINT DF_prims_CreatorID | ||
1033 | DEFAULT '00000000-0000-0000-0000-000000000000' | ||
1034 | FOR CreatorID | ||
1035 | |||
1036 | ALTER TABLE prims ALTER COLUMN CreatorID uniqueidentifier NOT NULL | ||
1037 | |||
1038 | ALTER TABLE primitems | ||
1039 | ADD CONSTRAINT DF_primitems_CreatorID | ||
1040 | DEFAULT '00000000-0000-0000-0000-000000000000' | ||
1041 | FOR CreatorID | ||
1042 | |||
1043 | ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL | ||
1044 | |||
1045 | COMMIT | ||
1046 | |||
1047 | :VERSION 29 #----------------- Region Covenant changed time | ||
1048 | |||
1049 | BEGIN TRANSACTION | ||
1050 | |||
1051 | ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0 | ||
1052 | |||
1053 | COMMIT | ||
1054 | |||
1055 | :VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support | ||
1056 | |||
1057 | BEGIN TRANSACTION | ||
1058 | |||
1059 | EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN' | ||
1060 | EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN' | ||
1061 | |||
1062 | COMMIT | ||
1063 | |||
1064 | :VERSION 31 #--------------------- | ||
1065 | |||
1066 | BEGIN TRANSACTION | ||
1067 | |||
1068 | ALTER TABLE prims ADD CreatorID varchar(255) | ||
1069 | ALTER TABLE primitems ADD CreatorID varchar(255) | ||
1070 | |||
1071 | COMMIT | ||
1072 | |||
1073 | :VERSION 32 #--------------------- | ||
1074 | |||
1075 | BEGIN TRANSACTION | ||
1076 | |||
1077 | UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold) | ||
1078 | UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold) | ||
1079 | |||
1080 | COMMIT | ||
1081 | |||
1082 | :VERSION 33 #--------------------- | ||
1083 | |||
1084 | BEGIN TRANSACTION | ||
1085 | |||
1086 | ALTER TABLE prims | ||
1087 | ADD CONSTRAINT DF_prims_CreatorIDNew | ||
1088 | DEFAULT '00000000-0000-0000-0000-000000000000' | ||
1089 | FOR CreatorID | ||
1090 | |||
1091 | ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL | ||
1092 | |||
1093 | ALTER TABLE primitems | ||
1094 | ADD CONSTRAINT DF_primitems_CreatorIDNew | ||
1095 | DEFAULT '00000000-0000-0000-0000-000000000000' | ||
1096 | FOR CreatorID | ||
1097 | |||
1098 | ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL | ||
1099 | |||
1100 | COMMIT | ||
1101 | |||
1102 | :VERSION 34 #--------------- Telehub support | ||
1103 | |||
1104 | BEGIN TRANSACTION | ||
1105 | |||
1106 | CREATE TABLE [dbo].[Spawn_Points]( | ||
1107 | [RegionUUID] [uniqueidentifier] NOT NULL, | ||
1108 | [Yaw] [float] NOT NULL, | ||
1109 | [Pitch] [float] NOT NULL, | ||
1110 | [Distance] [float] NOT NULL, | ||
1111 | PRIMARY KEY CLUSTERED | ||
1112 | ( | ||
1113 | [RegionUUID] ASC | ||
1114 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
1115 | ) ON [PRIMARY] | ||
1116 | |||
1117 | ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
1118 | |||
1119 | COMMIT | ||
1120 | |||
1121 | :VERSION 35 #---------------- Parcels for sale | ||
1122 | |||
1123 | BEGIN TRANSACTION | ||
1124 | |||
1125 | ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
1126 | |||
1127 | COMMIT | ||
1128 | |||
1129 | :VERSION 36 #---------------- Timed bans/access | ||
1130 | |||
1131 | BEGIN TRANSACTION | ||
1132 | |||
1133 | ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0; | ||
1134 | |||
1135 | COMMIT | ||
1136 | |||
1137 | :VERSION 37 #---------------- Environment Settings | ||
1138 | |||
1139 | BEGIN TRANSACTION | ||
1140 | |||
1141 | CREATE TABLE [dbo].[regionenvironment]( | ||
1142 | [region_id] [uniqueidentifier] NOT NULL, | ||
1143 | [llsd_settings] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
1144 | PRIMARY KEY CLUSTERED | ||
1145 | ( | ||
1146 | [region_id] ASC | ||
1147 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
1148 | ) ON [PRIMARY] | ||
1149 | |||
1150 | COMMIT | ||
1151 | |||
1152 | :VERSION 38 #---------------- Dynamic attributes | ||
1153 | |||
1154 | BEGIN TRANSACTION | ||
1155 | |||
1156 | ALTER TABLE prims ADD DynAttrs TEXT; | ||
1157 | |||
1158 | COMMIT | ||
1159 | |||
1160 | :VERSION 39 #---------------- Extra physics params | ||
1161 | |||
1162 | BEGIN TRANSACTION | ||
1163 | |||
1164 | ALTER TABLE prims ADD PhysicsShapeType tinyint NOT NULL default 0; | ||
1165 | ALTER TABLE prims ADD Density float NOT NULL default 1000; | ||
1166 | ALTER TABLE prims ADD GravityModifier float NOT NULL default 1; | ||
1167 | ALTER TABLE prims ADD Friction float NOT NULL default 0.6; | ||
1168 | ALTER TABLE prims ADD Restitution float NOT NULL default 0.5; | ||
1169 | |||
1170 | COMMIT | ||
1171 | |||
1172 | :VERSION 40 #---------------- Save Attachment info | ||
1173 | |||
1174 | BEGIN TRANSACTION | ||
1175 | |||
1176 | ALTER TABLE prims ADD AttachedPosX float(53) default 0.0; | ||
1177 | ALTER TABLE prims ADD AttachedPosY float(53) default 0.0; | ||
1178 | ALTER TABLE prims ADD AttachedPosZ float(53) default 0.0; | ||
1179 | ALTER TABLE primshapes ADD LastAttachPoint int not null default 0; | ||
1180 | |||
1181 | COMMIT | ||
1182 | |||
diff --git a/OpenSim/Data/MSSQL/Resources/UserAccount.migrations b/OpenSim/Data/MSSQL/Resources/UserAccount.migrations deleted file mode 100644 index a81704d..0000000 --- a/OpenSim/Data/MSSQL/Resources/UserAccount.migrations +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | CREATE TABLE [UserAccounts] ( | ||
4 | [PrincipalID] uniqueidentifier NOT NULL, | ||
5 | [ScopeID] uniqueidentifier NOT NULL, | ||
6 | [FirstName] [varchar](64) NOT NULL, | ||
7 | [LastName] [varchar](64) NOT NULL, | ||
8 | [Email] [varchar](64) NULL, | ||
9 | [ServiceURLs] [text] NULL, | ||
10 | [Created] [int] default NULL, | ||
11 | |||
12 | PRIMARY KEY CLUSTERED | ||
13 | ( | ||
14 | [PrincipalID] ASC | ||
15 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
16 | ) ON [PRIMARY] | ||
17 | |||
18 | |||
19 | :VERSION 2 | ||
20 | |||
21 | BEGIN TRANSACTION | ||
22 | IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users]') AND type in (N'U')) | ||
23 | INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT [UUID] AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, | ||
24 | username AS FirstName, | ||
25 | lastname AS LastName, | ||
26 | email as Email, ( | ||
27 | 'AssetServerURI=' + | ||
28 | userAssetURI + ' InventoryServerURI=' + userInventoryURI + ' GatewayURI= HomeURI=') AS ServiceURLs, | ||
29 | created as Created FROM users; | ||
30 | |||
31 | |||
32 | COMMIT | ||
33 | |||
34 | :VERSION 3 | ||
35 | |||
36 | BEGIN TRANSACTION | ||
37 | |||
38 | CREATE UNIQUE INDEX PrincipalID ON UserAccounts(PrincipalID); | ||
39 | CREATE INDEX Email ON UserAccounts(Email); | ||
40 | CREATE INDEX FirstName ON UserAccounts(FirstName); | ||
41 | CREATE INDEX LastName ON UserAccounts(LastName); | ||
42 | CREATE INDEX Name ON UserAccounts(FirstName,LastName); | ||
43 | |||
44 | COMMIT | ||
45 | |||
46 | :VERSION 4 | ||
47 | |||
48 | BEGIN TRANSACTION | ||
49 | |||
50 | ALTER TABLE UserAccounts ADD UserLevel integer NOT NULL DEFAULT 0; | ||
51 | ALTER TABLE UserAccounts ADD UserFlags integer NOT NULL DEFAULT 0; | ||
52 | ALTER TABLE UserAccounts ADD UserTitle varchar(64) NOT NULL DEFAULT ''; | ||
53 | |||
54 | COMMIT | ||
55 | |||
diff --git a/OpenSim/Data/MSSQL/Resources/UserStore.migrations b/OpenSim/Data/MSSQL/Resources/UserStore.migrations deleted file mode 100644 index 050c544..0000000 --- a/OpenSim/Data/MSSQL/Resources/UserStore.migrations +++ /dev/null | |||
@@ -1,421 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | CREATE TABLE [users] ( | ||
4 | [UUID] [varchar](36) NOT NULL default '', | ||
5 | [username] [varchar](32) NOT NULL, | ||
6 | [lastname] [varchar](32) NOT NULL, | ||
7 | [passwordHash] [varchar](32) NOT NULL, | ||
8 | [passwordSalt] [varchar](32) NOT NULL, | ||
9 | [homeRegion] [bigint] default NULL, | ||
10 | [homeLocationX] [float] default NULL, | ||
11 | [homeLocationY] [float] default NULL, | ||
12 | [homeLocationZ] [float] default NULL, | ||
13 | [homeLookAtX] [float] default NULL, | ||
14 | [homeLookAtY] [float] default NULL, | ||
15 | [homeLookAtZ] [float] default NULL, | ||
16 | [created] [int] NOT NULL, | ||
17 | [lastLogin] [int] NOT NULL, | ||
18 | [userInventoryURI] [varchar](255) default NULL, | ||
19 | [userAssetURI] [varchar](255) default NULL, | ||
20 | [profileCanDoMask] [int] default NULL, | ||
21 | [profileWantDoMask] [int] default NULL, | ||
22 | [profileAboutText] [ntext], | ||
23 | [profileFirstText] [ntext], | ||
24 | [profileImage] [varchar](36) default NULL, | ||
25 | [profileFirstImage] [varchar](36) default NULL, | ||
26 | [webLoginKey] [varchar](36) default NULL, | ||
27 | PRIMARY KEY CLUSTERED | ||
28 | ( | ||
29 | [UUID] ASC | ||
30 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
31 | ) ON [PRIMARY] | ||
32 | |||
33 | |||
34 | CREATE NONCLUSTERED INDEX [usernames] ON [users] | ||
35 | ( | ||
36 | [username] ASC, | ||
37 | [lastname] ASC | ||
38 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
39 | |||
40 | |||
41 | CREATE TABLE [agents] ( | ||
42 | [UUID] [varchar](36) NOT NULL, | ||
43 | [sessionID] [varchar](36) NOT NULL, | ||
44 | [secureSessionID] [varchar](36) NOT NULL, | ||
45 | [agentIP] [varchar](16) NOT NULL, | ||
46 | [agentPort] [int] NOT NULL, | ||
47 | [agentOnline] [tinyint] NOT NULL, | ||
48 | [loginTime] [int] NOT NULL, | ||
49 | [logoutTime] [int] NOT NULL, | ||
50 | [currentRegion] [varchar](36) NOT NULL, | ||
51 | [currentHandle] [bigint] NOT NULL, | ||
52 | [currentPos] [varchar](64) NOT NULL, | ||
53 | PRIMARY KEY CLUSTERED | ||
54 | ( | ||
55 | [UUID] ASC | ||
56 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
57 | ) ON [PRIMARY] | ||
58 | |||
59 | |||
60 | CREATE NONCLUSTERED INDEX [session] ON [agents] | ||
61 | ( | ||
62 | [sessionID] ASC | ||
63 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
64 | |||
65 | CREATE NONCLUSTERED INDEX [ssession] ON [agents] | ||
66 | ( | ||
67 | [secureSessionID] ASC | ||
68 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
69 | |||
70 | |||
71 | CREATE TABLE [dbo].[userfriends]( | ||
72 | [ownerID] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL, | ||
73 | [friendID] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL, | ||
74 | [friendPerms] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
75 | [datetimestamp] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL | ||
76 | ) ON [PRIMARY] | ||
77 | |||
78 | CREATE TABLE [avatarappearance] ( | ||
79 | [Owner] [varchar](36) NOT NULL, | ||
80 | [Serial] int NOT NULL, | ||
81 | [Visual_Params] [image] NOT NULL, | ||
82 | [Texture] [image] NOT NULL, | ||
83 | [Avatar_Height] float NOT NULL, | ||
84 | [Body_Item] [varchar](36) NOT NULL, | ||
85 | [Body_Asset] [varchar](36) NOT NULL, | ||
86 | [Skin_Item] [varchar](36) NOT NULL, | ||
87 | [Skin_Asset] [varchar](36) NOT NULL, | ||
88 | [Hair_Item] [varchar](36) NOT NULL, | ||
89 | [Hair_Asset] [varchar](36) NOT NULL, | ||
90 | [Eyes_Item] [varchar](36) NOT NULL, | ||
91 | [Eyes_Asset] [varchar](36) NOT NULL, | ||
92 | [Shirt_Item] [varchar](36) NOT NULL, | ||
93 | [Shirt_Asset] [varchar](36) NOT NULL, | ||
94 | [Pants_Item] [varchar](36) NOT NULL, | ||
95 | [Pants_Asset] [varchar](36) NOT NULL, | ||
96 | [Shoes_Item] [varchar](36) NOT NULL, | ||
97 | [Shoes_Asset] [varchar](36) NOT NULL, | ||
98 | [Socks_Item] [varchar](36) NOT NULL, | ||
99 | [Socks_Asset] [varchar](36) NOT NULL, | ||
100 | [Jacket_Item] [varchar](36) NOT NULL, | ||
101 | [Jacket_Asset] [varchar](36) NOT NULL, | ||
102 | [Gloves_Item] [varchar](36) NOT NULL, | ||
103 | [Gloves_Asset] [varchar](36) NOT NULL, | ||
104 | [Undershirt_Item] [varchar](36) NOT NULL, | ||
105 | [Undershirt_Asset] [varchar](36) NOT NULL, | ||
106 | [Underpants_Item] [varchar](36) NOT NULL, | ||
107 | [Underpants_Asset] [varchar](36) NOT NULL, | ||
108 | [Skirt_Item] [varchar](36) NOT NULL, | ||
109 | [Skirt_Asset] [varchar](36) NOT NULL, | ||
110 | |||
111 | PRIMARY KEY CLUSTERED ( | ||
112 | [Owner] | ||
113 | ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
114 | ) ON [PRIMARY] | ||
115 | |||
116 | :VERSION 2 | ||
117 | |||
118 | BEGIN TRANSACTION | ||
119 | |||
120 | ALTER TABLE users ADD homeRegionID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; | ||
121 | ALTER TABLE users ADD userFlags int NOT NULL default 0; | ||
122 | ALTER TABLE users ADD godLevel int NOT NULL default 0; | ||
123 | ALTER TABLE users ADD customType varchar(32) not null default ''; | ||
124 | ALTER TABLE users ADD partner varchar(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
125 | |||
126 | COMMIT | ||
127 | |||
128 | |||
129 | :VERSION 3 | ||
130 | |||
131 | BEGIN TRANSACTION | ||
132 | |||
133 | CREATE TABLE [avatarattachments] ( | ||
134 | [UUID] varchar(36) NOT NULL | ||
135 | , [attachpoint] int NOT NULL | ||
136 | , [item] varchar(36) NOT NULL | ||
137 | , [asset] varchar(36) NOT NULL) | ||
138 | |||
139 | CREATE NONCLUSTERED INDEX IX_avatarattachments ON dbo.avatarattachments | ||
140 | ( | ||
141 | UUID | ||
142 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
143 | |||
144 | |||
145 | COMMIT | ||
146 | |||
147 | |||
148 | :VERSION 4 | ||
149 | |||
150 | BEGIN TRANSACTION | ||
151 | |||
152 | CREATE TABLE Tmp_userfriends | ||
153 | ( | ||
154 | ownerID varchar(36) NOT NULL, | ||
155 | friendID varchar(36) NOT NULL, | ||
156 | friendPerms int NOT NULL, | ||
157 | datetimestamp int NOT NULL | ||
158 | ) ON [PRIMARY] | ||
159 | |||
160 | IF EXISTS(SELECT * FROM userfriends) | ||
161 | EXEC('INSERT INTO dbo.Tmp_userfriends (ownerID, friendID, friendPerms, datetimestamp) | ||
162 | SELECT CONVERT(varchar(36), ownerID), CONVERT(varchar(36), friendID), CONVERT(int, friendPerms), CONVERT(int, datetimestamp) FROM dbo.userfriends WITH (HOLDLOCK TABLOCKX)') | ||
163 | |||
164 | DROP TABLE dbo.userfriends | ||
165 | |||
166 | EXECUTE sp_rename N'Tmp_userfriends', N'userfriends', 'OBJECT' | ||
167 | |||
168 | CREATE NONCLUSTERED INDEX IX_userfriends_ownerID ON userfriends | ||
169 | ( | ||
170 | ownerID | ||
171 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
172 | |||
173 | CREATE NONCLUSTERED INDEX IX_userfriends_friendID ON userfriends | ||
174 | ( | ||
175 | friendID | ||
176 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
177 | |||
178 | COMMIT | ||
179 | |||
180 | |||
181 | :VERSION 5 | ||
182 | |||
183 | BEGIN TRANSACTION | ||
184 | |||
185 | ALTER TABLE users add email varchar(250); | ||
186 | |||
187 | COMMIT | ||
188 | |||
189 | |||
190 | :VERSION 6 | ||
191 | |||
192 | BEGIN TRANSACTION | ||
193 | |||
194 | CREATE TABLE dbo.Tmp_users | ||
195 | ( | ||
196 | UUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
197 | username varchar(32) NOT NULL, | ||
198 | lastname varchar(32) NOT NULL, | ||
199 | passwordHash varchar(32) NOT NULL, | ||
200 | passwordSalt varchar(32) NOT NULL, | ||
201 | homeRegion bigint NULL DEFAULT (NULL), | ||
202 | homeLocationX float(53) NULL DEFAULT (NULL), | ||
203 | homeLocationY float(53) NULL DEFAULT (NULL), | ||
204 | homeLocationZ float(53) NULL DEFAULT (NULL), | ||
205 | homeLookAtX float(53) NULL DEFAULT (NULL), | ||
206 | homeLookAtY float(53) NULL DEFAULT (NULL), | ||
207 | homeLookAtZ float(53) NULL DEFAULT (NULL), | ||
208 | created int NOT NULL, | ||
209 | lastLogin int NOT NULL, | ||
210 | userInventoryURI varchar(255) NULL DEFAULT (NULL), | ||
211 | userAssetURI varchar(255) NULL DEFAULT (NULL), | ||
212 | profileCanDoMask int NULL DEFAULT (NULL), | ||
213 | profileWantDoMask int NULL DEFAULT (NULL), | ||
214 | profileAboutText ntext NULL, | ||
215 | profileFirstText ntext NULL, | ||
216 | profileImage uniqueidentifier NULL DEFAULT (NULL), | ||
217 | profileFirstImage uniqueidentifier NULL DEFAULT (NULL), | ||
218 | webLoginKey uniqueidentifier NULL DEFAULT (NULL), | ||
219 | homeRegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
220 | userFlags int NOT NULL DEFAULT ((0)), | ||
221 | godLevel int NOT NULL DEFAULT ((0)), | ||
222 | customType varchar(32) NOT NULL DEFAULT (''), | ||
223 | partner uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), | ||
224 | email varchar(250) NULL | ||
225 | ) ON [PRIMARY] | ||
226 | TEXTIMAGE_ON [PRIMARY] | ||
227 | |||
228 | IF EXISTS(SELECT * FROM dbo.users) | ||
229 | EXEC('INSERT INTO dbo.Tmp_users (UUID, username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, profileImage, profileFirstImage, webLoginKey, homeRegionID, userFlags, godLevel, customType, partner, email) | ||
230 | SELECT CONVERT(uniqueidentifier, UUID), username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, CONVERT(uniqueidentifier, profileImage), CONVERT(uniqueidentifier, profileFirstImage), CONVERT(uniqueidentifier, webLoginKey), CONVERT(uniqueidentifier, homeRegionID), userFlags, godLevel, customType, CONVERT(uniqueidentifier, partner), email FROM dbo.users WITH (HOLDLOCK TABLOCKX)') | ||
231 | |||
232 | DROP TABLE dbo.users | ||
233 | |||
234 | EXECUTE sp_rename N'dbo.Tmp_users', N'users', 'OBJECT' | ||
235 | |||
236 | ALTER TABLE dbo.users ADD CONSTRAINT | ||
237 | PK__users__65A475E737A5467C PRIMARY KEY CLUSTERED | ||
238 | ( | ||
239 | UUID | ||
240 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
241 | |||
242 | CREATE NONCLUSTERED INDEX usernames ON dbo.users | ||
243 | ( | ||
244 | username, | ||
245 | lastname | ||
246 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
247 | |||
248 | COMMIT | ||
249 | |||
250 | |||
251 | :VERSION 7 | ||
252 | |||
253 | BEGIN TRANSACTION | ||
254 | |||
255 | CREATE TABLE dbo.Tmp_agents | ||
256 | ( | ||
257 | UUID uniqueidentifier NOT NULL, | ||
258 | sessionID uniqueidentifier NOT NULL, | ||
259 | secureSessionID uniqueidentifier NOT NULL, | ||
260 | agentIP varchar(16) NOT NULL, | ||
261 | agentPort int NOT NULL, | ||
262 | agentOnline tinyint NOT NULL, | ||
263 | loginTime int NOT NULL, | ||
264 | logoutTime int NOT NULL, | ||
265 | currentRegion uniqueidentifier NOT NULL, | ||
266 | currentHandle bigint NOT NULL, | ||
267 | currentPos varchar(64) NOT NULL | ||
268 | ) ON [PRIMARY] | ||
269 | |||
270 | IF EXISTS(SELECT * FROM dbo.agents) | ||
271 | EXEC('INSERT INTO dbo.Tmp_agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos) | ||
272 | SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, sessionID), CONVERT(uniqueidentifier, secureSessionID), agentIP, agentPort, agentOnline, loginTime, logoutTime, CONVERT(uniqueidentifier, currentRegion), currentHandle, currentPos FROM dbo.agents WITH (HOLDLOCK TABLOCKX)') | ||
273 | |||
274 | DROP TABLE dbo.agents | ||
275 | |||
276 | EXECUTE sp_rename N'dbo.Tmp_agents', N'agents', 'OBJECT' | ||
277 | |||
278 | ALTER TABLE dbo.agents ADD CONSTRAINT | ||
279 | PK__agents__65A475E749C3F6B7 PRIMARY KEY CLUSTERED | ||
280 | ( | ||
281 | UUID | ||
282 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
283 | |||
284 | CREATE NONCLUSTERED INDEX session ON dbo.agents | ||
285 | ( | ||
286 | sessionID | ||
287 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
288 | |||
289 | CREATE NONCLUSTERED INDEX ssession ON dbo.agents | ||
290 | ( | ||
291 | secureSessionID | ||
292 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
293 | |||
294 | COMMIT | ||
295 | |||
296 | |||
297 | :VERSION 8 | ||
298 | |||
299 | BEGIN TRANSACTION | ||
300 | |||
301 | CREATE TABLE dbo.Tmp_userfriends | ||
302 | ( | ||
303 | ownerID uniqueidentifier NOT NULL, | ||
304 | friendID uniqueidentifier NOT NULL, | ||
305 | friendPerms int NOT NULL, | ||
306 | datetimestamp int NOT NULL | ||
307 | ) ON [PRIMARY] | ||
308 | |||
309 | IF EXISTS(SELECT * FROM dbo.userfriends) | ||
310 | EXEC('INSERT INTO dbo.Tmp_userfriends (ownerID, friendID, friendPerms, datetimestamp) | ||
311 | SELECT CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, friendID), friendPerms, datetimestamp FROM dbo.userfriends WITH (HOLDLOCK TABLOCKX)') | ||
312 | |||
313 | DROP TABLE dbo.userfriends | ||
314 | |||
315 | EXECUTE sp_rename N'dbo.Tmp_userfriends', N'userfriends', 'OBJECT' | ||
316 | |||
317 | CREATE NONCLUSTERED INDEX IX_userfriends_ownerID ON dbo.userfriends | ||
318 | ( | ||
319 | ownerID | ||
320 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
321 | |||
322 | CREATE NONCLUSTERED INDEX IX_userfriends_friendID ON dbo.userfriends | ||
323 | ( | ||
324 | friendID | ||
325 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
326 | |||
327 | COMMIT | ||
328 | |||
329 | |||
330 | :VERSION 9 | ||
331 | |||
332 | BEGIN TRANSACTION | ||
333 | |||
334 | CREATE TABLE dbo.Tmp_avatarappearance | ||
335 | ( | ||
336 | Owner uniqueidentifier NOT NULL, | ||
337 | Serial int NOT NULL, | ||
338 | Visual_Params image NOT NULL, | ||
339 | Texture image NOT NULL, | ||
340 | Avatar_Height float(53) NOT NULL, | ||
341 | Body_Item uniqueidentifier NOT NULL, | ||
342 | Body_Asset uniqueidentifier NOT NULL, | ||
343 | Skin_Item uniqueidentifier NOT NULL, | ||
344 | Skin_Asset uniqueidentifier NOT NULL, | ||
345 | Hair_Item uniqueidentifier NOT NULL, | ||
346 | Hair_Asset uniqueidentifier NOT NULL, | ||
347 | Eyes_Item uniqueidentifier NOT NULL, | ||
348 | Eyes_Asset uniqueidentifier NOT NULL, | ||
349 | Shirt_Item uniqueidentifier NOT NULL, | ||
350 | Shirt_Asset uniqueidentifier NOT NULL, | ||
351 | Pants_Item uniqueidentifier NOT NULL, | ||
352 | Pants_Asset uniqueidentifier NOT NULL, | ||
353 | Shoes_Item uniqueidentifier NOT NULL, | ||
354 | Shoes_Asset uniqueidentifier NOT NULL, | ||
355 | Socks_Item uniqueidentifier NOT NULL, | ||
356 | Socks_Asset uniqueidentifier NOT NULL, | ||
357 | Jacket_Item uniqueidentifier NOT NULL, | ||
358 | Jacket_Asset uniqueidentifier NOT NULL, | ||
359 | Gloves_Item uniqueidentifier NOT NULL, | ||
360 | Gloves_Asset uniqueidentifier NOT NULL, | ||
361 | Undershirt_Item uniqueidentifier NOT NULL, | ||
362 | Undershirt_Asset uniqueidentifier NOT NULL, | ||
363 | Underpants_Item uniqueidentifier NOT NULL, | ||
364 | Underpants_Asset uniqueidentifier NOT NULL, | ||
365 | Skirt_Item uniqueidentifier NOT NULL, | ||
366 | Skirt_Asset uniqueidentifier NOT NULL | ||
367 | ) ON [PRIMARY] | ||
368 | TEXTIMAGE_ON [PRIMARY] | ||
369 | |||
370 | IF EXISTS(SELECT * FROM dbo.avatarappearance) | ||
371 | EXEC('INSERT INTO dbo.Tmp_avatarappearance (Owner, Serial, Visual_Params, Texture, Avatar_Height, Body_Item, Body_Asset, Skin_Item, Skin_Asset, Hair_Item, Hair_Asset, Eyes_Item, Eyes_Asset, Shirt_Item, Shirt_Asset, Pants_Item, Pants_Asset, Shoes_Item, Shoes_Asset, Socks_Item, Socks_Asset, Jacket_Item, Jacket_Asset, Gloves_Item, Gloves_Asset, Undershirt_Item, Undershirt_Asset, Underpants_Item, Underpants_Asset, Skirt_Item, Skirt_Asset) | ||
372 | SELECT CONVERT(uniqueidentifier, Owner), Serial, Visual_Params, Texture, Avatar_Height, CONVERT(uniqueidentifier, Body_Item), CONVERT(uniqueidentifier, Body_Asset), CONVERT(uniqueidentifier, Skin_Item), CONVERT(uniqueidentifier, Skin_Asset), CONVERT(uniqueidentifier, Hair_Item), CONVERT(uniqueidentifier, Hair_Asset), CONVERT(uniqueidentifier, Eyes_Item), CONVERT(uniqueidentifier, Eyes_Asset), CONVERT(uniqueidentifier, Shirt_Item), CONVERT(uniqueidentifier, Shirt_Asset), CONVERT(uniqueidentifier, Pants_Item), CONVERT(uniqueidentifier, Pants_Asset), CONVERT(uniqueidentifier, Shoes_Item), CONVERT(uniqueidentifier, Shoes_Asset), CONVERT(uniqueidentifier, Socks_Item), CONVERT(uniqueidentifier, Socks_Asset), CONVERT(uniqueidentifier, Jacket_Item), CONVERT(uniqueidentifier, Jacket_Asset), CONVERT(uniqueidentifier, Gloves_Item), CONVERT(uniqueidentifier, Gloves_Asset), CONVERT(uniqueidentifier, Undershirt_Item), CONVERT(uniqueidentifier, Undershirt_Asset), CONVERT(uniqueidentifier, Underpants_Item), CONVERT(uniqueidentifier, Underpants_Asset), CONVERT(uniqueidentifier, Skirt_Item), CONVERT(uniqueidentifier, Skirt_Asset) FROM dbo.avatarappearance WITH (HOLDLOCK TABLOCKX)') | ||
373 | |||
374 | DROP TABLE dbo.avatarappearance | ||
375 | |||
376 | EXECUTE sp_rename N'dbo.Tmp_avatarappearance', N'avatarappearance', 'OBJECT' | ||
377 | |||
378 | ALTER TABLE dbo.avatarappearance ADD CONSTRAINT | ||
379 | PK__avatarap__7DD115CC4E88ABD4 PRIMARY KEY CLUSTERED | ||
380 | ( | ||
381 | Owner | ||
382 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
383 | |||
384 | COMMIT | ||
385 | |||
386 | |||
387 | :VERSION 10 | ||
388 | |||
389 | BEGIN TRANSACTION | ||
390 | |||
391 | CREATE TABLE dbo.Tmp_avatarattachments | ||
392 | ( | ||
393 | UUID uniqueidentifier NOT NULL, | ||
394 | attachpoint int NOT NULL, | ||
395 | item uniqueidentifier NOT NULL, | ||
396 | asset uniqueidentifier NOT NULL | ||
397 | ) ON [PRIMARY] | ||
398 | |||
399 | IF EXISTS(SELECT * FROM dbo.avatarattachments) | ||
400 | EXEC('INSERT INTO dbo.Tmp_avatarattachments (UUID, attachpoint, item, asset) | ||
401 | SELECT CONVERT(uniqueidentifier, UUID), attachpoint, CONVERT(uniqueidentifier, item), CONVERT(uniqueidentifier, asset) FROM dbo.avatarattachments WITH (HOLDLOCK TABLOCKX)') | ||
402 | |||
403 | DROP TABLE dbo.avatarattachments | ||
404 | |||
405 | EXECUTE sp_rename N'dbo.Tmp_avatarattachments', N'avatarattachments', 'OBJECT' | ||
406 | |||
407 | CREATE NONCLUSTERED INDEX IX_avatarattachments ON dbo.avatarattachments | ||
408 | ( | ||
409 | UUID | ||
410 | ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | ||
411 | |||
412 | COMMIT | ||
413 | |||
414 | |||
415 | :VERSION 11 | ||
416 | |||
417 | BEGIN TRANSACTION | ||
418 | |||
419 | ALTER TABLE users ADD scopeID uniqueidentifier not null default '00000000-0000-0000-0000-000000000000' | ||
420 | |||
421 | COMMIT | ||
diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs index d778d1c..5d7b169 100644 --- a/OpenSim/Data/Tests/AssetTests.cs +++ b/OpenSim/Data/Tests/AssetTests.cs | |||
@@ -40,9 +40,6 @@ using log4net; | |||
40 | using MySql.Data.MySqlClient; | 40 | using MySql.Data.MySqlClient; |
41 | using OpenSim.Data.MySQL; | 41 | using OpenSim.Data.MySQL; |
42 | 42 | ||
43 | using System.Data.SqlClient; | ||
44 | using OpenSim.Data.MSSQL; | ||
45 | |||
46 | using Mono.Data.Sqlite; | 43 | using Mono.Data.Sqlite; |
47 | using OpenSim.Data.SQLite; | 44 | using OpenSim.Data.SQLite; |
48 | 45 | ||
@@ -58,11 +55,6 @@ namespace OpenSim.Data.Tests | |||
58 | { | 55 | { |
59 | } | 56 | } |
60 | 57 | ||
61 | [TestFixture(Description = "Asset store tests (MS SQL Server)")] | ||
62 | public class MSSQLAssetTests : AssetTests<SqlConnection, MSSQLAssetData> | ||
63 | { | ||
64 | } | ||
65 | |||
66 | public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData> | 58 | public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData> |
67 | where TConn : DbConnection, new() | 59 | where TConn : DbConnection, new() |
68 | where TAssetData : AssetDataBase, new() | 60 | where TAssetData : AssetDataBase, new() |
diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs index 3e47bcf..e2b2d12 100644 --- a/OpenSim/Data/Tests/EstateTests.cs +++ b/OpenSim/Data/Tests/EstateTests.cs | |||
@@ -41,9 +41,6 @@ using System.Data.Common; | |||
41 | using MySql.Data.MySqlClient; | 41 | using MySql.Data.MySqlClient; |
42 | using OpenSim.Data.MySQL; | 42 | using OpenSim.Data.MySQL; |
43 | 43 | ||
44 | using System.Data.SqlClient; | ||
45 | using OpenSim.Data.MSSQL; | ||
46 | |||
47 | using Mono.Data.Sqlite; | 44 | using Mono.Data.Sqlite; |
48 | using OpenSim.Data.SQLite; | 45 | using OpenSim.Data.SQLite; |
49 | 46 | ||
@@ -59,11 +56,6 @@ namespace OpenSim.Data.Tests | |||
59 | { | 56 | { |
60 | } | 57 | } |
61 | 58 | ||
62 | [TestFixture(Description = "Estate store tests (MS SQL Server)")] | ||
63 | public class MSSQLEstateTests : EstateTests<SqlConnection, MSSQLEstateStore> | ||
64 | { | ||
65 | } | ||
66 | |||
67 | public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore> | 59 | public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore> |
68 | where TConn : DbConnection, new() | 60 | where TConn : DbConnection, new() |
69 | where TEstateStore : class, IEstateDataStore, new() | 61 | where TEstateStore : class, IEstateDataStore, new() |
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index 5b6b61b..3edf89d 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs | |||
@@ -39,9 +39,6 @@ using System.Data.Common; | |||
39 | using MySql.Data.MySqlClient; | 39 | using MySql.Data.MySqlClient; |
40 | using OpenSim.Data.MySQL; | 40 | using OpenSim.Data.MySQL; |
41 | 41 | ||
42 | using System.Data.SqlClient; | ||
43 | using OpenSim.Data.MSSQL; | ||
44 | |||
45 | using Mono.Data.Sqlite; | 42 | using Mono.Data.Sqlite; |
46 | using OpenSim.Data.SQLite; | 43 | using OpenSim.Data.SQLite; |
47 | 44 | ||
@@ -57,11 +54,6 @@ namespace OpenSim.Data.Tests | |||
57 | { | 54 | { |
58 | } | 55 | } |
59 | 56 | ||
60 | [TestFixture(Description = "Inventory store tests (MS SQL Server)")] | ||
61 | public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData> | ||
62 | { | ||
63 | } | ||
64 | |||
65 | public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> | 57 | public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> |
66 | where TConn : DbConnection, new() | 58 | where TConn : DbConnection, new() |
67 | where TInvStore : class, IInventoryDataPlugin, new() | 59 | where TInvStore : class, IInventoryDataPlugin, new() |
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index dbed8f6..8d4249a 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -44,9 +44,6 @@ using System.Data.Common; | |||
44 | using MySql.Data.MySqlClient; | 44 | using MySql.Data.MySqlClient; |
45 | using OpenSim.Data.MySQL; | 45 | using OpenSim.Data.MySQL; |
46 | 46 | ||
47 | using System.Data.SqlClient; | ||
48 | using OpenSim.Data.MSSQL; | ||
49 | |||
50 | using Mono.Data.Sqlite; | 47 | using Mono.Data.Sqlite; |
51 | using OpenSim.Data.SQLite; | 48 | using OpenSim.Data.SQLite; |
52 | 49 | ||
@@ -62,11 +59,6 @@ namespace OpenSim.Data.Tests | |||
62 | { | 59 | { |
63 | } | 60 | } |
64 | 61 | ||
65 | [TestFixture(Description = "Region store tests (MS SQL Server)")] | ||
66 | public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLSimulationData> | ||
67 | { | ||
68 | } | ||
69 | |||
70 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> | 62 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> |
71 | where TConn : DbConnection, new() | 63 | where TConn : DbConnection, new() |
72 | where TRegStore : class, ISimulationDataStore, new() | 64 | where TRegStore : class, ISimulationDataStore, new() |
diff --git a/prebuild.xml b/prebuild.xml index 0addf70..90997cf 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -2030,41 +2030,6 @@ | |||
2030 | </Files> | 2030 | </Files> |
2031 | </Project> | 2031 | </Project> |
2032 | 2032 | ||
2033 | <Project frameworkVersion="v4_0" name="OpenSim.Data.MSSQL" path="OpenSim/Data/MSSQL" type="Library"> | ||
2034 | <Configuration name="Debug"> | ||
2035 | <Options> | ||
2036 | <OutputPath>../../../bin/</OutputPath> | ||
2037 | </Options> | ||
2038 | </Configuration> | ||
2039 | <Configuration name="Release"> | ||
2040 | <Options> | ||
2041 | <OutputPath>../../../bin/</OutputPath> | ||
2042 | </Options> | ||
2043 | </Configuration> | ||
2044 | |||
2045 | <ReferencePath>../../../bin/</ReferencePath> | ||
2046 | <Reference name="System"/> | ||
2047 | <Reference name="System.Core"/> | ||
2048 | <Reference name="System.Xml"/> | ||
2049 | <Reference name="System.Data"/> | ||
2050 | <Reference name="System.Drawing"/> | ||
2051 | <Reference name="OpenSim.Framework"/> | ||
2052 | <Reference name="OpenSim.Data"/> | ||
2053 | <Reference name="OpenSim.Region.Framework"/> | ||
2054 | <Reference name="OpenSim.Framework.Console"/> | ||
2055 | <Reference name="OpenMetaverseTypes" path="../../../bin/"/> | ||
2056 | <Reference name="OpenMetaverse" path="../../../bin/"/> | ||
2057 | <Reference name="log4net" path="../../../bin/"/> | ||
2058 | <Reference name="Mono.Addins" path="../../../bin/"/> | ||
2059 | |||
2060 | <Files> | ||
2061 | <Match pattern="*.cs" recurse="true"/> | ||
2062 | <Match buildAction="EmbeddedResource" path="Resources" pattern="*.sql"/> | ||
2063 | <Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/> | ||
2064 | <Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/> | ||
2065 | </Files> | ||
2066 | </Project> | ||
2067 | |||
2068 | <Project frameworkVersion="v4_0" name="OpenSim.Data.PGSQL" path="OpenSim/Data/PGSQL" type="Library"> | 2033 | <Project frameworkVersion="v4_0" name="OpenSim.Data.PGSQL" path="OpenSim/Data/PGSQL" type="Library"> |
2069 | <Configuration name="Debug"> | 2034 | <Configuration name="Debug"> |
2070 | <Options> | 2035 | <Options> |