diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLManager.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql | 1 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/004_AssetStore.sql | 5 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/Resources/002_AssetStore.sql | 10 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 12 |
7 files changed, 25 insertions, 22 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 44d78ed..3f2e8a7 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -63,6 +63,7 @@ namespace OpenSim.Data.MSSQL | |||
63 | database.ExecuteResourceSql("CreateAssetsTable.sql"); | 63 | database.ExecuteResourceSql("CreateAssetsTable.sql"); |
64 | return; | 64 | return; |
65 | } | 65 | } |
66 | |||
66 | } | 67 | } |
67 | 68 | ||
68 | /// <summary> | 69 | /// <summary> |
@@ -114,9 +115,9 @@ namespace OpenSim.Data.MSSQL | |||
114 | 115 | ||
115 | SqlCommand cmd = | 116 | SqlCommand cmd = |
116 | new SqlCommand( | 117 | new SqlCommand( |
117 | "INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])" + | 118 | "INSERT INTO assets ([id], [name], [description], [assetType], [local], [temporary], [data])" + |
118 | " VALUES " + | 119 | " VALUES " + |
119 | "(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)", | 120 | "(@id, @name, @description, @assetType, @local, @temporary, @data)", |
120 | database.getConnection()); | 121 | database.getConnection()); |
121 | 122 | ||
122 | using (cmd) | 123 | using (cmd) |
@@ -128,8 +129,6 @@ namespace OpenSim.Data.MSSQL | |||
128 | cmd.Parameters.AddWithValue("description", asset.Description); | 129 | cmd.Parameters.AddWithValue("description", asset.Description); |
129 | SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt); | 130 | SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt); |
130 | e.Value = asset.Type; | 131 | e.Value = asset.Type; |
131 | SqlParameter f = cmd.Parameters.Add("invType", SqlDbType.TinyInt); | ||
132 | f.Value = asset.InvType; | ||
133 | SqlParameter g = cmd.Parameters.Add("local", SqlDbType.TinyInt); | 132 | SqlParameter g = cmd.Parameters.Add("local", SqlDbType.TinyInt); |
134 | g.Value = asset.Local; | 133 | g.Value = asset.Local; |
135 | SqlParameter h = cmd.Parameters.Add("temporary", SqlDbType.TinyInt); | 134 | SqlParameter h = cmd.Parameters.Add("temporary", SqlDbType.TinyInt); |
@@ -159,7 +158,6 @@ namespace OpenSim.Data.MSSQL | |||
159 | "name = @name, " + | 158 | "name = @name, " + |
160 | "description = @description," + | 159 | "description = @description," + |
161 | "assetType = @assetType," + | 160 | "assetType = @assetType," + |
162 | "invType = @invType," + | ||
163 | "local = @local," + | 161 | "local = @local," + |
164 | "temporary = @temporary," + | 162 | "temporary = @temporary," + |
165 | "data = @data where " + | 163 | "data = @data where " + |
@@ -168,7 +166,6 @@ namespace OpenSim.Data.MSSQL | |||
168 | SqlParameter param2 = new SqlParameter("@name", asset.Name); | 166 | SqlParameter param2 = new SqlParameter("@name", asset.Name); |
169 | SqlParameter param3 = new SqlParameter("@description", asset.Description); | 167 | SqlParameter param3 = new SqlParameter("@description", asset.Description); |
170 | SqlParameter param4 = new SqlParameter("@assetType", asset.Type); | 168 | SqlParameter param4 = new SqlParameter("@assetType", asset.Type); |
171 | SqlParameter param5 = new SqlParameter("@invType", asset.InvType); | ||
172 | SqlParameter param6 = new SqlParameter("@local", asset.Local); | 169 | SqlParameter param6 = new SqlParameter("@local", asset.Local); |
173 | SqlParameter param7 = new SqlParameter("@temporary", asset.Temporary); | 170 | SqlParameter param7 = new SqlParameter("@temporary", asset.Temporary); |
174 | SqlParameter param8 = new SqlParameter("@data", asset.Data); | 171 | SqlParameter param8 = new SqlParameter("@data", asset.Data); |
@@ -177,7 +174,6 @@ namespace OpenSim.Data.MSSQL | |||
177 | command.Parameters.Add(param2); | 174 | command.Parameters.Add(param2); |
178 | command.Parameters.Add(param3); | 175 | command.Parameters.Add(param3); |
179 | command.Parameters.Add(param4); | 176 | command.Parameters.Add(param4); |
180 | command.Parameters.Add(param5); | ||
181 | command.Parameters.Add(param6); | 177 | command.Parameters.Add(param6); |
182 | command.Parameters.Add(param7); | 178 | command.Parameters.Add(param7); |
183 | command.Parameters.Add(param8); | 179 | command.Parameters.Add(param8); |
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index bea02fe..e421c5d 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs | |||
@@ -405,7 +405,6 @@ namespace OpenSim.Data.MSSQL | |||
405 | asset.Data = (byte[])reader["data"]; | 405 | asset.Data = (byte[])reader["data"]; |
406 | asset.Description = (string)reader["description"]; | 406 | asset.Description = (string)reader["description"]; |
407 | asset.FullID = new LLUUID((string)reader["id"]); | 407 | asset.FullID = new LLUUID((string)reader["id"]); |
408 | asset.InvType = Convert.ToSByte(reader["invType"]); | ||
409 | asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; | 408 | asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; |
410 | asset.Name = (string)reader["name"]; | 409 | asset.Name = (string)reader["name"]; |
411 | asset.Type = Convert.ToSByte(reader["assetType"]); | 410 | asset.Type = Convert.ToSByte(reader["assetType"]); |
diff --git a/OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql b/OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql index c7cb21a..4d94699 100644 --- a/OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql +++ b/OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql | |||
@@ -6,7 +6,6 @@ CREATE TABLE [assets] ( | |||
6 | [name] [varchar](64) NOT NULL, | 6 | [name] [varchar](64) NOT NULL, |
7 | [description] [varchar](64) NOT NULL, | 7 | [description] [varchar](64) NOT NULL, |
8 | [assetType] [tinyint] NOT NULL, | 8 | [assetType] [tinyint] NOT NULL, |
9 | [invType] [tinyint] NOT NULL, | ||
10 | [local] [tinyint] NOT NULL, | 9 | [local] [tinyint] NOT NULL, |
11 | [temporary] [tinyint] NOT NULL, | 10 | [temporary] [tinyint] NOT NULL, |
12 | [data] [image] NOT NULL, | 11 | [data] [image] NOT NULL, |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index d66a5c2..21d730d 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -164,7 +164,7 @@ namespace OpenSim.Data.MySQL | |||
164 | { | 164 | { |
165 | MySqlCommand cmd = | 165 | MySqlCommand cmd = |
166 | new MySqlCommand( | 166 | new MySqlCommand( |
167 | "SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", | 167 | "SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id", |
168 | _dbConnection.Connection); | 168 | _dbConnection.Connection); |
169 | cmd.Parameters.AddWithValue("?id", assetID.ToString()); | 169 | cmd.Parameters.AddWithValue("?id", assetID.ToString()); |
170 | 170 | ||
@@ -178,7 +178,6 @@ namespace OpenSim.Data.MySQL | |||
178 | asset.Data = (byte[]) dbReader["data"]; | 178 | asset.Data = (byte[]) dbReader["data"]; |
179 | asset.Description = (string) dbReader["description"]; | 179 | asset.Description = (string) dbReader["description"]; |
180 | asset.FullID = assetID; | 180 | asset.FullID = assetID; |
181 | asset.InvType = (sbyte) dbReader["invType"]; | ||
182 | asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; | 181 | asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; |
183 | asset.Name = (string) dbReader["name"]; | 182 | asset.Name = (string) dbReader["name"]; |
184 | asset.Type = (sbyte) dbReader["assetType"]; | 183 | asset.Type = (sbyte) dbReader["assetType"]; |
@@ -216,8 +215,8 @@ namespace OpenSim.Data.MySQL | |||
216 | 215 | ||
217 | MySqlCommand cmd = | 216 | MySqlCommand cmd = |
218 | new MySqlCommand( | 217 | new MySqlCommand( |
219 | "REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + | 218 | "REPLACE INTO assets(id, name, description, assetType, local, temporary, data)" + |
220 | "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", | 219 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?data)", |
221 | _dbConnection.Connection); | 220 | _dbConnection.Connection); |
222 | 221 | ||
223 | // need to ensure we dispose | 222 | // need to ensure we dispose |
@@ -229,7 +228,6 @@ namespace OpenSim.Data.MySQL | |||
229 | cmd.Parameters.AddWithValue("?name", asset.Name); | 228 | cmd.Parameters.AddWithValue("?name", asset.Name); |
230 | cmd.Parameters.AddWithValue("?description", asset.Description); | 229 | cmd.Parameters.AddWithValue("?description", asset.Description); |
231 | cmd.Parameters.AddWithValue("?assetType", asset.Type); | 230 | cmd.Parameters.AddWithValue("?assetType", asset.Type); |
232 | cmd.Parameters.AddWithValue("?invType", asset.InvType); | ||
233 | cmd.Parameters.AddWithValue("?local", asset.Local); | 231 | cmd.Parameters.AddWithValue("?local", asset.Local); |
234 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); | 232 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); |
235 | cmd.Parameters.AddWithValue("?data", asset.Data); | 233 | cmd.Parameters.AddWithValue("?data", asset.Data); |
diff --git a/OpenSim/Data/MySQL/Resources/004_AssetStore.sql b/OpenSim/Data/MySQL/Resources/004_AssetStore.sql new file mode 100644 index 0000000..9e9b9fe --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/004_AssetStore.sql | |||
@@ -0,0 +1,5 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE assets drop InvType; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/Resources/002_AssetStore.sql b/OpenSim/Data/SQLite/Resources/002_AssetStore.sql new file mode 100644 index 0000000..41ca640 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/002_AssetStore.sql | |||
@@ -0,0 +1,10 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data); | ||
4 | INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets; | ||
5 | DROP TABLE assets; | ||
6 | CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data); | ||
7 | INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup; | ||
8 | DROP TABLE assets_backup; | ||
9 | |||
10 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 24c75e3..8fa09fc 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -50,8 +50,8 @@ namespace OpenSim.Data.SQLite | |||
50 | /// </summary> | 50 | /// </summary> |
51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; | 51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; |
52 | private const string DeleteAssetSQL = "delete from assets where UUID=:UUID"; | 52 | private const string DeleteAssetSQL = "delete from assets where UUID=:UUID"; |
53 | private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, InvType, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :InvType, :Local, :Temporary, :Data)"; | 53 | private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)"; |
54 | private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; | 54 | private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; |
55 | private const string assetSelect = "select * from assets"; | 55 | private const string assetSelect = "select * from assets"; |
56 | 56 | ||
57 | private SqliteConnection m_conn; | 57 | private SqliteConnection m_conn; |
@@ -134,7 +134,6 @@ namespace OpenSim.Data.SQLite | |||
134 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 134 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); |
135 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 135 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); |
136 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 136 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
137 | cmd.Parameters.Add(new SqliteParameter(":InvType", asset.InvType)); | ||
138 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 137 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
139 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 138 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
140 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | 139 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); |
@@ -158,7 +157,6 @@ namespace OpenSim.Data.SQLite | |||
158 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 157 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); |
159 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 158 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); |
160 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 159 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
161 | cmd.Parameters.Add(new SqliteParameter(":InvType", asset.InvType)); | ||
162 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 160 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
163 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 161 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
164 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | 162 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); |
@@ -180,9 +178,9 @@ namespace OpenSim.Data.SQLite | |||
180 | int assetLength = (asset.Data != null) ? asset.Data.Length : 0; | 178 | int assetLength = (asset.Data != null) ? asset.Data.Length : 0; |
181 | 179 | ||
182 | m_log.Info("[ASSET DB]: " + | 180 | m_log.Info("[ASSET DB]: " + |
183 | string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)", | 181 | string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)", |
184 | asset.FullID, asset.Name, asset.Description, asset.Type, | 182 | asset.FullID, asset.Name, asset.Description, asset.Type, |
185 | asset.InvType, temporary, local, assetLength)); | 183 | temporary, local, assetLength)); |
186 | } | 184 | } |
187 | 185 | ||
188 | /// <summary> | 186 | /// <summary> |
@@ -258,7 +256,6 @@ namespace OpenSim.Data.SQLite | |||
258 | // SQLiteUtil.createCol(assets, "Name", typeof (String)); | 256 | // SQLiteUtil.createCol(assets, "Name", typeof (String)); |
259 | // SQLiteUtil.createCol(assets, "Description", typeof (String)); | 257 | // SQLiteUtil.createCol(assets, "Description", typeof (String)); |
260 | // SQLiteUtil.createCol(assets, "Type", typeof (Int32)); | 258 | // SQLiteUtil.createCol(assets, "Type", typeof (Int32)); |
261 | // SQLiteUtil.createCol(assets, "InvType", typeof (Int32)); | ||
262 | // SQLiteUtil.createCol(assets, "Local", typeof (Boolean)); | 259 | // SQLiteUtil.createCol(assets, "Local", typeof (Boolean)); |
263 | // SQLiteUtil.createCol(assets, "Temporary", typeof (Boolean)); | 260 | // SQLiteUtil.createCol(assets, "Temporary", typeof (Boolean)); |
264 | // SQLiteUtil.createCol(assets, "Data", typeof (Byte[])); | 261 | // SQLiteUtil.createCol(assets, "Data", typeof (Byte[])); |
@@ -291,7 +288,6 @@ namespace OpenSim.Data.SQLite | |||
291 | asset.Name = (String) row["Name"]; | 288 | asset.Name = (String) row["Name"]; |
292 | asset.Description = (String) row["Description"]; | 289 | asset.Description = (String) row["Description"]; |
293 | asset.Type = Convert.ToSByte(row["Type"]); | 290 | asset.Type = Convert.ToSByte(row["Type"]); |
294 | asset.InvType = Convert.ToSByte(row["InvType"]); | ||
295 | asset.Local = Convert.ToBoolean(row["Local"]); | 291 | asset.Local = Convert.ToBoolean(row["Local"]); |
296 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); | 292 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); |
297 | asset.Data = (byte[]) row["Data"]; | 293 | asset.Data = (byte[]) row["Data"]; |