aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-07-02 16:20:54 +0000
committerJustin Clarke Casey2008-07-02 16:20:54 +0000
commit9052c43319ab69f57b80e363d965780be625b0e2 (patch)
tree3e17e9c0908be54ecb01ddff824d6c1a32020e88 /OpenSim/Data/SQLite
parentMantis#1647. Thank you kindly, Sempuki for a patch that: (diff)
downloadopensim-SC-9052c43319ab69f57b80e363d965780be625b0e2.zip
opensim-SC-9052c43319ab69f57b80e363d965780be625b0e2.tar.gz
opensim-SC-9052c43319ab69f57b80e363d965780be625b0e2.tar.bz2
opensim-SC-9052c43319ab69f57b80e363d965780be625b0e2.tar.xz
* Drop InvType from the assets table since it is no longer used
* Migration should be automatic on sqlite and mysql * Migration is not automatic on mssql, you will need to drop the invType column manually * Migration should be fine, but as for any db change, I would recommend making sure you have backups before moving past this revision
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r--OpenSim/Data/SQLite/Resources/002_AssetStore.sql10
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs12
2 files changed, 14 insertions, 8 deletions
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 @@
1BEGIN TRANSACTION;
2
3CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data);
4INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets;
5DROP TABLE assets;
6CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data);
7INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup;
8DROP TABLE assets_backup;
9
10COMMIT;
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"];