From 7f52bcbc7f1f518d49b84a5c642b3b065e0bb656 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 18 Aug 2019 20:35:24 +0100 Subject: try to update SQLite estateban --- OpenSim/Data/SQLite/Resources/EstateStore.migrations | 9 +++++++++ OpenSim/Data/SQLite/SQLiteEstateData.cs | 13 +++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'OpenSim/Data') 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 ( bannedIpHostMask varchar(16) NOT NULL, bannedNameMask varchar(64) default NULL ); + CREATE INDEX estate_ban_estate_id on estateban(EstateID); COMMIT; +:VERSION 11 +BEGIN; +ALTER TABLE `estateban` + ADD COLUMN `banningUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', + ADD COLUMN `banTime` integer NOT NULL DEFAULT 0; +COMMIT; + + 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 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { - cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; + cmd.CommandText = "select * from estateban where EstateID = :EstateID"; cmd.Parameters.AddWithValue(":EstateID", es.EstateID); r = cmd.ExecuteReader(); @@ -288,12 +288,11 @@ namespace OpenSim.Data.SQLite { EstateBan eb = new EstateBan(); - UUID uuid = new UUID(); - UUID.TryParse(r["bannedUUID"].ToString(), out uuid); - - eb.BannedUserID = uuid; + eb.BannedUserID = DBGuid.FromDB(r["bannedUUID"]); ; eb.BannedHostAddress = "0.0.0.0"; eb.BannedHostIPMask = "0.0.0.0"; + eb.BanningUserID = DBGuid.FromDB(r["banningUUID"]); + eb.BanTime = Convert.ToInt32(r["banTime"]); es.AddBan(eb); } r.Close(); @@ -310,12 +309,14 @@ namespace OpenSim.Data.SQLite cmd.Parameters.Clear(); - cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )"; + cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask, banningUUID, banTime) values ( :EstateID, :bannedUUID, '', '', '', :banningUUID, :banTime )"; foreach (EstateBan b in es.EstateBans) { cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); + cmd.Parameters.AddWithValue(":banningUUID", b.BanningUserID.ToString()); + cmd.Parameters.AddWithValue(":banTime", b.BanTime); cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); -- cgit v1.1