aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAuthenticationData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLAuthenticationData.cs50
1 files changed, 22 insertions, 28 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
index e508b52..e96a123 100644
--- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
+++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
@@ -55,44 +55,38 @@ 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 MySqlCommand cmd = new MySqlCommand( 58 using (MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID"))
59 "select * from `"+m_Realm+"` where UUID = ?principalID"
60 );
61
62 cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
63
64 IDataReader result = ExecuteReader(cmd);
65
66 if (result.Read())
67 { 59 {
68 ret.PrincipalID = principalID; 60 cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
69 61
70 if (m_ColumnNames == null) 62 using (IDataReader result = ExecuteReader(cmd))
71 { 63 {
72 m_ColumnNames = new List<string>(); 64 if (result.Read())
65 {
66 ret.PrincipalID = principalID;
73 67
74 DataTable schemaTable = result.GetSchemaTable(); 68 if (m_ColumnNames == null)
75 foreach (DataRow row in schemaTable.Rows) 69 {
76 m_ColumnNames.Add(row["ColumnName"].ToString()); 70 m_ColumnNames = new List<string>();
77 }
78 71
79 foreach (string s in m_ColumnNames) 72 DataTable schemaTable = result.GetSchemaTable();
80 { 73 foreach (DataRow row in schemaTable.Rows)
81 if (s == "UUID") 74 m_ColumnNames.Add(row["ColumnName"].ToString());
82 continue; 75 }
83 76
84 ret.Data[s] = result[s].ToString(); 77 foreach (string s in m_ColumnNames)
85 } 78 {
79 if (s == "UUID")
80 continue;
86 81
87 result.Close(); 82 ret.Data[s] = result[s].ToString();
88 CloseReaderCommand(cmd); 83 }
89 84
90 return ret; 85 return ret;
86 }
87 }
91 } 88 }
92 89
93 result.Close();
94 CloseReaderCommand(cmd);
95
96 return null; 90 return null;
97 } 91 }
98 92