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/MSSQLGridData.cs | |
parent | - Change llSetRot behavior so it matches the SL behavior (in particular, the (diff) | |
download | opensim-SC-9a6cdf662b60e7d6f6843826da6a84637d4798b9.zip opensim-SC-9a6cdf662b60e7d6f6843826da6a84637d4798b9.tar.gz opensim-SC-9a6cdf662b60e7d6f6843826da6a84637d4798b9.tar.bz2 opensim-SC-9a6cdf662b60e7d6f6843826da6a84637d4798b9.tar.xz |
Mantis#2626: Thank you Ruud Lathrop, for a patch that cleans up MSSQL code.
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLGridData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGridData.cs | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index ace3b27..80c7798 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs | |||
@@ -54,6 +54,7 @@ namespace OpenSim.Data.MSSQL | |||
54 | 54 | ||
55 | #region IPlugin Members | 55 | #region IPlugin Members |
56 | 56 | ||
57 | [Obsolete("Cannot be default-initialized!")] | ||
57 | override public void Initialise() | 58 | override public void Initialise() |
58 | { | 59 | { |
59 | m_log.Info("[GRID DB]: " + Name + " cannot be default-initialized!"); | 60 | m_log.Info("[GRID DB]: " + Name + " cannot be default-initialized!"); |
@@ -67,7 +68,7 @@ namespace OpenSim.Data.MSSQL | |||
67 | /// <remarks>use mssql_connection.ini</remarks> | 68 | /// <remarks>use mssql_connection.ini</remarks> |
68 | override public void Initialise(string connectionString) | 69 | override public void Initialise(string connectionString) |
69 | { | 70 | { |
70 | if (string.IsNullOrEmpty(connectionString)) | 71 | if (!string.IsNullOrEmpty(connectionString)) |
71 | { | 72 | { |
72 | database = new MSSQLManager(connectionString); | 73 | database = new MSSQLManager(connectionString); |
73 | } | 74 | } |
@@ -93,63 +94,11 @@ namespace OpenSim.Data.MSSQL | |||
93 | settingPassword); | 94 | settingPassword); |
94 | } | 95 | } |
95 | 96 | ||
96 | //TODO this can be removed at a certain time | ||
97 | TestTables(); | ||
98 | |||
99 | //New migrations check of store | 97 | //New migrations check of store |
100 | database.CheckMigration(_migrationStore); | 98 | database.CheckMigration(_migrationStore); |
101 | } | 99 | } |
102 | 100 | ||
103 | /// <summary> | 101 | /// <summary> |
104 | /// Test is region | ||
105 | /// </summary> | ||
106 | private void TestTables() | ||
107 | { | ||
108 | using (AutoClosingSqlCommand cmd = database.Query("SELECT TOP 1 * FROM " + m_regionsTableName, new Dictionary<string, string>())) | ||
109 | { | ||
110 | try | ||
111 | { | ||
112 | cmd.ExecuteNonQuery(); | ||
113 | } | ||
114 | catch (Exception) | ||
115 | { | ||
116 | m_log.Info("[GRID DB]: MSSQL Database doesn't exist... creating"); | ||
117 | database.ExecuteResourceSql("Mssql-regions.sql"); | ||
118 | } | ||
119 | } | ||
120 | using (AutoClosingSqlCommand cmd = database.Query("select * from migrations where name = '" + _migrationStore + "'")) | ||
121 | { | ||
122 | //Special for Migrations to create backword compatible | ||
123 | try | ||
124 | { | ||
125 | bool insert = true; | ||
126 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
127 | { | ||
128 | if (reader.Read()) insert = false; | ||
129 | } | ||
130 | if (insert) | ||
131 | { | ||
132 | cmd.CommandText = "insert into migrations(name, version) values('" + _migrationStore + "', 1)"; | ||
133 | cmd.ExecuteNonQuery(); | ||
134 | } | ||
135 | } | ||
136 | catch | ||
137 | { | ||
138 | //No migrations table | ||
139 | //HACK create one and add data | ||
140 | cmd.CommandText = "create table migrations(name varchar(100), version int)"; | ||
141 | cmd.ExecuteNonQuery(); | ||
142 | |||
143 | cmd.CommandText = "insert into migrations(name, version) values('migrations', 1)"; | ||
144 | cmd.ExecuteNonQuery(); | ||
145 | |||
146 | cmd.CommandText = "insert into migrations(name, version) values('" + _migrationStore + "', 1)"; | ||
147 | cmd.ExecuteNonQuery(); | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | |||
152 | /// <summary> | ||
153 | /// Shuts down the grid interface | 102 | /// Shuts down the grid interface |
154 | /// </summary> | 103 | /// </summary> |
155 | override public void Dispose() | 104 | override public void Dispose() |