diff options
author | Homer Horwitz | 2008-11-15 21:27:10 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-11-15 21:27:10 +0000 |
commit | 9a6cdf662b60e7d6f6843826da6a84637d4798b9 (patch) | |
tree | 0ac44924346d5c94b355844ccee83612a3c96ad2 /OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |
parent | - Change llSetRot behavior so it matches the SL behavior (in particular, the (diff) | |
download | opensim-SC_OLD-9a6cdf662b60e7d6f6843826da6a84637d4798b9.zip opensim-SC_OLD-9a6cdf662b60e7d6f6843826da6a84637d4798b9.tar.gz opensim-SC_OLD-9a6cdf662b60e7d6f6843826da6a84637d4798b9.tar.bz2 opensim-SC_OLD-9a6cdf662b60e7d6f6843826da6a84637d4798b9.tar.xz |
Mantis#2626: Thank you Ruud Lathrop, for a patch that cleans up MSSQL code.
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLInventoryData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 87 |
1 files changed, 2 insertions, 85 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index eb31cc8..764b89d 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Data.MSSQL | |||
52 | 52 | ||
53 | #region IPlugin members | 53 | #region IPlugin members |
54 | 54 | ||
55 | [Obsolete("Cannot be default-initialized!")] | ||
55 | public void Initialise() | 56 | public void Initialise() |
56 | { | 57 | { |
57 | m_log.Info("[MSSQLInventoryData]: " + Name + " cannot be default-initialized!"); | 58 | m_log.Info("[MSSQLInventoryData]: " + Name + " cannot be default-initialized!"); |
@@ -65,7 +66,7 @@ namespace OpenSim.Data.MSSQL | |||
65 | /// <remarks>use mssql_connection.ini</remarks> | 66 | /// <remarks>use mssql_connection.ini</remarks> |
66 | public void Initialise(string connectionString) | 67 | public void Initialise(string connectionString) |
67 | { | 68 | { |
68 | if (string.IsNullOrEmpty(connectionString)) | 69 | if (!string.IsNullOrEmpty(connectionString)) |
69 | { | 70 | { |
70 | database = new MSSQLManager(connectionString); | 71 | database = new MSSQLManager(connectionString); |
71 | } | 72 | } |
@@ -83,94 +84,10 @@ namespace OpenSim.Data.MSSQL | |||
83 | settingPassword); | 84 | settingPassword); |
84 | } | 85 | } |
85 | 86 | ||
86 | //TODO remove this at one point | ||
87 | TestTables(); | ||
88 | |||
89 | //New migrations check of store | 87 | //New migrations check of store |
90 | database.CheckMigration(_migrationStore); | 88 | database.CheckMigration(_migrationStore); |
91 | } | 89 | } |
92 | 90 | ||
93 | #region Test and initialization code | ||
94 | |||
95 | /// <summary> | ||
96 | /// Execute "CreateFoldersTable.sql" if tableName == null | ||
97 | /// </summary> | ||
98 | /// <param name="tableName">the table name</param> | ||
99 | private void UpgradeFoldersTable(string tableName) | ||
100 | { | ||
101 | // null as the version, indicates that the table didn't exist | ||
102 | if (tableName == null) | ||
103 | { | ||
104 | database.ExecuteResourceSql("CreateFoldersTable.sql"); | ||
105 | //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql"); | ||
106 | return; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | /// <summary> | ||
111 | /// Execute "CreateItemsTable.sql" if tableName = null | ||
112 | /// </summary> | ||
113 | /// <param name="tableName">the table name</param> | ||
114 | private void UpgradeItemsTable(string tableName) | ||
115 | { | ||
116 | // null as the version, indicates that the table didn't exist | ||
117 | if (tableName == null) | ||
118 | { | ||
119 | database.ExecuteResourceSql("CreateItemsTable.sql"); | ||
120 | //database.ExecuteResourceSql("UpgradeItemsTableToVersion2.sql"); | ||
121 | return; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | /// <summary> | ||
126 | /// | ||
127 | /// </summary> | ||
128 | private void TestTables() | ||
129 | { | ||
130 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | ||
131 | |||
132 | tableList["inventoryfolders"] = null; | ||
133 | tableList["inventoryitems"] = null; | ||
134 | |||
135 | database.GetTableVersion(tableList); | ||
136 | |||
137 | UpgradeFoldersTable(tableList["inventoryfolders"]); | ||
138 | UpgradeItemsTable(tableList["inventoryitems"]); | ||
139 | |||
140 | using (AutoClosingSqlCommand cmd = database.Query("select * from migrations where name = '" + _migrationStore + "'")) | ||
141 | { | ||
142 | //Special for Migrations to create backword compatible | ||
143 | try | ||
144 | { | ||
145 | bool insert = true; | ||
146 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
147 | { | ||
148 | if (reader.Read()) insert = false; | ||
149 | } | ||
150 | if (insert) | ||
151 | { | ||
152 | cmd.CommandText = "insert into migrations(name, version) values('" + _migrationStore + "', 1)"; | ||
153 | cmd.ExecuteNonQuery(); | ||
154 | } | ||
155 | } | ||
156 | catch | ||
157 | { | ||
158 | //No migrations table | ||
159 | //HACK create one and add data | ||
160 | cmd.CommandText = "create table migrations(name varchar(100), version int)"; | ||
161 | cmd.ExecuteNonQuery(); | ||
162 | |||
163 | cmd.CommandText = "insert into migrations(name, version) values('migrations', 1)"; | ||
164 | cmd.ExecuteNonQuery(); | ||
165 | |||
166 | cmd.CommandText = "insert into migrations(name, version) values('" + _migrationStore + "', 1)"; | ||
167 | cmd.ExecuteNonQuery(); | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | |||
172 | #endregion | ||
173 | |||
174 | /// <summary> | 91 | /// <summary> |
175 | /// The name of this DB provider | 92 | /// The name of this DB provider |
176 | /// </summary> | 93 | /// </summary> |