diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAuthenticationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 7627497..fef582e 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -59,6 +59,7 @@ namespace OpenSim.Data.MySQL | |||
59 | dbcon.Open(); | 59 | dbcon.Open(); |
60 | Migration m = new Migration(dbcon, Assembly, "AuthStore"); | 60 | Migration m = new Migration(dbcon, Assembly, "AuthStore"); |
61 | m.Update(); | 61 | m.Update(); |
62 | dbcon.Close(); | ||
62 | } | 63 | } |
63 | } | 64 | } |
64 | 65 | ||
@@ -76,27 +77,30 @@ namespace OpenSim.Data.MySQL | |||
76 | { | 77 | { |
77 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 78 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
78 | 79 | ||
79 | IDataReader result = cmd.ExecuteReader(); | 80 | using(IDataReader result = cmd.ExecuteReader()) |
80 | |||
81 | if (result.Read()) | ||
82 | { | 81 | { |
83 | ret.PrincipalID = principalID; | 82 | if(result.Read()) |
84 | |||
85 | CheckColumnNames(result); | ||
86 | |||
87 | foreach (string s in m_ColumnNames) | ||
88 | { | 83 | { |
89 | if (s == "UUID") | 84 | ret.PrincipalID = principalID; |
90 | continue; | 85 | |
91 | 86 | CheckColumnNames(result); | |
92 | ret.Data[s] = result[s].ToString(); | 87 | |
88 | foreach(string s in m_ColumnNames) | ||
89 | { | ||
90 | if(s == "UUID") | ||
91 | continue; | ||
92 | |||
93 | ret.Data[s] = result[s].ToString(); | ||
94 | } | ||
95 | |||
96 | dbcon.Close(); | ||
97 | return ret; | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | dbcon.Close(); | ||
102 | return null; | ||
93 | } | 103 | } |
94 | |||
95 | return ret; | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | return null; | ||
100 | } | 104 | } |
101 | } | 105 | } |
102 | } | 106 | } |
@@ -132,25 +136,25 @@ namespace OpenSim.Data.MySQL | |||
132 | if (!first) | 136 | if (!first) |
133 | update += ", "; | 137 | update += ", "; |
134 | update += "`" + field + "` = ?"+field; | 138 | update += "`" + field + "` = ?"+field; |
135 | 139 | ||
136 | first = false; | 140 | first = false; |
137 | 141 | ||
138 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | 142 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
139 | } | 143 | } |
140 | 144 | ||
141 | update += " where UUID = ?principalID"; | 145 | update += " where UUID = ?principalID"; |
142 | 146 | ||
143 | cmd.CommandText = update; | 147 | cmd.CommandText = update; |
144 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); | 148 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); |
145 | 149 | ||
146 | if (ExecuteNonQuery(cmd) < 1) | 150 | if (ExecuteNonQuery(cmd) < 1) |
147 | { | 151 | { |
148 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + | 152 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + |
149 | String.Join("`, `", fields) + | 153 | String.Join("`, `", fields) + |
150 | "`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; | 154 | "`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; |
151 | 155 | ||
152 | cmd.CommandText = insert; | 156 | cmd.CommandText = insert; |
153 | 157 | ||
154 | if (ExecuteNonQuery(cmd) < 1) | 158 | if (ExecuteNonQuery(cmd) < 1) |
155 | return false; | 159 | return false; |
156 | } | 160 | } |
@@ -166,7 +170,7 @@ namespace OpenSim.Data.MySQL | |||
166 | { | 170 | { |
167 | cmd.Parameters.AddWithValue("?"+item, value); | 171 | cmd.Parameters.AddWithValue("?"+item, value); |
168 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); | 172 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); |
169 | 173 | ||
170 | if (ExecuteNonQuery(cmd) > 0) | 174 | if (ExecuteNonQuery(cmd) > 0) |
171 | return true; | 175 | return true; |
172 | } | 176 | } |
@@ -186,7 +190,7 @@ namespace OpenSim.Data.MySQL | |||
186 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 190 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
187 | cmd.Parameters.AddWithValue("?token", token); | 191 | cmd.Parameters.AddWithValue("?token", token); |
188 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); | 192 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); |
189 | 193 | ||
190 | if (ExecuteNonQuery(cmd) > 0) | 194 | if (ExecuteNonQuery(cmd) > 0) |
191 | return true; | 195 | return true; |
192 | } | 196 | } |