aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserAccountData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs70
1 files changed, 36 insertions, 34 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index c713a11..0bbc3f5 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -64,45 +64,47 @@ namespace OpenSim.Data.MySQL
64 if (scopeID != UUID.Zero) 64 if (scopeID != UUID.Zero)
65 command += " and ScopeID = ?scopeID"; 65 command += " and ScopeID = ?scopeID";
66 66
67 using (MySqlCommand cmd = new MySqlCommand(command)) 67 MySqlCommand cmd = new MySqlCommand(command);
68
69 cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
70 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
71
72 IDataReader result = ExecuteReader(cmd);
73
74 if (result.Read())
68 { 75 {
69 cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); 76 ret.PrincipalID = principalID;
70 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 77 UUID scope;
78 UUID.TryParse(result["ScopeID"].ToString(), out scope);
79 ret.ScopeID = scope;
71 80
72 using (IDataReader result = ExecuteReader(cmd)) 81 if (m_ColumnNames == null)
73 { 82 {
74 if (result.Read()) 83 m_ColumnNames = new List<string>();
75 { 84
76 ret.PrincipalID = principalID; 85 DataTable schemaTable = result.GetSchemaTable();
77 UUID scope; 86 foreach (DataRow row in schemaTable.Rows)
78 UUID.TryParse(result["ScopeID"].ToString(), out scope); 87 m_ColumnNames.Add(row["ColumnName"].ToString());
79 ret.ScopeID = scope;
80
81 if (m_ColumnNames == null)
82 {
83 m_ColumnNames = new List<string>();
84
85 DataTable schemaTable = result.GetSchemaTable();
86 foreach (DataRow row in schemaTable.Rows)
87 m_ColumnNames.Add(row["ColumnName"].ToString());
88 }
89
90 foreach (string s in m_ColumnNames)
91 {
92 if (s == "UUID")
93 continue;
94 if (s == "ScopeID")
95 continue;
96
97 ret.Data[s] = result[s].ToString();
98 }
99
100 return ret;
101 }
102 } 88 }
103 }
104 89
105 return null; 90 foreach (string s in m_ColumnNames)
91 {
92 if (s == "UUID")
93 continue;
94 if (s == "ScopeID")
95 continue;
96
97 ret.Data[s] = result[s].ToString();
98 }
99
100 CloseDBConnection(result, cmd);
101 return ret;
102 }
103 else
104 {
105 CloseDBConnection(result, cmd);
106 return null;
107 }
106 } 108 }
107 109
108 public bool Store(UserAccountData data) 110 public bool Store(UserAccountData data)