aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL/MSSQLLogData.cs
diff options
context:
space:
mode:
authorHomer Horwitz2008-11-15 21:27:10 +0000
committerHomer Horwitz2008-11-15 21:27:10 +0000
commit9a6cdf662b60e7d6f6843826da6a84637d4798b9 (patch)
tree0ac44924346d5c94b355844ccee83612a3c96ad2 /OpenSim/Data/MSSQL/MSSQLLogData.cs
parent- Change llSetRot behavior so it matches the SL behavior (in particular, the (diff)
downloadopensim-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 '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLLogData.cs57
1 files changed, 2 insertions, 55 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLLogData.cs b/OpenSim/Data/MSSQL/MSSQLLogData.cs
index a617cea..63cd605 100644
--- a/OpenSim/Data/MSSQL/MSSQLLogData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLLogData.cs
@@ -26,10 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Data.SqlClient;
30using System.Reflection; 29using System.Reflection;
31using System.Collections.Generic;
32using System.Data;
33using log4net; 30using log4net;
34using OpenSim.Framework; 31using OpenSim.Framework;
35 32
@@ -49,6 +46,7 @@ namespace OpenSim.Data.MSSQL
49 /// </summary> 46 /// </summary>
50 public MSSQLManager database; 47 public MSSQLManager database;
51 48
49 [Obsolete("Cannot be default-initialized!")]
52 public void Initialise() 50 public void Initialise()
53 { 51 {
54 m_log.Info("[LOG DB]: " + Name + " cannot be default-initialized!"); 52 m_log.Info("[LOG DB]: " + Name + " cannot be default-initialized!");
@@ -60,7 +58,7 @@ namespace OpenSim.Data.MSSQL
60 /// </summary> 58 /// </summary>
61 public void Initialise(string connect) 59 public void Initialise(string connect)
62 { 60 {
63 if (string.IsNullOrEmpty(connect)) 61 if (!string.IsNullOrEmpty(connect))
64 { 62 {
65 database = new MSSQLManager(connect); 63 database = new MSSQLManager(connect);
66 } 64 }
@@ -79,62 +77,11 @@ namespace OpenSim.Data.MSSQL
79 settingPassword); 77 settingPassword);
80 } 78 }
81 79
82 //TODO when can this be removed
83 TestTable();
84
85 //Updating mechanisme 80 //Updating mechanisme
86 database.CheckMigration(_migrationStore); 81 database.CheckMigration(_migrationStore);
87 } 82 }
88 83
89 /// <summary> 84 /// <summary>
90 /// Can be removed someday!!!
91 /// </summary>
92 private void TestTable()
93 {
94 using (IDbCommand cmd = database.Query("select top 1 * from logs", new Dictionary<string, string>()))
95 {
96 try
97 {
98 cmd.ExecuteNonQuery();
99 }
100 catch
101 {
102 database.ExecuteResourceSql("Mssql-logs.sql");
103 }
104 }
105 using (AutoClosingSqlCommand cmd = database.Query("select * from migrations where name = '" + _migrationStore + "'"))
106 {
107 //Special for Migrations to create backword compatible
108 try
109 {
110 bool insert = true;
111 using (SqlDataReader reader = cmd.ExecuteReader())
112 {
113 if (reader.Read()) insert = false;
114 }
115 if (insert)
116 {
117 cmd.CommandText = "insert into migrations(name, version) values('" + _migrationStore + "', 1)";
118 cmd.ExecuteNonQuery();
119 }
120 }
121 catch
122 {
123 //No migrations table
124 //HACK create one and add data
125 cmd.CommandText = "create table migrations(name varchar(100), version int)";
126 cmd.ExecuteNonQuery();
127
128 cmd.CommandText = "insert into migrations(name, version) values('migrations', 1)";
129 cmd.ExecuteNonQuery();
130
131 cmd.CommandText = "insert into migrations(name, version) values('" + _migrationStore + "', 1)";
132 cmd.ExecuteNonQuery();
133 }
134 }
135 }
136
137 /// <summary>
138 /// Saves a log item to the database 85 /// Saves a log item to the database
139 /// </summary> 86 /// </summary>
140 /// <param name="serverDaemon">The daemon triggering the event</param> 87 /// <param name="serverDaemon">The daemon triggering the event</param>