changes on sqlite estatedata
parent
f89afd2aa8
commit
016886b3c6
|
@ -186,13 +186,10 @@ namespace OpenSim.Data.SQLite
|
||||||
private void DoCreate(EstateSettings es)
|
private void DoCreate(EstateSettings es)
|
||||||
{
|
{
|
||||||
List<string> names = new List<string>(FieldList);
|
List<string> names = new List<string>(FieldList);
|
||||||
|
names.Remove("EstateID");
|
||||||
IDataReader r = null;
|
|
||||||
|
|
||||||
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
{
|
{
|
||||||
names.Remove("EstateID");
|
|
||||||
|
|
||||||
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
|
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
|
@ -217,17 +214,12 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
|
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
using(IDataReader r = cmd.ExecuteReader())
|
||||||
r = cmd.ExecuteReader();
|
{
|
||||||
}
|
|
||||||
|
|
||||||
r.Read();
|
r.Read();
|
||||||
|
|
||||||
es.EstateID = Convert.ToUInt32(r["id"]);
|
es.EstateID = Convert.ToUInt32(r["id"]);
|
||||||
|
}
|
||||||
r.Close();
|
}
|
||||||
|
|
||||||
es.Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreEstateSettings(EstateSettings es)
|
public void StoreEstateSettings(EstateSettings es)
|
||||||
|
@ -240,11 +232,10 @@ namespace OpenSim.Data.SQLite
|
||||||
foreach (string f in fields)
|
foreach (string f in fields)
|
||||||
terms.Add(f+" = :"+f);
|
terms.Add(f+" = :"+f);
|
||||||
|
|
||||||
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID";
|
|
||||||
|
|
||||||
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = "update estate_settings set " + String.Join(", ", terms.ToArray()) + " where EstateID = :EstateID"; ;
|
||||||
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
||||||
|
|
||||||
foreach (string name in FieldList)
|
foreach (string name in FieldList)
|
||||||
{
|
{
|
||||||
|
@ -472,8 +463,8 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
public bool LinkRegion(UUID regionID, int estateID)
|
public bool LinkRegion(UUID regionID, int estateID)
|
||||||
{
|
{
|
||||||
SqliteTransaction transaction = m_connection.BeginTransaction();
|
using(SqliteTransaction transaction = m_connection.BeginTransaction())
|
||||||
|
{
|
||||||
// Delete any existing estate mapping for this region.
|
// Delete any existing estate mapping for this region.
|
||||||
using(SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
using(SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
{
|
{
|
||||||
|
@ -503,6 +494,7 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<UUID> GetRegions(int estateID)
|
public List<UUID> GetRegions(int estateID)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue