aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
diff options
context:
space:
mode:
authorDiva Canto2010-02-20 20:13:38 -0800
committerDiva Canto2010-02-20 20:13:38 -0800
commitdf59d098b319367394bdeb898d7fd7dacd7104ec (patch)
tree04d6b7214a1773a686d6fab6f53e8ecddd6a7bf7 /OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
parentAdded UserAccountData and auth to the SQLite connector. Compiles, runs, but a... (diff)
downloadopensim-SC_OLD-df59d098b319367394bdeb898d7fd7dacd7104ec.zip
opensim-SC_OLD-df59d098b319367394bdeb898d7fd7dacd7104ec.tar.gz
opensim-SC_OLD-df59d098b319367394bdeb898d7fd7dacd7104ec.tar.bz2
opensim-SC_OLD-df59d098b319367394bdeb898d7fd7dacd7104ec.tar.xz
SQLite connector better, but access to tables still doesn't work.
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
index d29efa0..98943a0 100644
--- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
+++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
@@ -57,6 +57,9 @@ namespace OpenSim.Data.SQLite
57 57
58 if (!m_initialized) 58 if (!m_initialized)
59 { 59 {
60 m_Connection = new SqliteConnection(connectionString);
61 m_Connection.Open();
62
60 if (storeName != String.Empty) 63 if (storeName != String.Empty)
61 { 64 {
62 Assembly assem = GetType().Assembly; 65 Assembly assem = GetType().Assembly;
@@ -64,6 +67,7 @@ namespace OpenSim.Data.SQLite
64 Migration m = new Migration(m_Connection, assem, storeName); 67 Migration m = new Migration(m_Connection, assem, storeName);
65 m.Update(); 68 m.Update();
66 } 69 }
70
67 m_initialized = true; 71 m_initialized = true;
68 } 72 }
69 73
@@ -117,7 +121,7 @@ namespace OpenSim.Data.SQLite
117 for (int i = 0 ; i < fields.Length ; i++) 121 for (int i = 0 ; i < fields.Length ; i++)
118 { 122 {
119 cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i])); 123 cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
120 terms.Add("`" + fields[i] + "` = :" + fields[i]); 124 terms.Add("`" + fields[i] + "`='" + keys[i] + "'");
121 } 125 }
122 126
123 string where = String.Join(" and ", terms.ToArray()); 127 string where = String.Join(" and ", terms.ToArray());
@@ -215,8 +219,8 @@ namespace OpenSim.Data.SQLite
215 foreach (FieldInfo fi in m_Fields.Values) 219 foreach (FieldInfo fi in m_Fields.Values)
216 { 220 {
217 names.Add(fi.Name); 221 names.Add(fi.Name);
218 values.Add(":" + fi.Name); 222 values.Add(fi.GetValue(row).ToString());
219 cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString())); 223 cmd.Parameters.Add(new SqliteParameter(fi.Name, fi.GetValue(row).ToString()));
220 } 224 }
221 225
222 if (m_DataField != null) 226 if (m_DataField != null)
@@ -227,12 +231,12 @@ namespace OpenSim.Data.SQLite
227 foreach (KeyValuePair<string, string> kvp in data) 231 foreach (KeyValuePair<string, string> kvp in data)
228 { 232 {
229 names.Add(kvp.Key); 233 names.Add(kvp.Key);
230 values.Add(":" + kvp.Key); 234 values.Add(kvp.Value);
231 cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value)); 235 cmd.Parameters.Add(new SqliteParameter(kvp.Key, kvp.Value));
232 } 236 }
233 } 237 }
234 238
235 query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")"; 239 query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values ('" + String.Join("', '", values.ToArray()) + "')";
236 240
237 cmd.CommandText = query; 241 cmd.CommandText = query;
238 242