try to update SQLite estateban
parent
d5db4b9d93
commit
7f52bcbc7f
|
@ -63,7 +63,16 @@ CREATE TABLE IF NOT EXISTS estateban (
|
||||||
bannedIpHostMask varchar(16) NOT NULL,
|
bannedIpHostMask varchar(16) NOT NULL,
|
||||||
bannedNameMask varchar(64) default NULL
|
bannedNameMask varchar(64) default NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX estate_ban_estate_id on estateban(EstateID);
|
CREATE INDEX estate_ban_estate_id on estateban(EstateID);
|
||||||
|
|
||||||
COMMIT;
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,7 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
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);
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
||||||
|
|
||||||
r = cmd.ExecuteReader();
|
r = cmd.ExecuteReader();
|
||||||
|
@ -288,12 +288,11 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
EstateBan eb = new EstateBan();
|
EstateBan eb = new EstateBan();
|
||||||
|
|
||||||
UUID uuid = new UUID();
|
eb.BannedUserID = DBGuid.FromDB(r["bannedUUID"]); ;
|
||||||
UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
|
|
||||||
|
|
||||||
eb.BannedUserID = uuid;
|
|
||||||
eb.BannedHostAddress = "0.0.0.0";
|
eb.BannedHostAddress = "0.0.0.0";
|
||||||
eb.BannedHostIPMask = "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);
|
es.AddBan(eb);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
|
@ -310,12 +309,14 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
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)
|
foreach (EstateBan b in es.EstateBans)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue(":banningUUID", b.BanningUserID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue(":banTime", b.BanTime);
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
Loading…
Reference in New Issue