diff options
author | UbitUmarov | 2019-08-18 20:35:24 +0100 |
---|---|---|
committer | UbitUmarov | 2019-08-18 20:35:24 +0100 |
commit | 7f52bcbc7f1f518d49b84a5c642b3b065e0bb656 (patch) | |
tree | f33dd032b2230fd74859cbe1cdb6ba0e0def0c5f /OpenSim | |
parent | try to update PGSQL estateban (diff) | |
download | opensim-SC-7f52bcbc7f1f518d49b84a5c642b3b065e0bb656.zip opensim-SC-7f52bcbc7f1f518d49b84a5c642b3b065e0bb656.tar.gz opensim-SC-7f52bcbc7f1f518d49b84a5c642b3b065e0bb656.tar.bz2 opensim-SC-7f52bcbc7f1f518d49b84a5c642b3b065e0bb656.tar.xz |
try to update SQLite estateban
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/SQLite/Resources/EstateStore.migrations | 9 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteEstateData.cs | 13 |
2 files changed, 16 insertions, 6 deletions
diff --git a/OpenSim/Data/SQLite/Resources/EstateStore.migrations b/OpenSim/Data/SQLite/Resources/EstateStore.migrations index 37fa1d9..30e04fd 100644 --- a/OpenSim/Data/SQLite/Resources/EstateStore.migrations +++ b/OpenSim/Data/SQLite/Resources/EstateStore.migrations | |||
@@ -63,7 +63,16 @@ CREATE TABLE IF NOT EXISTS estateban ( | |||
63 | bannedIpHostMask varchar(16) NOT NULL, | 63 | bannedIpHostMask varchar(16) NOT NULL, |
64 | bannedNameMask varchar(64) default NULL | 64 | bannedNameMask varchar(64) default NULL |
65 | ); | 65 | ); |
66 | |||
66 | CREATE INDEX estate_ban_estate_id on estateban(EstateID); | 67 | CREATE INDEX estate_ban_estate_id on estateban(EstateID); |
67 | 68 | ||
68 | COMMIT; | 69 | COMMIT; |
69 | 70 | ||
71 | :VERSION 11 | ||
72 | BEGIN; | ||
73 | ALTER TABLE `estateban` | ||
74 | ADD COLUMN `banningUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
75 | ADD COLUMN `banTime` integer NOT NULL DEFAULT 0; | ||
76 | COMMIT; | ||
77 | |||
78 | |||
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 0fcab21..5e55323 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs | |||
@@ -278,7 +278,7 @@ namespace OpenSim.Data.SQLite | |||
278 | 278 | ||
279 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | 279 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) |
280 | { | 280 | { |
281 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; | 281 | cmd.CommandText = "select * from estateban where EstateID = :EstateID"; |
282 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID); | 282 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID); |
283 | 283 | ||
284 | r = cmd.ExecuteReader(); | 284 | r = cmd.ExecuteReader(); |
@@ -288,12 +288,11 @@ namespace OpenSim.Data.SQLite | |||
288 | { | 288 | { |
289 | EstateBan eb = new EstateBan(); | 289 | EstateBan eb = new EstateBan(); |
290 | 290 | ||
291 | UUID uuid = new UUID(); | 291 | eb.BannedUserID = DBGuid.FromDB(r["bannedUUID"]); ; |
292 | UUID.TryParse(r["bannedUUID"].ToString(), out uuid); | ||
293 | |||
294 | eb.BannedUserID = uuid; | ||
295 | eb.BannedHostAddress = "0.0.0.0"; | 292 | eb.BannedHostAddress = "0.0.0.0"; |
296 | eb.BannedHostIPMask = "0.0.0.0"; | 293 | eb.BannedHostIPMask = "0.0.0.0"; |
294 | eb.BanningUserID = DBGuid.FromDB(r["banningUUID"]); | ||
295 | eb.BanTime = Convert.ToInt32(r["banTime"]); | ||
297 | es.AddBan(eb); | 296 | es.AddBan(eb); |
298 | } | 297 | } |
299 | r.Close(); | 298 | r.Close(); |
@@ -310,12 +309,14 @@ namespace OpenSim.Data.SQLite | |||
310 | 309 | ||
311 | cmd.Parameters.Clear(); | 310 | cmd.Parameters.Clear(); |
312 | 311 | ||
313 | cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )"; | 312 | cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask, banningUUID, banTime) values ( :EstateID, :bannedUUID, '', '', '', :banningUUID, :banTime )"; |
314 | 313 | ||
315 | foreach (EstateBan b in es.EstateBans) | 314 | foreach (EstateBan b in es.EstateBans) |
316 | { | 315 | { |
317 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); | 316 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
318 | cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); | 317 | cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); |
318 | cmd.Parameters.AddWithValue(":banningUUID", b.BanningUserID.ToString()); | ||
319 | cmd.Parameters.AddWithValue(":banTime", b.BanTime); | ||
319 | 320 | ||
320 | cmd.ExecuteNonQuery(); | 321 | cmd.ExecuteNonQuery(); |
321 | cmd.Parameters.Clear(); | 322 | cmd.Parameters.Clear(); |