diff options
author | Melanie | 2009-10-06 14:30:25 +0100 |
---|---|---|
committer | Melanie | 2009-10-06 14:30:25 +0100 |
commit | 8a7a947faaeeaeac2f74f695cefd6eb3e774dc15 (patch) | |
tree | 0b7cc12640fa58c5635b61ae2af087469581253d /OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |
parent | Correction on the DEBUG code. (diff) | |
download | opensim-SC_OLD-8a7a947faaeeaeac2f74f695cefd6eb3e774dc15.zip opensim-SC_OLD-8a7a947faaeeaeac2f74f695cefd6eb3e774dc15.tar.gz opensim-SC_OLD-8a7a947faaeeaeac2f74f695cefd6eb3e774dc15.tar.bz2 opensim-SC_OLD-8a7a947faaeeaeac2f74f695cefd6eb3e774dc15.tar.xz |
Remove the using() constructs from the new style database modules; they caused
the underlying connection of a reader or command to be closed before the
reader or command itself. Added the proper logic to Close and dispose items
in CloseDBConnection. Readers and Connections need Close(), Commands need
Dispose(), in the order Reader, Command, Connection.
Also reinstated 80-column-friendly formatting
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAuthenticationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index a41f9f8..0780936 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -55,42 +55,40 @@ 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 | |||
62 | IDataReader result = ExecuteReader(cmd); | ||
63 | |||
64 | if (result.Read()) | ||
59 | { | 65 | { |
60 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 66 | ret.PrincipalID = principalID; |
67 | |||
68 | if (m_ColumnNames == null) | ||
69 | { | ||
70 | m_ColumnNames = new List<string>(); | ||
61 | 71 | ||
62 | using (IDataReader result = ExecuteReader(cmd)) | 72 | DataTable schemaTable = result.GetSchemaTable(); |
73 | foreach (DataRow row in schemaTable.Rows) | ||
74 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
75 | } | ||
76 | |||
77 | foreach (string s in m_ColumnNames) | ||
63 | { | 78 | { |
64 | if (result.Read()) | 79 | if (s == "UUID") |
65 | { | 80 | continue; |
66 | ret.PrincipalID = principalID; | 81 | |
67 | 82 | ret.Data[s] = result[s].ToString(); | |
68 | if (m_ColumnNames == null) | ||
69 | { | ||
70 | m_ColumnNames = new List<string>(); | ||
71 | |||
72 | DataTable schemaTable = result.GetSchemaTable(); | ||
73 | foreach (DataRow row in schemaTable.Rows) | ||
74 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
75 | } | ||
76 | |||
77 | foreach (string s in m_ColumnNames) | ||
78 | { | ||
79 | if (s == "UUID") | ||
80 | continue; | ||
81 | |||
82 | ret.Data[s] = result[s].ToString(); | ||
83 | } | ||
84 | |||
85 | CloseDBConnection(cmd); | ||
86 | return ret; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | CloseDBConnection(cmd); | ||
91 | return null; | ||
92 | } | ||
93 | } | 83 | } |
84 | |||
85 | CloseDBConnection(result, cmd); | ||
86 | return ret; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | CloseDBConnection(result, cmd); | ||
91 | return null; | ||
94 | } | 92 | } |
95 | } | 93 | } |
96 | 94 | ||