diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAuthenticationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index e96a123..0780936 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -55,39 +55,41 @@ namespace OpenSim.Data.MySQL | |||
55 | AuthenticationData ret = new AuthenticationData(); | 55 | AuthenticationData ret = new AuthenticationData(); |
56 | ret.Data = new Dictionary<string, object>(); | 56 | ret.Data = new Dictionary<string, object>(); |
57 | 57 | ||
58 | using (MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID")) | 58 | MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID"); |
59 | { | ||
60 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | ||
61 | 59 | ||
62 | using (IDataReader result = ExecuteReader(cmd)) | 60 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
63 | { | ||
64 | if (result.Read()) | ||
65 | { | ||
66 | ret.PrincipalID = principalID; | ||
67 | 61 | ||
68 | if (m_ColumnNames == null) | 62 | IDataReader result = ExecuteReader(cmd); |
69 | { | ||
70 | m_ColumnNames = new List<string>(); | ||
71 | 63 | ||
72 | DataTable schemaTable = result.GetSchemaTable(); | 64 | if (result.Read()) |
73 | foreach (DataRow row in schemaTable.Rows) | 65 | { |
74 | m_ColumnNames.Add(row["ColumnName"].ToString()); | 66 | ret.PrincipalID = principalID; |
75 | } | 67 | |
68 | if (m_ColumnNames == null) | ||
69 | { | ||
70 | m_ColumnNames = new List<string>(); | ||
76 | 71 | ||
77 | foreach (string s in m_ColumnNames) | 72 | DataTable schemaTable = result.GetSchemaTable(); |
78 | { | 73 | foreach (DataRow row in schemaTable.Rows) |
79 | if (s == "UUID") | 74 | m_ColumnNames.Add(row["ColumnName"].ToString()); |
80 | continue; | 75 | } |
81 | 76 | ||
82 | ret.Data[s] = result[s].ToString(); | 77 | foreach (string s in m_ColumnNames) |
83 | } | 78 | { |
79 | if (s == "UUID") | ||
80 | continue; | ||
84 | 81 | ||
85 | return ret; | 82 | ret.Data[s] = result[s].ToString(); |
86 | } | ||
87 | } | 83 | } |
88 | } | ||
89 | 84 | ||
90 | return null; | 85 | CloseDBConnection(result, cmd); |
86 | return ret; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | CloseDBConnection(result, cmd); | ||
91 | return null; | ||
92 | } | ||
91 | } | 93 | } |
92 | 94 | ||
93 | public bool Store(AuthenticationData data) | 95 | public bool Store(AuthenticationData data) |