added some debugging for tracing where asset code isn't working with sqlite

afrisby
Sean Dague 2007-09-10 13:34:20 +00:00
parent ffe9c9374a
commit a1be7f4be5
4 changed files with 328 additions and 305 deletions

View File

@ -128,7 +128,7 @@ namespace OpenSim.Framework.Communications.Caches
{ {
ARequest req = this._assetRequests.Dequeue(); ARequest req = this._assetRequests.Dequeue();
m_plugin.FetchAsset(req.AssetID); MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
AssetBase asset = m_plugin.FetchAsset(req.AssetID); AssetBase asset = m_plugin.FetchAsset(req.AssetID);
if (asset != null) if (asset != null)
@ -269,6 +269,7 @@ namespace OpenSim.Framework.Communications.Caches
string fileName = source.Configs[i].GetString("fileName", ""); string fileName = source.Configs[i].GetString("fileName", "");
if (fileName != "") if (fileName != "")
{ {
MainLog.Instance.Verbose("Creating new asset: " + newAsset.Name);
this.LoadAsset(newAsset, false, fileName); this.LoadAsset(newAsset, false, fileName);
m_plugin.CreateAsset(newAsset); m_plugin.CreateAsset(newAsset);
} }

View File

@ -100,6 +100,15 @@ namespace OpenSim.Framework.Data.SQLite
public void UpdateAsset(AssetBase asset) public void UpdateAsset(AssetBase asset)
{ {
MainLog.Instance.Verbose("AssetStorage",
"Asset: " + asset.FullID +
", Name: " + asset.Name +
", Description: " + asset.Description +
", Type: " + asset.Type +
", InvType: " + asset.InvType +
", Temporary: " + asset.Temporary +
", Local: " + asset.Local +
", Data Length: " + asset.Data.Length );
DataTable assets = ds.Tables["assets"]; DataTable assets = ds.Tables["assets"];
DataRow row = assets.Rows.Find(asset.FullID); DataRow row = assets.Rows.Find(asset.FullID);
if (row == null) if (row == null)
@ -112,6 +121,11 @@ namespace OpenSim.Framework.Data.SQLite
{ {
fillAssetRow(row, asset); fillAssetRow(row, asset);
} }
if (ds.HasChanges()) {
DataSet changed = ds.GetChanges();
da.Update(changed, "assets");
ds.AcceptChanges();
}
} }
public bool ExistsAsset(LLUUID uuid) public bool ExistsAsset(LLUUID uuid)
@ -122,7 +136,12 @@ namespace OpenSim.Framework.Data.SQLite
public void CommitAssets() // force a sync to the database public void CommitAssets() // force a sync to the database
{ {
da.Update(ds, "assets"); MainLog.Instance.Verbose("AssetStorage", "Attempting commit");
if (ds.HasChanges()) {
DataSet changed = ds.GetChanges();
da.Update(changed, "assets");
ds.AcceptChanges();
}
} }
/*********************************************************************** /***********************************************************************

View File

@ -197,6 +197,8 @@ namespace OpenSim.Framework.Data.SQLite
return DbType.UInt64; return DbType.UInt64;
} else if (type == typeof(System.Double)) { } else if (type == typeof(System.Double)) {
return DbType.Double; return DbType.Double;
} else if (type == typeof(System.Boolean)) {
return DbType.Boolean;
} else if (type == typeof(System.Byte[])) { } else if (type == typeof(System.Byte[])) {
return DbType.Binary; return DbType.Binary;
} else { } else {
@ -220,6 +222,8 @@ namespace OpenSim.Framework.Data.SQLite
return "varchar(255)"; return "varchar(255)";
} else if (type == typeof(System.Double)) { } else if (type == typeof(System.Double)) {
return "float"; return "float";
} else if (type == typeof(System.Boolean)) {
return "integer";
} else if (type == typeof(System.Byte[])) { } else if (type == typeof(System.Byte[])) {
return "blob"; return "blob";
} else { } else {

View File

@ -35,15 +35,14 @@ namespace OpenSim.Framework.Types
public LLUUID FullID; public LLUUID FullID;
public sbyte Type; public sbyte Type;
public sbyte InvType; public sbyte InvType;
public string Name; public string Name = "";
public string Description; public string Description = "";
public bool Local; public bool Local = false;
public bool Temporary; public bool Temporary = false;
public AssetBase() public AssetBase()
{ {
Name = " ";
Description = " ";
} }
} }
} }