diff options
author | Teravus Ovares (Dan Olivares) | 2009-09-04 00:04:26 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-09-04 00:04:26 -0400 |
commit | 9f05edab04b7c592767b4875b00cec8468121744 (patch) | |
tree | 038c4955e4bbabd7ed2cd67443676480ca52f25a /OpenSim/Data | |
parent | * Fixes the function 'GetTerrainHeightAtXY' (diff) | |
parent | More work on new authentication service (diff) | |
download | opensim-SC-9f05edab04b7c592767b4875b00cec8468121744.zip opensim-SC-9f05edab04b7c592767b4875b00cec8468121744.tar.gz opensim-SC-9f05edab04b7c592767b4875b00cec8468121744.tar.bz2 opensim-SC-9f05edab04b7c592767b4875b00cec8468121744.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 35 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFramework.cs | 8 |
2 files changed, 31 insertions, 12 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 625d3b1..19575ec 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Data.MySQL | |||
38 | public class MySqlAuthenticationData : MySqlFramework, IAuthenticationData | 38 | public class MySqlAuthenticationData : MySqlFramework, IAuthenticationData |
39 | { | 39 | { |
40 | private string m_Realm; | 40 | private string m_Realm; |
41 | private DataTable m_SchemaTable = null; | 41 | private List<string> m_ColumnNames = null; |
42 | 42 | ||
43 | public MySqlAuthenticationData(string connectionString, string realm) | 43 | public MySqlAuthenticationData(string connectionString, string realm) |
44 | : base(connectionString) | 44 | : base(connectionString) |
@@ -63,15 +63,21 @@ namespace OpenSim.Data.MySQL | |||
63 | { | 63 | { |
64 | ret.PrincipalID = principalID; | 64 | ret.PrincipalID = principalID; |
65 | 65 | ||
66 | if (m_SchemaTable == null) | 66 | if (m_ColumnNames == null) |
67 | m_SchemaTable = result.GetSchemaTable(); | 67 | { |
68 | m_ColumnNames = new List<string>(); | ||
69 | |||
70 | DataTable schemaTable = result.GetSchemaTable(); | ||
71 | foreach (DataRow row in schemaTable.Rows) | ||
72 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
73 | } | ||
68 | 74 | ||
69 | foreach (DataColumn c in m_SchemaTable.Columns) | 75 | foreach (string s in m_ColumnNames) |
70 | { | 76 | { |
71 | if (c.ColumnName == "UUID") | 77 | if (s == "UUID") |
72 | continue; | 78 | continue; |
73 | 79 | ||
74 | ret.Data[c.ColumnName] = result[c.ColumnName].ToString(); | 80 | ret.Data[s] = result[s].ToString(); |
75 | } | 81 | } |
76 | 82 | ||
77 | result.Close(); | 83 | result.Close(); |
@@ -105,21 +111,23 @@ namespace OpenSim.Data.MySQL | |||
105 | 111 | ||
106 | first = false; | 112 | first = false; |
107 | 113 | ||
108 | cmd.Parameters.AddWithValue(field, data.Data[field]); | 114 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
109 | } | 115 | } |
110 | 116 | ||
111 | update += " where UUID = ?principalID"; | 117 | update += " where UUID = ?principalID"; |
112 | 118 | ||
113 | cmd.CommandText = update; | 119 | cmd.CommandText = update; |
114 | cmd.Parameters.AddWithValue("UUID", data.PrincipalID.ToString()); | 120 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); |
115 | 121 | ||
116 | if (ExecuteNonQuery(cmd) < 1) | 122 | if (ExecuteNonQuery(cmd) < 1) |
117 | { | 123 | { |
118 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + | 124 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + |
119 | String.Join("`, `", fields) + | 125 | String.Join("`, `", fields) + |
120 | "`) values ( ?UUID, ?" + String.Join(", ?", fields) + ")"; | 126 | "`) values ( ?principalID, ?" + String.Join(", ?", fields) + ")"; |
121 | 127 | ||
122 | if (ExecuteNonQuery(cmd) < 0) | 128 | cmd.CommandText = insert; |
129 | |||
130 | if (ExecuteNonQuery(cmd) < 1) | ||
123 | { | 131 | { |
124 | cmd.Dispose(); | 132 | cmd.Dispose(); |
125 | return false; | 133 | return false; |
@@ -137,8 +145,11 @@ namespace OpenSim.Data.MySQL | |||
137 | "` set `" + item + "` = ?" + item + " where UUID = ?UUID"); | 145 | "` set `" + item + "` = ?" + item + " where UUID = ?UUID"); |
138 | 146 | ||
139 | 147 | ||
140 | cmd.Parameters.AddWithValue(item, value); | 148 | cmd.Parameters.AddWithValue("?"+item, value); |
141 | cmd.Parameters.AddWithValue("UUID", principalID.ToString()); | 149 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); |
150 | |||
151 | if (ExecuteNonQuery(cmd) > 0) | ||
152 | return true; | ||
142 | 153 | ||
143 | return false; | 154 | return false; |
144 | } | 155 | } |
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs index f2b31c4..6c73249 100644 --- a/OpenSim/Data/MySQL/MySQLFramework.cs +++ b/OpenSim/Data/MySQL/MySQLFramework.cs | |||
@@ -70,6 +70,7 @@ namespace OpenSim.Data.MySQL | |||
70 | } | 70 | } |
71 | catch (MySqlException e) | 71 | catch (MySqlException e) |
72 | { | 72 | { |
73 | Console.WriteLine(e.ToString()); | ||
73 | if (errorSeen) | 74 | if (errorSeen) |
74 | throw; | 75 | throw; |
75 | 76 | ||
@@ -88,6 +89,13 @@ namespace OpenSim.Data.MySQL | |||
88 | 89 | ||
89 | cmd.Connection = m_Connection; | 90 | cmd.Connection = m_Connection; |
90 | } | 91 | } |
92 | else | ||
93 | throw; | ||
94 | } | ||
95 | catch (Exception e) | ||
96 | { | ||
97 | Console.WriteLine(e.ToString()); | ||
98 | return 0; | ||
91 | } | 99 | } |
92 | } | 100 | } |
93 | } | 101 | } |