try to update SQLite estateban

0.9.1.0-post-fixes
UbitUmarov 2019-08-18 20:35:24 +01:00
parent d5db4b9d93
commit 7f52bcbc7f
2 changed files with 16 additions and 6 deletions

View File

@ -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;

View File

@ -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();