From d72bdf432a622f237b3030c1da9d1bccca20f83c Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 1 May 2008 13:27:40 +0000 Subject: * Align new fields upgrade sql to have the same 'not null' and default settings as when an inventoryitems table is newly created * Normalize logging titles in database code, though this doesn't yet cover invoking code --- OpenSim/Data/MySQL/MySQLAssetData.cs | 6 +-- OpenSim/Data/MySQL/MySQLDataStore.cs | 46 +++++++++++----------- OpenSim/Data/MySQL/MySQLGridData.cs | 2 +- OpenSim/Data/MySQL/MySQLManager.cs | 2 +- OpenSim/Data/MySQL/MySQLUserData.cs | 2 +- OpenSim/Data/MySQL/Resources/CreateItemsTable.sql | 12 +++--- .../Resources/UpgradeItemsTableToVersion3.sql | 2 +- 7 files changed, 36 insertions(+), 36 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index b4a9191..efcf59e 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -49,7 +49,7 @@ namespace OpenSim.Data.MySQL // null as the version, indicates that the table didn't exist if (oldVersion == null) { - m_log.Info("[ASSETS]: Creating new database tables"); + m_log.Info("[ASSETS DB]: Creating new database tables"); _dbConnection.ExecuteResourceSql("CreateAssetsTable.sql"); return; } @@ -102,7 +102,7 @@ namespace OpenSim.Data.MySQL catch (Exception e) { m_log.ErrorFormat( - "[ASSETS]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString() + "[ASSETS DB]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString() + Environment.NewLine + "Attempting reconnection", assetID); _dbConnection.Reconnect(); } @@ -141,7 +141,7 @@ namespace OpenSim.Data.MySQL catch (Exception e) { m_log.ErrorFormat( - "[ASSETS]: " + + "[ASSETS DB]: " + "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); _dbConnection.Reconnect(); diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs index 1f9ea70..33981de 100644 --- a/OpenSim/Data/MySQL/MySQLDataStore.cs +++ b/OpenSim/Data/MySQL/MySQLDataStore.cs @@ -88,7 +88,7 @@ namespace OpenSim.Data.MySQL m_dataSet = new DataSet(); this.persistPrimInventories = persistPrimInventories; - m_log.Info("[DATASTORE]: MySql - connecting: " + connectionstring); + m_log.Info("[REGION DB]: MySql - connecting: " + connectionstring); m_connection = new MySqlConnection(connectionstring); TestTablesVersionable(m_connection); @@ -256,7 +256,7 @@ namespace OpenSim.Data.MySQL { if ((prim.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) == 0) { - m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID); + m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); addPrim(prim, obj.UUID, regionUUID); } else @@ -270,7 +270,7 @@ namespace OpenSim.Data.MySQL public void RemoveObject(LLUUID obj, LLUUID regionUUID) { - m_log.InfoFormat("[DATASTORE]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); + m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); DataTable prims = m_primTable; DataTable shapes = m_shapeTable; @@ -334,7 +334,7 @@ namespace OpenSim.Data.MySQL lock (m_dataSet) { DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); - m_log.Info("[DATASTORE]: " + + m_log.Info("[REGION DB]: " + "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); foreach (DataRow primRow in primsForRegion) @@ -390,11 +390,11 @@ namespace OpenSim.Data.MySQL } catch (Exception e) { - m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows"); - m_log.Info("[DATASTORE]: " + e.ToString()); + m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); + m_log.Info("[REGION DB]: " + e.ToString()); foreach (DataColumn col in prims.Columns) { - m_log.Info("[DATASTORE]: Col: " + col.ColumnName + " => " + primRow[col]); + m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); } } } @@ -438,7 +438,7 @@ namespace OpenSim.Data.MySQL public void StoreTerrain(double[,] ter, LLUUID regionID) { int revision = Util.UnixTimeSinceEpoch(); - m_log.Info("[DATASTORE]: Storing terrain revision r" + revision.ToString()); + m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); DataTable terrain = m_dataSet.Tables["terrain"]; lock (m_dataSet) @@ -493,11 +493,11 @@ namespace OpenSim.Data.MySQL } else { - m_log.Info("[DATASTORE]: No terrain found for region"); + m_log.Info("[REGION DB]: No terrain found for region"); return null; } - m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString()); + m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); } } return terret; @@ -1329,7 +1329,7 @@ namespace OpenSim.Data.MySQL if (!persistPrimInventories) return; - m_log.InfoFormat("[DATASTORE]: Persisting Prim Inventory with prim ID {0}", primID); + m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID); // For now, we're just going to crudely remove all the previous inventory items // no matter whether they have changed or not, and replace them with the current set. @@ -1341,7 +1341,7 @@ namespace OpenSim.Data.MySQL foreach (TaskInventoryItem newItem in items) { // m_log.InfoFormat( -// "[DATASTORE]: " + +// "[REGION DB]: " + // "Adding item {0}, {1} to prim ID {2}", // newItem.Name, newItem.ItemID, newItem.ParentPartID); @@ -1572,8 +1572,8 @@ namespace OpenSim.Data.MySQL } catch (Exception ex) { - m_log.Error("[MySql]: Error connecting to MySQL server: " + ex.Message); - m_log.Error("[MySql]: Application is terminating!"); + m_log.Error("[REGION DB]: Error connecting to MySQL server: " + ex.Message); + m_log.Error("[REGION DB]: Application is terminating!"); Thread.CurrentThread.Abort(); } } @@ -1584,7 +1584,7 @@ namespace OpenSim.Data.MySQL } catch (MySqlException e) { - m_log.WarnFormat("[MySql]: Primitives Table Already Exists: {0}", e); + m_log.WarnFormat("[REGION DB]: Primitives Table Already Exists: {0}", e); } try @@ -1593,7 +1593,7 @@ namespace OpenSim.Data.MySQL } catch (MySqlException e) { - m_log.WarnFormat("[MySql]: Shapes Table Already Exists: {0}", e); + m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e); } try @@ -1602,7 +1602,7 @@ namespace OpenSim.Data.MySQL } catch (MySqlException e) { - m_log.WarnFormat("[MySql]: Items Table Already Exists: {0}", e); + m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e); } try @@ -1611,7 +1611,7 @@ namespace OpenSim.Data.MySQL } catch (MySqlException e) { - m_log.WarnFormat("[MySql]: Terrain Table Already Exists: {0}", e); + m_log.WarnFormat("[REGION DB]: Terrain Table Already Exists: {0}", e); } //try @@ -1629,7 +1629,7 @@ namespace OpenSim.Data.MySQL } catch (MySqlException e) { - m_log.WarnFormat("[MySql]: LandAccessList Table Already Exists: {0}", e); + m_log.WarnFormat("[REGION DB]: LandAccessList Table Already Exists: {0}", e); } conn.Close(); } @@ -1682,7 +1682,7 @@ namespace OpenSim.Data.MySQL { if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) { - m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); + m_log.Info("[REGION DB]: Missing required column:" + col.ColumnName); return false; } } @@ -1691,7 +1691,7 @@ namespace OpenSim.Data.MySQL { if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) { - m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName); + m_log.Info("[REGION DB]: Missing required column:" + col.ColumnName); return false; } } @@ -1702,7 +1702,7 @@ namespace OpenSim.Data.MySQL { if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) { - m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); + m_log.Info("[REGION DB]: Missing require column:" + col.ColumnName); return false; } } @@ -1711,7 +1711,7 @@ namespace OpenSim.Data.MySQL { if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) { - m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName); + m_log.Info("[REGION DB]: Missing require column:" + col.ColumnName); return false; } } diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index b6274d4..df52ae0 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs @@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL } else { - m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters"); + m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters"); return null; } } diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index d522b78..c62cfa7 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs @@ -89,7 +89,7 @@ namespace OpenSim.Data.MySQL } catch(Exception e) { - throw new Exception( "Connection error while using connection string ["+connectionString+"]", e ); + throw new Exception("Connection error while using connection string ["+connectionString+"]", e); } m_log.Info("[MYSQL]: Connection established"); diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 66b65dc..382d69c 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -346,7 +346,7 @@ namespace OpenSim.Data.MySQL override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) { - m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); + m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called"); } override public List GeneratePickerResults(LLUUID queryID, string query) diff --git a/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql b/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql index 24ebccd..ffdbe17 100644 --- a/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql +++ b/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql @@ -12,12 +12,12 @@ CREATE TABLE `inventoryitems` ( `creatorID` varchar(36) default NULL, `inventoryBasePermissions` int(10) unsigned NOT NULL default 0, `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0, - `salePrice` int(11) default NULL, - `saleType` tinyint(4) default NULL, - `creationDate` int(11) default NULL, - `groupID` varchar(36) default NULL, - `groupOwned` tinyint(4) default NULL, - `flags` int(11) unsigned default NULL, + `salePrice` int(11) NOT NULL default 0, + `saleType` tinyint(4) NOT NULL default 0, + `creationDate` int(11) NOT NULL default 0, + `groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000', + `groupOwned` tinyint(4) NOT NULL default 0, + `flags` int(11) unsigned NOT NULL default 0, PRIMARY KEY (`inventoryID`), KEY `owner` (`avatarID`), KEY `folder` (`parentFolderID`) diff --git a/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql b/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql index 5bd6994..b4108ab 100644 --- a/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql +++ b/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql @@ -1,7 +1,7 @@ ALTER TABLE `inventoryitems` ADD COLUMN `salePrice` int(11) NOT NULL default 0, ADD COLUMN `saleType` tinyint(4) NOT NULL default 0, - ADD COLUMN `creationDate` int(11) NOT NULL default 3000, + ADD COLUMN `creationDate` int(11) NOT NULL default 0, ADD COLUMN `groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000', ADD COLUMN `groupOwned` tinyint(4) NOT NULL default 0, ADD COLUMN `flags` int(11) unsigned NOT NULL default 0, -- cgit v1.1