diff options
author | Justin Clark-Casey (justincc) | 2012-04-17 00:19:36 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-04-17 00:19:36 +0100 |
commit | 1bb387333868e223c90519d18fa18b84bd1a4324 (patch) | |
tree | 760a33546b180b208d3c20139a31d225953eac1d | |
parent | Fix bug in WebStatsModule where an exception would always be output on update... (diff) | |
download | opensim-SC_OLD-1bb387333868e223c90519d18fa18b84bd1a4324.zip opensim-SC_OLD-1bb387333868e223c90519d18fa18b84bd1a4324.tar.gz opensim-SC_OLD-1bb387333868e223c90519d18fa18b84bd1a4324.tar.bz2 opensim-SC_OLD-1bb387333868e223c90519d18fa18b84bd1a4324.tar.xz |
Simplify WebStatsModule by removing the uncompleted migrations section.
Use "create table if not exists" instead.
Client stats data is transitory data that it is not worth migrating.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/UserStatistics/WebStatsModule.cs | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index dbe9b3f..e593ecd 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.UserStatistics | |||
90 | 90 | ||
91 | dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); | 91 | dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); |
92 | dbConn.Open(); | 92 | dbConn.Open(); |
93 | CheckAndUpdateDatabase(dbConn); | 93 | CreateTables(dbConn); |
94 | 94 | ||
95 | Prototype_distributor protodep = new Prototype_distributor(); | 95 | Prototype_distributor protodep = new Prototype_distributor(); |
96 | Updater_distributor updatedep = new Updater_distributor(); | 96 | Updater_distributor updatedep = new Updater_distributor(); |
@@ -237,36 +237,12 @@ namespace OpenSim.Region.UserStatistics | |||
237 | 237 | ||
238 | return responsedata; | 238 | return responsedata; |
239 | } | 239 | } |
240 | |||
241 | public void CheckAndUpdateDatabase(SqliteConnection db) | ||
242 | { | ||
243 | lock (db) | ||
244 | { | ||
245 | // TODO: FIXME: implement stats migrations | ||
246 | const string SQL = @"SELECT * FROM migrations LIMIT 1"; | ||
247 | |||
248 | using (SqliteCommand cmd = new SqliteCommand(SQL, db)) | ||
249 | { | ||
250 | try | ||
251 | { | ||
252 | cmd.ExecuteNonQuery(); | ||
253 | } | ||
254 | catch (SqliteSyntaxException) | ||
255 | { | ||
256 | CreateTables(db); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | 240 | ||
262 | public void CreateTables(SqliteConnection db) | 241 | public void CreateTables(SqliteConnection db) |
263 | { | 242 | { |
264 | using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db)) | 243 | using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db)) |
265 | { | 244 | { |
266 | createcmd.ExecuteNonQuery(); | 245 | createcmd.ExecuteNonQuery(); |
267 | |||
268 | createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; | ||
269 | createcmd.ExecuteNonQuery(); | ||
270 | } | 246 | } |
271 | } | 247 | } |
272 | 248 | ||
@@ -688,9 +664,7 @@ namespace OpenSim.Region.UserStatistics | |||
688 | } | 664 | } |
689 | 665 | ||
690 | #region SQL | 666 | #region SQL |
691 | private const string SQL_MIGRA_TABLE_CREATE = @"create table migrations(name varchar(100), version int)"; | 667 | private const string SQL_STATS_TABLE_CREATE = @"CREATE TABLE IF NOT EXISTS stats_session_data ( |
692 | |||
693 | private const string SQL_STATS_TABLE_CREATE = @"CREATE TABLE stats_session_data ( | ||
694 | session_id VARCHAR(36) NOT NULL PRIMARY KEY, | 668 | session_id VARCHAR(36) NOT NULL PRIMARY KEY, |
695 | agent_id VARCHAR(36) NOT NULL DEFAULT '', | 669 | agent_id VARCHAR(36) NOT NULL DEFAULT '', |
696 | region_id VARCHAR(36) NOT NULL DEFAULT '', | 670 | region_id VARCHAR(36) NOT NULL DEFAULT '', |
@@ -807,8 +781,8 @@ set session_id=:session_id, | |||
807 | f_resent=:f_resent, | 781 | f_resent=:f_resent, |
808 | f_send_packet=:f_send_packet | 782 | f_send_packet=:f_send_packet |
809 | WHERE session_id=:session_key"; | 783 | WHERE session_id=:session_key"; |
810 | #endregion | ||
811 | } | 784 | } |
785 | #endregion | ||
812 | 786 | ||
813 | public static class UserSessionUtil | 787 | public static class UserSessionUtil |
814 | { | 788 | { |