Prim inventory persistence phase 1: Creation of preliminary table in sqlite.
No user functionality yet. This code is not turned on, so there is no possibility of disruption to existing databases.afrisby
parent
9f2fb5ba70
commit
54d9fbc0fe
|
@ -70,7 +70,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
public void Initialise(string connectionstring)
|
// see IRegionDataStore
|
||||||
|
public void Initialise(string connectionstring, bool persistPrimInventories)
|
||||||
{
|
{
|
||||||
m_dataSet = new DataSet();
|
m_dataSet = new DataSet();
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,10 @@ namespace OpenSim.Region.Environment.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises the data storage engine
|
/// Initialises the data storage engine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">The file to save the database to (may not be applicable)</param>
|
/// <param name="filename">The file to save the database to (may not be applicable). Alternatively,
|
||||||
/// <param name="dbname">The name of the database to store to (may not be applicable)</param>
|
/// a connection string for the database</param>
|
||||||
void Initialise(string filename);
|
/// <param name="persistPrimInventories">Temporary switch while this option is immature</param>
|
||||||
|
void Initialise(string filename, bool persistPrimInventories);
|
||||||
|
|
||||||
void StoreObject(SceneObjectGroup obj, LLUUID regionUUID);
|
void StoreObject(SceneObjectGroup obj, LLUUID regionUUID);
|
||||||
void RemoveObject(LLUUID uuid, LLUUID regionUUID);
|
void RemoveObject(LLUUID uuid, LLUUID regionUUID);
|
||||||
|
|
|
@ -1008,21 +1008,17 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="localID"></param>
|
/// <param name="localID"></param>
|
||||||
public bool GetInventoryFileName(IClientAPI client, uint localID)
|
public bool GetInventoryFileName(IClientAPI client, uint localID)
|
||||||
{
|
{
|
||||||
// if (localID == m_localID)
|
if (m_inventorySerial > 0)
|
||||||
// {
|
{
|
||||||
if (m_inventorySerial > 0)
|
client.SendTaskInventory(m_uuid, (short)m_inventorySerial,
|
||||||
{
|
Helpers.StringToField(m_inventoryFileName));
|
||||||
client.SendTaskInventory(m_uuid, (short)m_inventorySerial,
|
return true;
|
||||||
Helpers.StringToField(m_inventoryFileName));
|
}
|
||||||
return true;
|
else
|
||||||
}
|
{
|
||||||
else
|
client.SendTaskInventory(m_uuid, 0, new byte[0]);
|
||||||
{
|
return false;
|
||||||
client.SendTaskInventory(m_uuid, 0, new byte[0]);
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RequestInventoryFile(IXfer xferManager)
|
public string RequestInventoryFile(IXfer xferManager)
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace OpenSim.Region.Environment
|
||||||
{
|
{
|
||||||
IRegionDataStore plug =
|
IRegionDataStore plug =
|
||||||
(IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
(IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
plug.Initialise(connectionstring);
|
plug.Initialise(connectionstring, false);
|
||||||
|
|
||||||
m_dataStore = plug;
|
m_dataStore = plug;
|
||||||
|
|
||||||
|
|
|
@ -52,12 +52,8 @@ namespace OpenSim.DataStore.MSSQL
|
||||||
private SqlDataAdapter shapeDa;
|
private SqlDataAdapter shapeDa;
|
||||||
private SqlDataAdapter terrainDa;
|
private SqlDataAdapter terrainDa;
|
||||||
|
|
||||||
/// <summary>
|
// see IRegionDataStore
|
||||||
///
|
public void Initialise(string dbfile, bool persistPrimInventories)
|
||||||
/// </summary>
|
|
||||||
/// <param name="dbfile"></param>
|
|
||||||
/// <param name="dbname"></param>
|
|
||||||
public void Initialise(string dbfile)
|
|
||||||
{
|
{
|
||||||
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
||||||
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
{
|
{
|
||||||
private const string primSelect = "select * from prims";
|
private const string primSelect = "select * from prims";
|
||||||
private const string shapeSelect = "select * from primshapes";
|
private const string shapeSelect = "select * from primshapes";
|
||||||
|
private const string itemsSelect = "select * from primitems";
|
||||||
private const string terrainSelect = "select * from terrain limit 1";
|
private const string terrainSelect = "select * from terrain limit 1";
|
||||||
private const string landSelect = "select * from land";
|
private const string landSelect = "select * from land";
|
||||||
private const string landAccessListSelect = "select * from landaccesslist";
|
private const string landAccessListSelect = "select * from landaccesslist";
|
||||||
|
@ -56,6 +57,8 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
private SqliteDataAdapter landAccessListDa;
|
private SqliteDataAdapter landAccessListDa;
|
||||||
|
|
||||||
private String m_connectionString;
|
private String m_connectionString;
|
||||||
|
|
||||||
|
private bool persistPrimInventories;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
|
@ -63,9 +66,11 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
public void Initialise(string connectionString)
|
// see IRegionDataStore
|
||||||
|
public void Initialise(string connectionString, bool persistPrimInventories)
|
||||||
{
|
{
|
||||||
m_connectionString = connectionString;
|
m_connectionString = connectionString;
|
||||||
|
this.persistPrimInventories = persistPrimInventories;
|
||||||
|
|
||||||
ds = new DataSet();
|
ds = new DataSet();
|
||||||
|
|
||||||
|
@ -601,10 +606,40 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
createCol(shapes, "Texture", typeof (Byte[]));
|
createCol(shapes, "Texture", typeof (Byte[]));
|
||||||
createCol(shapes, "ExtraParams", typeof (Byte[]));
|
createCol(shapes, "ExtraParams", typeof (Byte[]));
|
||||||
|
|
||||||
shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
|
shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] };
|
||||||
|
|
||||||
return shapes;
|
return shapes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DataTable createItemsTable()
|
||||||
|
{
|
||||||
|
DataTable items = new DataTable("primitems");
|
||||||
|
|
||||||
|
createCol(items, "UUID", typeof (String));
|
||||||
|
createCol(items, "invType", typeof (Int32));
|
||||||
|
createCol(items, "assetID", typeof (String));
|
||||||
|
createCol(items, "assetType", typeof (Int32));
|
||||||
|
createCol(items, "parentFolderID", typeof (String));
|
||||||
|
|
||||||
|
createCol(items, "name", typeof (String));
|
||||||
|
createCol(items, "description", typeof (String));
|
||||||
|
|
||||||
|
createCol(items, "creationDate", typeof (Int64));
|
||||||
|
createCol(items, "creatorID", typeof (String));
|
||||||
|
createCol(items, "ownerID", typeof (String));
|
||||||
|
createCol(items, "lastOwnerID", typeof (String));
|
||||||
|
createCol(items, "groupID", typeof (String));
|
||||||
|
|
||||||
|
createCol(items, "nextPermissions", typeof (Int32));
|
||||||
|
createCol(items, "currentPermissions", typeof (Int32));
|
||||||
|
createCol(items, "basePermissions", typeof (Int32));
|
||||||
|
createCol(items, "everyonePermissions", typeof (Int32));
|
||||||
|
createCol(items, "groupPermissions", typeof (Int32));
|
||||||
|
|
||||||
|
items.PrimaryKey = new DataColumn[] { items.Columns["UUID"] };
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
private DataTable createLandTable()
|
private DataTable createLandTable()
|
||||||
{
|
{
|
||||||
|
@ -1192,16 +1227,22 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
da.DeleteCommand = delete;
|
da.DeleteCommand = delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the necessary database tables.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conn"></param>
|
||||||
private void InitDB(SqliteConnection conn)
|
private void InitDB(SqliteConnection conn)
|
||||||
{
|
{
|
||||||
string createPrims = defineTable(createPrimTable());
|
string createPrims = defineTable(createPrimTable());
|
||||||
string createShapes = defineTable(createShapeTable());
|
string createShapes = defineTable(createShapeTable());
|
||||||
|
string createItems = defineTable(createItemsTable());
|
||||||
string createTerrain = defineTable(createTerrainTable());
|
string createTerrain = defineTable(createTerrainTable());
|
||||||
string createLand = defineTable(createLandTable());
|
string createLand = defineTable(createLandTable());
|
||||||
string createLandAccessList = defineTable(createLandAccessListTable());
|
string createLandAccessList = defineTable(createLandAccessListTable());
|
||||||
|
|
||||||
SqliteCommand pcmd = new SqliteCommand(createPrims, conn);
|
SqliteCommand pcmd = new SqliteCommand(createPrims, conn);
|
||||||
SqliteCommand scmd = new SqliteCommand(createShapes, conn);
|
SqliteCommand scmd = new SqliteCommand(createShapes, conn);
|
||||||
|
SqliteCommand icmd = new SqliteCommand(createItems, conn);
|
||||||
SqliteCommand tcmd = new SqliteCommand(createTerrain, conn);
|
SqliteCommand tcmd = new SqliteCommand(createTerrain, conn);
|
||||||
SqliteCommand lcmd = new SqliteCommand(createLand, conn);
|
SqliteCommand lcmd = new SqliteCommand(createLand, conn);
|
||||||
SqliteCommand lalcmd = new SqliteCommand(createLandAccessList, conn);
|
SqliteCommand lalcmd = new SqliteCommand(createLandAccessList, conn);
|
||||||
|
@ -1225,6 +1266,18 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists");
|
MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (persistPrimInventories)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
icmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (SqliteSyntaxException)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1259,12 +1312,19 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
{
|
{
|
||||||
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
|
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
|
||||||
SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd);
|
SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd);
|
||||||
|
|
||||||
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn);
|
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn);
|
||||||
SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd);
|
SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd);
|
||||||
|
|
||||||
|
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn);
|
||||||
|
SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd);
|
||||||
|
|
||||||
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn);
|
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn);
|
||||||
SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd);
|
SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd);
|
||||||
|
|
||||||
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn);
|
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn);
|
||||||
SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd);
|
SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd);
|
||||||
|
|
||||||
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn);
|
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn);
|
||||||
SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
||||||
|
|
||||||
|
@ -1273,6 +1333,10 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
{
|
{
|
||||||
pDa.Fill(tmpDS, "prims");
|
pDa.Fill(tmpDS, "prims");
|
||||||
sDa.Fill(tmpDS, "primshapes");
|
sDa.Fill(tmpDS, "primshapes");
|
||||||
|
|
||||||
|
if (persistPrimInventories)
|
||||||
|
iDa.Fill(tmpDS, "primitems");
|
||||||
|
|
||||||
tDa.Fill(tmpDS, "terrain");
|
tDa.Fill(tmpDS, "terrain");
|
||||||
lDa.Fill(tmpDS, "land");
|
lDa.Fill(tmpDS, "land");
|
||||||
lalDa.Fill(tmpDS, "landaccesslist");
|
lalDa.Fill(tmpDS, "landaccesslist");
|
||||||
|
@ -1285,6 +1349,10 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
|
|
||||||
pDa.Fill(tmpDS, "prims");
|
pDa.Fill(tmpDS, "prims");
|
||||||
sDa.Fill(tmpDS, "primshapes");
|
sDa.Fill(tmpDS, "primshapes");
|
||||||
|
|
||||||
|
if (persistPrimInventories)
|
||||||
|
iDa.Fill(tmpDS, "primitems");
|
||||||
|
|
||||||
tDa.Fill(tmpDS, "terrain");
|
tDa.Fill(tmpDS, "terrain");
|
||||||
lDa.Fill(tmpDS, "land");
|
lDa.Fill(tmpDS, "land");
|
||||||
lalDa.Fill(tmpDS,"landaccesslist");
|
lalDa.Fill(tmpDS,"landaccesslist");
|
||||||
|
@ -1297,6 +1365,7 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (DataColumn col in createShapeTable().Columns)
|
foreach (DataColumn col in createShapeTable().Columns)
|
||||||
{
|
{
|
||||||
if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
|
if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
|
||||||
|
@ -1305,6 +1374,9 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Not restoring prim inventories quite yet
|
||||||
|
|
||||||
foreach (DataColumn col in createTerrainTable().Columns)
|
foreach (DataColumn col in createTerrainTable().Columns)
|
||||||
{
|
{
|
||||||
if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
|
if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
|
||||||
|
@ -1313,6 +1385,7 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (DataColumn col in createLandTable().Columns)
|
foreach (DataColumn col in createLandTable().Columns)
|
||||||
{
|
{
|
||||||
if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName))
|
if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName))
|
||||||
|
@ -1321,6 +1394,7 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (DataColumn col in createLandAccessListTable().Columns)
|
foreach (DataColumn col in createLandAccessListTable().Columns)
|
||||||
{
|
{
|
||||||
if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName))
|
if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName))
|
||||||
|
@ -1329,6 +1403,7 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,6 +1457,10 @@ namespace OpenSim.DataStore.MonoSqlite
|
||||||
{
|
{
|
||||||
return "integer";
|
return "integer";
|
||||||
}
|
}
|
||||||
|
else if (type == typeof (Int64))
|
||||||
|
{
|
||||||
|
return "integer";
|
||||||
|
}
|
||||||
else if (type == typeof (Double))
|
else if (type == typeof (Double))
|
||||||
{
|
{
|
||||||
return "float";
|
return "float";
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace OpenSim.DataStore.NullStorage
|
||||||
{
|
{
|
||||||
public class NullDataStore : IRegionDataStore
|
public class NullDataStore : IRegionDataStore
|
||||||
{
|
{
|
||||||
public void Initialise(string dbfile)
|
public void Initialise(string dbfile, bool persistPrimInventories)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue