diff options
author | John Hurliman | 2009-11-02 11:19:55 -0800 |
---|---|---|
committer | John Hurliman | 2009-11-02 11:19:55 -0800 |
commit | 6309fcc5b4b42102b5bb901dbbdf44846f5643f2 (patch) | |
tree | 9f71f2801c6ed6eaa40fe637b0cda520a9e5894f /OpenSim/Data/MySQL/MySQLUserAccountData.cs | |
parent | Fix an invalid argument exception in the remote admin module when. (diff) | |
download | opensim-SC_OLD-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.zip opensim-SC_OLD-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.gz opensim-SC_OLD-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.bz2 opensim-SC_OLD-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.xz |
Reverting the memory leak patch for MySQL. Problems have been reported with the grid server after running for several hours
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserAccountData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index 0bbc3f5..d48144d 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -97,14 +97,16 @@ namespace OpenSim.Data.MySQL | |||
97 | ret.Data[s] = result[s].ToString(); | 97 | ret.Data[s] = result[s].ToString(); |
98 | } | 98 | } |
99 | 99 | ||
100 | CloseDBConnection(result, cmd); | 100 | result.Close(); |
101 | CloseReaderCommand(cmd); | ||
102 | |||
101 | return ret; | 103 | return ret; |
102 | } | 104 | } |
103 | else | 105 | |
104 | { | 106 | result.Close(); |
105 | CloseDBConnection(result, cmd); | 107 | CloseReaderCommand(cmd); |
106 | return null; | 108 | |
107 | } | 109 | return null; |
108 | } | 110 | } |
109 | 111 | ||
110 | public bool Store(UserAccountData data) | 112 | public bool Store(UserAccountData data) |
@@ -116,60 +118,61 @@ namespace OpenSim.Data.MySQL | |||
116 | 118 | ||
117 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | 119 | string[] fields = new List<string>(data.Data.Keys).ToArray(); |
118 | 120 | ||
119 | using (MySqlCommand cmd = new MySqlCommand()) | 121 | MySqlCommand cmd = new MySqlCommand(); |
122 | |||
123 | string update = "update `"+m_Realm+"` set "; | ||
124 | bool first = true; | ||
125 | foreach (string field in fields) | ||
120 | { | 126 | { |
121 | string update = "update `" + m_Realm + "` set "; | 127 | if (!first) |
122 | bool first = true; | 128 | update += ", "; |
123 | foreach (string field in fields) | 129 | update += "`" + field + "` = ?"+field; |
124 | { | ||
125 | if (!first) | ||
126 | update += ", "; | ||
127 | update += "`" + field + "` = ?" + field; | ||
128 | 130 | ||
129 | first = false; | 131 | first = false; |
130 | 132 | ||
131 | cmd.Parameters.AddWithValue("?" + field, data.Data[field]); | 133 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
132 | } | 134 | } |
133 | 135 | ||
134 | update += " where UUID = ?principalID"; | 136 | update += " where UUID = ?principalID"; |
135 | 137 | ||
136 | if (data.ScopeID != UUID.Zero) | 138 | if (data.ScopeID != UUID.Zero) |
137 | update += " and ScopeID = ?scopeID"; | 139 | update += " and ScopeID = ?scopeID"; |
138 | 140 | ||
139 | cmd.CommandText = update; | 141 | cmd.CommandText = update; |
140 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); | 142 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); |
141 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); | 143 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); |
142 | 144 | ||
143 | if (ExecuteNonQuery(cmd) < 1) | 145 | if (ExecuteNonQuery(cmd) < 1) |
144 | { | 146 | { |
145 | string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" + | 147 | string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" + |
146 | String.Join("`, `", fields) + | 148 | String.Join("`, `", fields) + |
147 | "`) values (?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; | 149 | "`) values (?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; |
148 | 150 | ||
149 | cmd.CommandText = insert; | 151 | cmd.CommandText = insert; |
150 | 152 | ||
151 | if (ExecuteNonQuery(cmd) < 1) | 153 | if (ExecuteNonQuery(cmd) < 1) |
152 | { | 154 | { |
153 | cmd.Dispose(); | 155 | cmd.Dispose(); |
154 | return false; | 156 | return false; |
155 | } | ||
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
160 | cmd.Dispose(); | ||
161 | |||
159 | return true; | 162 | return true; |
160 | } | 163 | } |
161 | 164 | ||
162 | public bool SetDataItem(UUID principalID, string item, string value) | 165 | public bool SetDataItem(UUID principalID, string item, string value) |
163 | { | 166 | { |
164 | using (MySqlCommand cmd = new MySqlCommand("update `" + m_Realm + "` set `" + | 167 | MySqlCommand cmd = new MySqlCommand("update `" + m_Realm + |
165 | item + "` = ?" + item + " where UUID = ?UUID")) | 168 | "` set `" + item + "` = ?" + item + " where UUID = ?UUID"); |
166 | { | ||
167 | cmd.Parameters.AddWithValue("?" + item, value); | ||
168 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); | ||
169 | 169 | ||
170 | if (ExecuteNonQuery(cmd) > 0) | 170 | |
171 | return true; | 171 | cmd.Parameters.AddWithValue("?"+item, value); |
172 | } | 172 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); |
173 | |||
174 | if (ExecuteNonQuery(cmd) > 0) | ||
175 | return true; | ||
173 | 176 | ||
174 | return false; | 177 | return false; |
175 | } | 178 | } |