aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserAccountData.cs
diff options
context:
space:
mode:
authorMelanie2009-10-06 14:30:25 +0100
committerMelanie2009-10-06 14:30:25 +0100
commit8a7a947faaeeaeac2f74f695cefd6eb3e774dc15 (patch)
tree0b7cc12640fa58c5635b61ae2af087469581253d /OpenSim/Data/MySQL/MySQLUserAccountData.cs
parentCorrection on the DEBUG code. (diff)
downloadopensim-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 '')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs74
1 files changed, 36 insertions, 38 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index 38a6f55..0bbc3f5 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -64,48 +64,46 @@ 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 CloseDBConnection(cmd);
101 return ret;
102 }
103 else
104 {
105 CloseDBConnection(cmd);
106 return null;
107 }
108 } 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 CloseDBConnection(result, cmd);
101 return ret;
102 }
103 else
104 {
105 CloseDBConnection(result, cmd);
106 return null;
109 } 107 }
110 } 108 }
111 109