aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteAssetData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs47
1 files changed, 19 insertions, 28 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index 72af7a0..3831467 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Data.SQLite
90 /// </summary> 90 /// </summary>
91 /// <param name="uuid">UUID of ... ?</param> 91 /// <param name="uuid">UUID of ... ?</param>
92 /// <returns>Asset base</returns> 92 /// <returns>Asset base</returns>
93 override protected AssetBase FetchStoredAsset(UUID uuid) 93 override public AssetBase GetAsset(UUID uuid)
94 { 94 {
95 lock (this) 95 lock (this)
96 { 96 {
@@ -119,18 +119,16 @@ namespace OpenSim.Data.SQLite
119 /// Create an asset 119 /// Create an asset
120 /// </summary> 120 /// </summary>
121 /// <param name="asset">Asset Base</param> 121 /// <param name="asset">Asset Base</param>
122 override public void CreateAsset(AssetBase asset) 122 override public void StoreAsset(AssetBase asset)
123 { 123 {
124 //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); 124 //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
125 if (ExistsAsset(asset.FullID)) 125 if (ExistsAsset(asset.FullID))
126 { 126 {
127 //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); 127 LogAssetLoad(asset);
128 } 128
129 else
130 {
131 lock (this) 129 lock (this)
132 { 130 {
133 using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) 131 using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
134 { 132 {
135 cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); 133 cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
136 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); 134 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
@@ -144,29 +142,22 @@ namespace OpenSim.Data.SQLite
144 } 142 }
145 } 143 }
146 } 144 }
147 } 145 else
148
149 /// <summary>
150 /// Update an asset
151 /// </summary>
152 /// <param name="asset"></param>
153 override public void UpdateAsset(AssetBase asset)
154 {
155 LogAssetLoad(asset);
156
157 lock (this)
158 { 146 {
159 using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) 147 lock (this)
160 { 148 {
161 cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); 149 using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
162 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); 150 {
163 cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); 151 cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
164 cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); 152 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
165 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); 153 cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
166 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); 154 cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
167 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 155 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
168 156 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
169 cmd.ExecuteNonQuery(); 157 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
158
159 cmd.ExecuteNonQuery();
160 }
170 } 161 }
171 } 162 }
172 } 163 }