diff options
author | Melanie | 2009-10-06 17:44:59 +0100 |
---|---|---|
committer | Melanie | 2009-10-06 17:44:59 +0100 |
commit | 0374f1b144f3faf35da39e3925e8abd4b2a8bd04 (patch) | |
tree | 456d3d532c70d32564d35fc3cb9bbc81bdf08b2e /OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |
parent | Make sure that keys exist in arrays before trying to access them. (diff) | |
parent | Corrected words in error message. (diff) | |
download | opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.zip opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.gz opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.bz2 opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.xz |
Merge branch 'master' into vehicles
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) |