From d399bd3eb7de6bab531087a1956f30457c3285ff Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Jun 2010 21:18:52 +0100 Subject: minor: fix spelling mistake interupt -> interrupt in migrations This is for mantis 4783 --- OpenSim/Data/Migration.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 4f113a2..c177097 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -67,7 +67,6 @@ namespace OpenSim.Data /// really want is the assembly of your database class. /// /// - public class Migration { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -173,8 +172,6 @@ namespace OpenSim.Data ExecuteScript(_conn, script); } - - public void Update() { InitMigrationsTable(); @@ -186,8 +183,8 @@ namespace OpenSim.Data return; // to prevent people from killing long migrations. - m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); - m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); + m_log.InfoFormat("[MIGRATIONS]: Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); + m_log.Info("[MIGRATIONS]: NOTE - this may take a while, don't interrupt this process!"); foreach (KeyValuePair kvp in migrations) { @@ -206,7 +203,7 @@ namespace OpenSim.Data } catch (Exception e) { - m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", e.Message.Replace("\n", " ")); + m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " ")); m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing."); ExecuteScript("ROLLBACK;"); } -- cgit v1.1 From b0129b35f8dbe24b8e857223b3ac8ba4cb7cc830 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Jun 2010 12:37:16 -0700 Subject: Added checks to XInventory DB layer to truncate names and descriptions. --- OpenSim/Data/MySQL/MySQLXInventoryData.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 0fe801d..3c73095 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs @@ -64,14 +64,22 @@ namespace OpenSim.Data.MySQL public bool StoreFolder(XInventoryFolder folder) { + if (folder.folderName.Length > 64) + folder.folderName = folder.folderName.Substring(0, 64); + return m_Folders.Store(folder); } public bool StoreItem(XInventoryItem item) { + if (item.inventoryName.Length > 64) + item.inventoryName = item.inventoryName.Substring(0, 64); + if (item.inventoryDescription.Length > 128) + item.inventoryDescription = item.inventoryDescription.Substring(0, 128); + return m_Items.Store(item); } - + public bool DeleteFolders(string field, string val) { return m_Folders.Delete(field, val); -- cgit v1.1 From 76d2f0f68e16f9b74ce4f81f9ecbf370f39f3ac6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Jun 2010 12:40:17 -0700 Subject: Same patch as before but for SQLite. --- OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 6064538..ca651e1 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -66,11 +66,19 @@ namespace OpenSim.Data.SQLite public bool StoreFolder(XInventoryFolder folder) { + if (folder.folderName.Length > 64) + folder.folderName = folder.folderName.Substring(0, 64); + return m_Folders.Store(folder); } public bool StoreItem(XInventoryItem item) { + if (item.inventoryName.Length > 64) + item.inventoryName = item.inventoryName.Substring(0, 64); + if (item.inventoryDescription.Length > 128) + item.inventoryDescription = item.inventoryDescription.Substring(0, 128); + return m_Items.Store(item); } -- cgit v1.1 From a5a1df68c29b2d78279bcff60ce66fe97772d0c6 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 28 Jun 2010 04:02:33 -0700 Subject: Provide the interface for StoreAsset to report success or failure --- OpenSim/Data/AssetDataBase.cs | 2 +- OpenSim/Data/IAssetData.cs | 2 +- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 4 +++- OpenSim/Data/MySQL/MySQLAssetData.cs | 4 +++- OpenSim/Data/SQLite/SQLiteAssetData.cs | 4 +++- OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs | 4 +++- 6 files changed, 14 insertions(+), 6 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index e1a810c..b4ae913 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs @@ -38,7 +38,7 @@ namespace OpenSim.Data { public abstract AssetBase GetAsset(UUID uuid); - public abstract void StoreAsset(AssetBase asset); + public abstract bool StoreAsset(AssetBase asset); public abstract bool ExistsAsset(UUID uuid); public abstract List FetchAssetMetadataSet(int start, int count); diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs index 90d5eeb..065d3a5 100644 --- a/OpenSim/Data/IAssetData.cs +++ b/OpenSim/Data/IAssetData.cs @@ -34,7 +34,7 @@ namespace OpenSim.Data public interface IAssetDataPlugin : IPlugin { AssetBase GetAsset(UUID uuid); - void StoreAsset(AssetBase asset); + bool StoreAsset(AssetBase asset); bool ExistsAsset(UUID uuid); List FetchAssetMetadataSet(int start, int count); void Initialise(string connect); diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index c7488d8..c882555 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -143,7 +143,7 @@ namespace OpenSim.Data.MSSQL /// Create asset in m_database /// /// the asset - override public void StoreAsset(AssetBase asset) + override public bool StoreAsset(AssetBase asset) { string sql = @@ -192,10 +192,12 @@ namespace OpenSim.Data.MSSQL try { command.ExecuteNonQuery(); + return true; } catch(Exception e) { m_log.Error("[ASSET DB]: Error storing item :" + e.Message); + return false; } } } diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index fe5152a..f9ce3d9 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -153,7 +153,7 @@ namespace OpenSim.Data.MySQL /// /// Asset UUID to create /// On failure : Throw an exception and attempt to reconnect to database - override public void StoreAsset(AssetBase asset) + override public bool StoreAsset(AssetBase asset) { lock (m_dbLock) { @@ -201,12 +201,14 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?data", asset.Data); cmd.ExecuteNonQuery(); cmd.Dispose(); + return true; } } catch (Exception e) { m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", asset.FullID, asset.Name, e.Message); + return false; } } } diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 16e560c..75e51a3 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLite /// Create an asset /// /// Asset Base - override public void StoreAsset(AssetBase asset) + override public bool StoreAsset(AssetBase asset) { //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); if (ExistsAsset(asset.FullID)) @@ -141,6 +141,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); + return true; } } } @@ -161,6 +162,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); + return true; } } } diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs index df50902..3da298b 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs @@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLiteLegacy /// Create an asset /// /// Asset Base - override public void StoreAsset(AssetBase asset) + override public bool StoreAsset(AssetBase asset) { //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); if (ExistsAsset(asset.FullID)) @@ -139,6 +139,7 @@ namespace OpenSim.Data.SQLiteLegacy cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); + return true; } } } @@ -157,6 +158,7 @@ namespace OpenSim.Data.SQLiteLegacy cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); + return true; } } } -- cgit v1.1