Merge branch '0.6.9-post-fixes' into careminster

avinationmerge
Melanie 2010-06-07 05:23:52 +01:00
commit cc2622660b
76 changed files with 6184 additions and 350 deletions

View File

@ -7,8 +7,8 @@
<property name="distbindir" value="distbin" /> <property name="distbindir" value="distbin" />
<target name="distbin"> <target name="distbin">
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/> <copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
<delete dir="${distbindir}"/> <delete dir="${distbindir}"/>
<!-- <copy file="*" todir="${distbindir}"/> -->
<copy todir="${distbindir}"> <copy todir="${distbindir}">
<fileset> <fileset>
<include name="**"/> <include name="**"/>

View File

@ -149,8 +149,9 @@ namespace OpenSim.Data
UpdateVersion(_type, newversion); UpdateVersion(_type, newversion);
} }
version = newversion; version = newversion;
cmd.Dispose();
} }
cmd.Dispose();
} }
// private int MaxVersion() // private int MaxVersion()

View File

@ -30,7 +30,7 @@ using System.Data;
using System.Reflection; using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;

View File

@ -30,7 +30,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLite
Migration m = new Migration(m_connection, assem, "EstateStore"); Migration m = new Migration(m_connection, assem, "EstateStore");
m.Update(); m.Update();
m_connection.Close(); //m_connection.Close();
m_connection.Open(); // m_connection.Open();
Type t = typeof(EstateSettings); Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic | m_Fields = t.GetFields(BindingFlags.NonPublic |
@ -90,7 +90,7 @@ namespace OpenSim.Data.SQLite
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql; cmd.CommandText = sql;
cmd.Parameters.Add(":RegionID", regionID.ToString()); cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
IDataReader r = cmd.ExecuteReader(); IDataReader r = cmd.ExecuteReader();
@ -140,13 +140,13 @@ namespace OpenSim.Data.SQLite
if (m_FieldMap[name].GetValue(es) is bool) if (m_FieldMap[name].GetValue(es) is bool)
{ {
if ((bool)m_FieldMap[name].GetValue(es)) if ((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add(":"+name, "1"); cmd.Parameters.AddWithValue(":"+name, "1");
else else
cmd.Parameters.Add(":"+name, "0"); cmd.Parameters.AddWithValue(":"+name, "0");
} }
else else
{ {
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
} }
} }
@ -164,8 +164,8 @@ namespace OpenSim.Data.SQLite
r.Close(); r.Close();
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
cmd.Parameters.Add(":RegionID", regionID.ToString()); cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
// This will throw on dupe key // This will throw on dupe key
try try
@ -180,7 +180,7 @@ namespace OpenSim.Data.SQLite
// //
cmd.Parameters.Clear(); cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID"; cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID";
cmd.Parameters.Add(":UUID", regionID.ToString()); cmd.Parameters.AddWithValue(":UUID", regionID.ToString());
try try
{ {
@ -222,13 +222,13 @@ namespace OpenSim.Data.SQLite
if (m_FieldMap[name].GetValue(es) is bool) if (m_FieldMap[name].GetValue(es) is bool)
{ {
if ((bool)m_FieldMap[name].GetValue(es)) if ((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add(":"+name, "1"); cmd.Parameters.AddWithValue(":"+name, "1");
else else
cmd.Parameters.Add(":"+name, "0"); cmd.Parameters.AddWithValue(":"+name, "0");
} }
else else
{ {
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
} }
} }
@ -247,7 +247,7 @@ namespace OpenSim.Data.SQLite
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", es.EstateID); cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
IDataReader r = cmd.ExecuteReader(); IDataReader r = cmd.ExecuteReader();
@ -271,7 +271,7 @@ namespace OpenSim.Data.SQLite
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from estateban where EstateID = :EstateID"; cmd.CommandText = "delete from estateban where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -281,8 +281,8 @@ namespace OpenSim.Data.SQLite
foreach (EstateBan b in es.EstateBans) foreach (EstateBan b in es.EstateBans)
{ {
cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString()); cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); cmd.Parameters.Clear();
@ -294,7 +294,7 @@ namespace OpenSim.Data.SQLite
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", EstateID.ToString()); cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -304,8 +304,8 @@ namespace OpenSim.Data.SQLite
foreach (UUID uuid in data) foreach (UUID uuid in data)
{ {
cmd.Parameters.Add(":EstateID", EstateID.ToString()); cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
cmd.Parameters.Add(":uuid", uuid.ToString()); cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); cmd.Parameters.Clear();
@ -319,7 +319,7 @@ namespace OpenSim.Data.SQLite
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", EstateID); cmd.Parameters.AddWithValue(":EstateID", EstateID);
IDataReader r = cmd.ExecuteReader(); IDataReader r = cmd.ExecuteReader();

View File

@ -31,7 +31,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
namespace OpenSim.Data.SQLite namespace OpenSim.Data.SQLite
{ {
@ -65,12 +65,18 @@ namespace OpenSim.Data.SQLite
protected IDataReader ExecuteReader(SqliteCommand cmd) protected IDataReader ExecuteReader(SqliteCommand cmd)
{ {
SqliteConnection newConnection = lock (m_Connection)
(SqliteConnection)((ICloneable)m_Connection).Clone(); {
newConnection.Open(); //SqliteConnection newConnection =
// (SqliteConnection)((ICloneable)connection).Clone();
//newConnection.Open();
cmd.Connection = newConnection; //cmd.Connection = newConnection;
return cmd.ExecuteReader(); cmd.Connection = m_Connection;
//Console.WriteLine("XXX " + cmd.CommandText);
return cmd.ExecuteReader();
}
} }
protected void CloseReaderCommand(SqliteCommand cmd) protected void CloseReaderCommand(SqliteCommand cmd)

View File

@ -30,7 +30,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -54,10 +54,23 @@ namespace OpenSim.Data.SQLite
m_Realm = realm; m_Realm = realm;
if (storeName != String.Empty) if (storeName != String.Empty)
{ {
Assembly assem = GetType().Assembly; m_Connection = new SqliteConnection(connectionString);
//Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString));
m_Connection.Open();
Migration m = new Migration(m_Connection, assem, storeName); if (storeName != String.Empty)
m.Update(); {
Assembly assem = GetType().Assembly;
//SqliteConnection newConnection =
// (SqliteConnection)((ICloneable)m_Connection).Clone();
//newConnection.Open();
//Migration m = new Migration(newConnection, assem, storeName);
Migration m = new Migration(m_Connection, assem, storeName);
m.Update();
//newConnection.Close();
//newConnection.Dispose();
}
} }
Type t = typeof(T); Type t = typeof(T);
@ -180,7 +193,7 @@ namespace OpenSim.Data.SQLite
result.Add(row); result.Add(row);
} }
CloseReaderCommand(cmd); //CloseCommand(cmd);
return result.ToArray(); return result.ToArray();
} }

View File

@ -30,7 +30,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
@ -92,11 +92,13 @@ namespace OpenSim.Data.SQLite
ds.Tables.Add(createInventoryFoldersTable()); ds.Tables.Add(createInventoryFoldersTable());
invFoldersDa.Fill(ds.Tables["inventoryfolders"]); invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
setupFoldersCommands(invFoldersDa, conn); setupFoldersCommands(invFoldersDa, conn);
CreateDataSetMapping(invFoldersDa, "inventoryfolders");
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
ds.Tables.Add(createInventoryItemsTable()); ds.Tables.Add(createInventoryItemsTable());
invItemsDa.Fill(ds.Tables["inventoryitems"]); invItemsDa.Fill(ds.Tables["inventoryitems"]);
setupItemsCommands(invItemsDa, conn); setupItemsCommands(invItemsDa, conn);
CreateDataSetMapping(invItemsDa, "inventoryitems");
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
ds.AcceptChanges(); ds.AcceptChanges();
@ -721,6 +723,15 @@ namespace OpenSim.Data.SQLite
* *
**********************************************************************/ **********************************************************************/
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
{
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
foreach (DataColumn col in ds.Tables[tableName].Columns)
{
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
}
}
/// <summary> /// <summary>
/// Create the "inventoryitems" table /// Create the "inventoryitems" table
/// </summary> /// </summary>

View File

@ -28,9 +28,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SQLite;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Data.Sqlite;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Data.SQLite namespace OpenSim.Data.SQLite
@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
connectionString = "URI=file:GridServerSqlite.db;"; connectionString = "URI=file:GridServerSqlite.db;";
} }
dbcon = new SQLiteConnection(connectionString); dbcon = new SqliteConnection(connectionString);
dbcon.Open(); dbcon.Open();
} }
@ -93,11 +93,11 @@ namespace OpenSim.Data.SQLite
/// <returns>A SQLite DB Command</returns> /// <returns>A SQLite DB Command</returns>
public IDbCommand Query(string sql, Dictionary<string, string> parameters) public IDbCommand Query(string sql, Dictionary<string, string> parameters)
{ {
SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand(); SqliteCommand dbcommand = (SqliteCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql; dbcommand.CommandText = sql;
foreach (KeyValuePair<string, string> param in parameters) foreach (KeyValuePair<string, string> param in parameters)
{ {
SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value); SqliteParameter paramx = new SqliteParameter(param.Key, param.Value);
dbcommand.Parameters.Add(paramx); dbcommand.Parameters.Add(paramx);
} }

View File

@ -32,7 +32,7 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -87,119 +87,151 @@ namespace OpenSim.Data.SQLite
/// <param name="connectionString">the connection string</param> /// <param name="connectionString">the connection string</param>
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; try
ds = new DataSet();
m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
m_conn = new SqliteConnection(m_connectionString);
m_conn.Open();
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
primDa = new SqliteDataAdapter(primSelectCmd);
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
shapeDa = new SqliteDataAdapter(shapeSelectCmd);
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
itemsDa = new SqliteDataAdapter(itemsSelectCmd);
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
landDa = new SqliteDataAdapter(landSelectCmd);
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
Migration m = new Migration(m_conn, assem, "RegionStore");
m.Update();
lock (ds)
{ {
ds.Tables.Add(createPrimTable()); m_connectionString = connectionString;
setupPrimCommands(primDa, m_conn);
primDa.Fill(ds.Tables["prims"]);
ds.Tables.Add(createShapeTable()); ds = new DataSet("Region");
setupShapeCommands(shapeDa, m_conn);
ds.Tables.Add(createItemsTable()); m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString);
setupItemsCommands(itemsDa, m_conn); m_conn = new SqliteConnection(m_connectionString);
itemsDa.Fill(ds.Tables["primitems"]); m_conn.Open();
ds.Tables.Add(createTerrainTable()); SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
setupTerrainCommands(terrainDa, m_conn); primDa = new SqliteDataAdapter(primSelectCmd);
ds.Tables.Add(createLandTable()); SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
setupLandCommands(landDa, m_conn); shapeDa = new SqliteDataAdapter(shapeSelectCmd);
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
ds.Tables.Add(createLandAccessListTable()); SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
setupLandAccessCommands(landAccessListDa, m_conn); itemsDa = new SqliteDataAdapter(itemsSelectCmd);
ds.Tables.Add(createRegionSettingsTable()); SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
setupRegionSettingsCommands(regionSettingsDa, m_conn); SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
landDa = new SqliteDataAdapter(landSelectCmd);
// WORKAROUND: This is a work around for sqlite on SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
// windows, which gets really unhappy with blob columns landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
// that have no sample data in them. At some point we
// need to actually find a proper way to handle this. SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
try regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
Migration m = new Migration(m_conn, assem, "RegionStore");
m.Update();
lock (ds)
{ {
shapeDa.Fill(ds.Tables["primshapes"]); ds.Tables.Add(createPrimTable());
} setupPrimCommands(primDa, m_conn);
catch (Exception)
{
m_log.Info("[REGION DB]: Caught fill error on primshapes table");
}
try ds.Tables.Add(createShapeTable());
{ setupShapeCommands(shapeDa, m_conn);
terrainDa.Fill(ds.Tables["terrain"]);
}
catch (Exception)
{
m_log.Info("[REGION DB]: Caught fill error on terrain table");
}
try ds.Tables.Add(createItemsTable());
{ setupItemsCommands(itemsDa, m_conn);
landDa.Fill(ds.Tables["land"]);
}
catch (Exception)
{
m_log.Info("[REGION DB]: Caught fill error on land table");
}
try ds.Tables.Add(createTerrainTable());
{ setupTerrainCommands(terrainDa, m_conn);
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
}
catch (Exception)
{
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
}
try ds.Tables.Add(createLandTable());
{ setupLandCommands(landDa, m_conn);
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
ds.Tables.Add(createLandAccessListTable());
setupLandAccessCommands(landAccessListDa, m_conn);
ds.Tables.Add(createRegionSettingsTable());
setupRegionSettingsCommands(regionSettingsDa, m_conn);
// WORKAROUND: This is a work around for sqlite on
// windows, which gets really unhappy with blob columns
// that have no sample data in them. At some point we
// need to actually find a proper way to handle this.
try
{
primDa.Fill(ds.Tables["prims"]);
}
catch (Exception)
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table");
}
try
{
shapeDa.Fill(ds.Tables["primshapes"]);
}
catch (Exception)
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table");
}
try
{
itemsDa.Fill(ds.Tables["primitems"]);
}
catch (Exception)
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
}
try
{
terrainDa.Fill(ds.Tables["terrain"]);
}
catch (Exception)
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table");
}
try
{
landDa.Fill(ds.Tables["land"]);
}
catch (Exception)
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on land table");
}
try
{
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
}
catch (Exception)
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table");
}
try
{
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
}
catch (Exception)
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table");
}
// We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
// Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
// Possibly because we manually set up our own DataTables before connecting to the database
CreateDataSetMapping(primDa, "prims");
CreateDataSetMapping(shapeDa, "primshapes");
CreateDataSetMapping(itemsDa, "primitems");
CreateDataSetMapping(terrainDa, "terrain");
CreateDataSetMapping(landDa, "land");
CreateDataSetMapping(landAccessListDa, "landaccesslist");
CreateDataSetMapping(regionSettingsDa, "regionsettings");
} }
catch (Exception)
{
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
}
return;
} }
catch (Exception e)
{
m_log.Error(e);
Environment.Exit(23);
}
return;
} }
public void Dispose() public void Dispose()
@ -411,7 +443,7 @@ namespace OpenSim.Data.SQLite
lock (ds) lock (ds)
{ {
DataRow[] primsForRegion = prims.Select(byRegion); DataRow[] primsForRegion = prims.Select(byRegion);
m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); // m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
// First, create all groups // First, create all groups
foreach (DataRow primRow in primsForRegion) foreach (DataRow primRow in primsForRegion)
@ -433,8 +465,8 @@ namespace OpenSim.Data.SQLite
} }
else else
{ {
m_log.Info( m_log.Warn(
"[REGION DB]: No shape found for prim in storage, so setting default box shape"); "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default; prim.Shape = PrimitiveBaseShape.Default;
} }
@ -446,11 +478,11 @@ namespace OpenSim.Data.SQLite
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
m_log.Info("[REGION DB]: " + e.ToString()); m_log.Error("[SQLITE REGION DB]: ", e);
foreach (DataColumn col in prims.Columns) foreach (DataColumn col in prims.Columns)
{ {
m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
} }
} }
} }
@ -475,7 +507,7 @@ namespace OpenSim.Data.SQLite
else else
{ {
m_log.Warn( m_log.Warn(
"[REGION DB]: No shape found for prim in storage, so setting default box shape"); "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default; prim.Shape = PrimitiveBaseShape.Default;
} }
@ -485,11 +517,11 @@ namespace OpenSim.Data.SQLite
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
m_log.Info("[REGION DB]: " + e.ToString()); m_log.Error("[SQLITE REGION DB]: ", e);
foreach (DataColumn col in prims.Columns) foreach (DataColumn col in prims.Columns)
{ {
m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
} }
} }
} }
@ -503,19 +535,22 @@ namespace OpenSim.Data.SQLite
/// <param name="prim">the prim</param> /// <param name="prim">the prim</param>
private void LoadItems(SceneObjectPart prim) private void LoadItems(SceneObjectPart prim)
{ {
//m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); // m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
DataTable dbItems = ds.Tables["primitems"]; DataTable dbItems = ds.Tables["primitems"];
String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
DataRow[] dbItemRows = dbItems.Select(sql); DataRow[] dbItemRows = dbItems.Select(sql);
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
// m_log.DebugFormat(
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
foreach (DataRow row in dbItemRows) foreach (DataRow row in dbItemRows)
{ {
TaskInventoryItem item = buildItem(row); TaskInventoryItem item = buildItem(row);
inventory.Add(item); inventory.Add(item);
//m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); // m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID);
} }
prim.Inventory.RestoreInventoryItems(inventory); prim.Inventory.RestoreInventoryItems(inventory);
@ -551,7 +586,7 @@ namespace OpenSim.Data.SQLite
// the following is an work around for .NET. The perf // the following is an work around for .NET. The perf
// issues associated with it aren't as bad as you think. // issues associated with it aren't as bad as you think.
m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString());
String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
" values(:RegionUUID, :Revision, :Heightfield)"; " values(:RegionUUID, :Revision, :Heightfield)";
@ -603,15 +638,15 @@ namespace OpenSim.Data.SQLite
} }
} }
} }
rev = (int) row["Revision"]; rev = Convert.ToInt32(row["Revision"]);
} }
else else
{ {
m_log.Info("[REGION DB]: No terrain found for region"); m_log.Warn("[SQLITE REGION DB]: No terrain found for region");
return null; return null;
} }
m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
} }
} }
return terret; return terret;
@ -755,6 +790,7 @@ namespace OpenSim.Data.SQLite
/// </summary> /// </summary>
public void Commit() public void Commit()
{ {
//m_log.Debug("[SQLITE]: Starting commit");
lock (ds) lock (ds)
{ {
primDa.Update(ds, "prims"); primDa.Update(ds, "prims");
@ -769,18 +805,11 @@ namespace OpenSim.Data.SQLite
{ {
regionSettingsDa.Update(ds, "regionsettings"); regionSettingsDa.Update(ds, "regionsettings");
} }
catch (SqliteExecutionException SqlEx) catch (SqliteException SqlEx)
{ {
if (SqlEx.Message.Contains("logic error")) throw new Exception(
{ "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
throw new Exception( SqlEx);
"There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
SqlEx);
}
else
{
throw SqlEx;
}
} }
ds.AcceptChanges(); ds.AcceptChanges();
} }
@ -802,6 +831,15 @@ namespace OpenSim.Data.SQLite
* *
**********************************************************************/ **********************************************************************/
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
{
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
foreach (DataColumn col in ds.Tables[tableName].Columns)
{
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -1390,7 +1428,7 @@ namespace OpenSim.Data.SQLite
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
newData.UserLocation = Vector3.Zero; newData.UserLocation = Vector3.Zero;
newData.UserLookAt = Vector3.Zero; newData.UserLookAt = Vector3.Zero;
} }
@ -1897,7 +1935,7 @@ namespace OpenSim.Data.SQLite
/// <param name="items"></param> /// <param name="items"></param>
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{ {
m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); // m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
DataTable dbItems = ds.Tables["primitems"]; DataTable dbItems = ds.Tables["primitems"];
@ -1964,6 +2002,7 @@ namespace OpenSim.Data.SQLite
sql += ") values (:"; sql += ") values (:";
sql += String.Join(", :", cols); sql += String.Join(", :", cols);
sql += ")"; sql += ")";
//m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
SqliteCommand cmd = new SqliteCommand(sql); SqliteCommand cmd = new SqliteCommand(sql);
// this provides the binding for all our parameters, so // this provides the binding for all our parameters, so
@ -2260,5 +2299,35 @@ namespace OpenSim.Data.SQLite
} }
} }
static void PrintDataSet(DataSet ds)
{
// Print out any name and extended properties.
Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
{
Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
}
Console.WriteLine();
foreach (DataTable dt in ds.Tables)
{
Console.WriteLine("=> {0} Table:", dt.TableName);
// Print out the column names.
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
{
Console.Write(dt.Columns[curCol].ColumnName + "\t");
}
Console.WriteLine("\n----------------------------------");
// Print the DataTable.
for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
{
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
{
Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
}
Console.WriteLine();
}
}
}
} }
} }

View File

@ -30,7 +30,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
@ -115,15 +115,19 @@ namespace OpenSim.Data.SQLite
setupUserCommands(da, conn); setupUserCommands(da, conn);
da.Fill(ds.Tables["users"]); da.Fill(ds.Tables["users"]);
CreateDataSetMapping(da, "users");
setupAgentCommands(dua, conn); setupAgentCommands(dua, conn);
dua.Fill(ds.Tables["useragents"]); dua.Fill(ds.Tables["useragents"]);
CreateDataSetMapping(dua, "useragents");
setupUserFriendsCommands(daf, conn); setupUserFriendsCommands(daf, conn);
daf.Fill(ds.Tables["userfriends"]); daf.Fill(ds.Tables["userfriends"]);
CreateDataSetMapping(daf, "userfriends");
setupAvatarAppearanceCommands(daa, conn); setupAvatarAppearanceCommands(daa, conn);
daa.Fill(ds.Tables["avatarappearance"]); daa.Fill(ds.Tables["avatarappearance"]);
CreateDataSetMapping(daa, "avatarappearance");
} }
return; return;
@ -706,15 +710,10 @@ namespace OpenSim.Data.SQLite
aa.SkirtItem = new UUID((String)row["SkirtItem"]); aa.SkirtItem = new UUID((String)row["SkirtItem"]);
aa.SkirtAsset = new UUID((String)row["SkirtAsset"]); aa.SkirtAsset = new UUID((String)row["SkirtAsset"]);
// Ewe Loon byte[] texture = (byte[])row["Texture"];
// Used Base64String because for some reason it wont accept using Byte[] (which works in Region date)
String str = (String)row["Texture"];
byte[] texture = Convert.FromBase64String(str);
aa.Texture = new Primitive.TextureEntry(texture, 0, texture.Length); aa.Texture = new Primitive.TextureEntry(texture, 0, texture.Length);
str = (String)row["VisualParams"]; byte[] VisualParams = (byte[])row["VisualParams"];
byte[] VisualParams = Convert.FromBase64String(str);
aa.VisualParams = VisualParams; aa.VisualParams = VisualParams;
aa.Serial = Convert.ToInt32(row["Serial"]); aa.Serial = Convert.ToInt32(row["Serial"]);
@ -793,6 +792,15 @@ namespace OpenSim.Data.SQLite
* *
**********************************************************************/ **********************************************************************/
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
{
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
foreach (DataColumn col in ds.Tables[tableName].Columns)
{
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
}
}
/// <summary> /// <summary>
/// Create the "users" table /// Create the "users" table
/// </summary> /// </summary>
@ -924,9 +932,8 @@ namespace OpenSim.Data.SQLite
SQLiteUtil.createCol(aa, "SkirtItem", typeof(String)); SQLiteUtil.createCol(aa, "SkirtItem", typeof(String));
SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String)); SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String));
// Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) SQLiteUtil.createCol(aa, "Texture", typeof (Byte[]));
SQLiteUtil.createCol(aa, "Texture", typeof (String)); SQLiteUtil.createCol(aa, "VisualParams", typeof (Byte[]));
SQLiteUtil.createCol(aa, "VisualParams", typeof (String));
SQLiteUtil.createCol(aa, "Serial", typeof(Int32)); SQLiteUtil.createCol(aa, "Serial", typeof(Int32));
SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double)); SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double));
@ -1090,8 +1097,8 @@ namespace OpenSim.Data.SQLite
row["SkirtAsset"] = appearance.SkirtAsset.ToString(); row["SkirtAsset"] = appearance.SkirtAsset.ToString();
// Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date)
row["Texture"] = Convert.ToBase64String(appearance.Texture.GetBytes()); row["Texture"] = appearance.Texture.GetBytes();
row["VisualParams"] = Convert.ToBase64String(appearance.VisualParams); row["VisualParams"] = appearance.VisualParams;
row["Serial"] = appearance.Serial; row["Serial"] = appearance.Serial;
row["AvatarHeight"] = appearance.AvatarHeight; row["AvatarHeight"] = appearance.AvatarHeight;

View File

@ -27,7 +27,7 @@
using System; using System;
using System.Data; using System.Data;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
namespace OpenSim.Data.SQLite namespace OpenSim.Data.SQLite
{ {

View File

@ -29,7 +29,7 @@ using System;
using System.Data; using System.Data;
using System.Reflection; using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
using Mono.Data.SqliteClient; using Mono.Data.Sqlite;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
@ -147,8 +147,8 @@ namespace OpenSim.Data.SQLite
} }
reader.Close(); reader.Close();
CloseReaderCommand(cmd);
//CloseCommand(cmd);
return perms; return perms;
} }
} }

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using System.Runtime.InteropServices;
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenSim.Data.SQLiteLegacy")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("OpenSim.Data.SQLiteLegacy")]
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("0.6.5.*")]
[assembly : AssemblyFileVersion("0.6.5.0")]

View File

@ -0,0 +1,12 @@
BEGIN TRANSACTION;
CREATE TABLE assets(
UUID varchar(255) primary key,
Name varchar(255),
Description varchar(255),
Type integer,
InvType integer,
Local integer,
Temporary integer,
Data blob);
COMMIT;

View File

@ -0,0 +1,32 @@
BEGIN TRANSACTION;
CREATE TABLE inventoryfolders(
UUID varchar(255) primary key,
name varchar(255),
agentID varchar(255),
parentID varchar(255),
type integer,
version integer);
CREATE TABLE inventoryitems(
UUID varchar(255) primary key,
assetID varchar(255),
assetType integer,
invType integer,
parentFolderID varchar(255),
avatarID varchar(255),
creatorsID varchar(255),
inventoryName varchar(255),
inventoryDescription varchar(255),
inventoryNextPermissions integer,
inventoryCurrentPermissions integer,
inventoryBasePermissions integer,
inventoryEveryOnePermissions integer,
salePrice integer default 99,
saleType integer default 0,
creationDate integer default 2000,
groupID varchar(255) default '00000000-0000-0000-0000-000000000000',
groupOwned integer default 0,
flags integer default 0);
COMMIT;

View File

@ -0,0 +1,144 @@
BEGIN TRANSACTION;
CREATE TABLE prims(
UUID varchar(255) primary key,
RegionUUID varchar(255),
ParentID integer,
CreationDate integer,
Name varchar(255),
SceneGroupID varchar(255),
Text varchar(255),
Description varchar(255),
SitName varchar(255),
TouchName varchar(255),
CreatorID varchar(255),
OwnerID varchar(255),
GroupID varchar(255),
LastOwnerID varchar(255),
OwnerMask integer,
NextOwnerMask integer,
GroupMask integer,
EveryoneMask integer,
BaseMask integer,
PositionX float,
PositionY float,
PositionZ float,
GroupPositionX float,
GroupPositionY float,
GroupPositionZ float,
VelocityX float,
VelocityY float,
VelocityZ float,
AngularVelocityX float,
AngularVelocityY float,
AngularVelocityZ float,
AccelerationX float,
AccelerationY float,
AccelerationZ float,
RotationX float,
RotationY float,
RotationZ float,
RotationW float,
ObjectFlags integer,
SitTargetOffsetX float NOT NULL default 0,
SitTargetOffsetY float NOT NULL default 0,
SitTargetOffsetZ float NOT NULL default 0,
SitTargetOrientW float NOT NULL default 0,
SitTargetOrientX float NOT NULL default 0,
SitTargetOrientY float NOT NULL default 0,
SitTargetOrientZ float NOT NULL default 0);
CREATE TABLE primshapes(
UUID varchar(255) primary key,
Shape integer,
ScaleX float,
ScaleY float,
ScaleZ float,
PCode integer,
PathBegin integer,
PathEnd integer,
PathScaleX integer,
PathScaleY integer,
PathShearX integer,
PathShearY integer,
PathSkew integer,
PathCurve integer,
PathRadiusOffset integer,
PathRevolutions integer,
PathTaperX integer,
PathTaperY integer,
PathTwist integer,
PathTwistBegin integer,
ProfileBegin integer,
ProfileEnd integer,
ProfileCurve integer,
ProfileHollow integer,
Texture blob,
ExtraParams blob,
State Integer NOT NULL default 0);
CREATE TABLE primitems(
itemID varchar(255) primary key,
primID varchar(255),
assetID varchar(255),
parentFolderID varchar(255),
invType integer,
assetType integer,
name varchar(255),
description varchar(255),
creationDate integer,
creatorID varchar(255),
ownerID varchar(255),
lastOwnerID varchar(255),
groupID varchar(255),
nextPermissions string,
currentPermissions string,
basePermissions string,
everyonePermissions string,
groupPermissions string);
CREATE TABLE terrain(
RegionUUID varchar(255),
Revision integer,
Heightfield blob);
CREATE TABLE land(
UUID varchar(255) primary key,
RegionUUID varchar(255),
LocalLandID string,
Bitmap blob,
Name varchar(255),
Desc varchar(255),
OwnerUUID varchar(255),
IsGroupOwned string,
Area integer,
AuctionID integer,
Category integer,
ClaimDate integer,
ClaimPrice integer,
GroupUUID varchar(255),
SalePrice integer,
LandStatus integer,
LandFlags string,
LandingType string,
MediaAutoScale string,
MediaTextureUUID varchar(255),
MediaURL varchar(255),
MusicURL varchar(255),
PassHours float,
PassPrice string,
SnapshotUUID varchar(255),
UserLocationX float,
UserLocationY float,
UserLocationZ float,
UserLookAtX float,
UserLookAtY float,
UserLookAtZ float,
AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000');
CREATE TABLE landaccesslist(
LandUUID varchar(255),
AccessUUID varchar(255),
Flags string);
COMMIT;

View File

@ -0,0 +1,39 @@
BEGIN TRANSACTION;
-- users table
CREATE TABLE users(
UUID varchar(255) primary key,
username varchar(255),
surname varchar(255),
passwordHash varchar(255),
passwordSalt varchar(255),
homeRegionX integer,
homeRegionY integer,
homeLocationX float,
homeLocationY float,
homeLocationZ float,
homeLookAtX float,
homeLookAtY float,
homeLookAtZ float,
created integer,
lastLogin integer,
rootInventoryFolderID varchar(255),
userInventoryURI varchar(255),
userAssetURI varchar(255),
profileCanDoMask integer,
profileWantDoMask integer,
profileAboutText varchar(255),
profileFirstText varchar(255),
profileImage varchar(255),
profileFirstImage varchar(255),
webLoginKey text default '00000000-0000-0000-0000-000000000000');
-- friends table
CREATE TABLE userfriends(
ownerID varchar(255),
friendID varchar(255),
friendPerms integer,
ownerPerms integer,
datetimestamp integer);
COMMIT;

View File

@ -0,0 +1,10 @@
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data);
INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets;
DROP TABLE assets;
CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data);
INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup;
DROP TABLE assets_backup;
COMMIT;

View File

@ -0,0 +1,8 @@
BEGIN TRANSACTION;
create index inventoryfolders_agentid on inventoryfolders(agentid);
create index inventoryfolders_parentid on inventoryfolders(parentid);
create index inventoryitems_parentfolderid on inventoryitems(parentfolderid);
create index inventoryitems_avatarid on inventoryitems(avatarid);
COMMIT;

View File

@ -0,0 +1,10 @@
BEGIN TRANSACTION;
CREATE TABLE regionban(
regionUUID varchar (255),
bannedUUID varchar (255),
bannedIp varchar (255),
bannedIpHostMask varchar (255)
);
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE users add homeRegionID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -0,0 +1 @@
DELETE FROM assets WHERE UUID = 'dc4b9f0bd00845c696a401dd947ac621'

View File

@ -0,0 +1,5 @@
BEGIN;
alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0;
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE primitems add flags integer not null default 0;
COMMIT;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE users add userFlags integer NOT NULL default 0;
ALTER TABLE users add godLevel integer NOT NULL default 0;
COMMIT;

View File

@ -0,0 +1,7 @@
BEGIN;
update assets
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
COMMIT;

View File

@ -0,0 +1,36 @@
BEGIN;
update inventoryitems
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update inventoryitems
set assetID = substr(assetID, 1, 8) || "-" || substr(assetID, 9, 4) || "-" || substr(assetID, 13, 4) || "-" || substr(assetID, 17, 4) || "-" || substr(assetID, 21, 12)
where assetID not like '%-%';
update inventoryitems
set parentFolderID = substr(parentFolderID, 1, 8) || "-" || substr(parentFolderID, 9, 4) || "-" || substr(parentFolderID, 13, 4) || "-" || substr(parentFolderID, 17, 4) || "-" || substr(parentFolderID, 21, 12)
where parentFolderID not like '%-%';
update inventoryitems
set avatarID = substr(avatarID, 1, 8) || "-" || substr(avatarID, 9, 4) || "-" || substr(avatarID, 13, 4) || "-" || substr(avatarID, 17, 4) || "-" || substr(avatarID, 21, 12)
where avatarID not like '%-%';
update inventoryitems
set creatorsID = substr(creatorsID, 1, 8) || "-" || substr(creatorsID, 9, 4) || "-" || substr(creatorsID, 13, 4) || "-" || substr(creatorsID, 17, 4) || "-" || substr(creatorsID, 21, 12)
where creatorsID not like '%-%';
update inventoryfolders
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update inventoryfolders
set agentID = substr(agentID, 1, 8) || "-" || substr(agentID, 9, 4) || "-" || substr(agentID, 13, 4) || "-" || substr(agentID, 17, 4) || "-" || substr(agentID, 21, 12)
where agentID not like '%-%';
update inventoryfolders
set parentID = substr(parentID, 1, 8) || "-" || substr(parentID, 9, 4) || "-" || substr(parentID, 13, 4) || "-" || substr(parentID, 17, 4) || "-" || substr(parentID, 21, 12)
where parentID not like '%-%';
COMMIT;

View File

@ -0,0 +1,38 @@
BEGIN;
create table regionsettings (
regionUUID char(36) not null,
block_terraform integer not null,
block_fly integer not null,
allow_damage integer not null,
restrict_pushing integer not null,
allow_land_resell integer not null,
allow_land_join_divide integer not null,
block_show_in_search integer not null,
agent_limit integer not null,
object_bonus float not null,
maturity integer not null,
disable_scripts integer not null,
disable_collisions integer not null,
disable_physics integer not null,
terrain_texture_1 char(36) not null,
terrain_texture_2 char(36) not null,
terrain_texture_3 char(36) not null,
terrain_texture_4 char(36) not null,
elevation_1_nw float not null,
elevation_2_nw float not null,
elevation_1_ne float not null,
elevation_2_ne float not null,
elevation_1_se float not null,
elevation_2_se float not null,
elevation_1_sw float not null,
elevation_2_sw float not null,
water_height float not null,
terrain_raise_limit float not null,
terrain_lower_limit float not null,
use_estate_sun integer not null,
fixed_sun integer not null,
sun_position float not null,
covenant char(36));
COMMIT;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE users add customType varchar(32) not null default '';
ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
delete from regionsettings;
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
CREATE TABLE `avatarattachments` (`UUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `attachpoint` int(11) NOT NULL DEFAULT 0, `item` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `asset` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000');
COMMIT;

View File

@ -0,0 +1,102 @@
BEGIN TRANSACTION;
CREATE TABLE estate_groups (
EstateID int(10) NOT NULL,
uuid char(36) NOT NULL
);
CREATE TABLE estate_managers (
EstateID int(10) NOT NULL,
uuid char(36) NOT NULL
);
CREATE TABLE estate_map (
RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
EstateID int(11) NOT NULL
);
CREATE TABLE estate_settings (
EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
EstateName varchar(64) default NULL,
AbuseEmailToEstateOwner tinyint(4) NOT NULL,
DenyAnonymous tinyint(4) NOT NULL,
ResetHomeOnTeleport tinyint(4) NOT NULL,
FixedSun tinyint(4) NOT NULL,
DenyTransacted tinyint(4) NOT NULL,
BlockDwell tinyint(4) NOT NULL,
DenyIdentified tinyint(4) NOT NULL,
AllowVoice tinyint(4) NOT NULL,
UseGlobalTime tinyint(4) NOT NULL,
PricePerMeter int(11) NOT NULL,
TaxFree tinyint(4) NOT NULL,
AllowDirectTeleport tinyint(4) NOT NULL,
RedirectGridX int(11) NOT NULL,
RedirectGridY int(11) NOT NULL,
ParentEstateID int(10) NOT NULL,
SunPosition double NOT NULL,
EstateSkipScripts tinyint(4) NOT NULL,
BillableFactor float NOT NULL,
PublicAccess tinyint(4) NOT NULL
);
insert into estate_settings (EstateID,EstateName,AbuseEmailToEstateOwner,DenyAnonymous,ResetHomeOnTeleport,FixedSun,DenyTransacted,BlockDwell,DenyIdentified,AllowVoice,UseGlobalTime,PricePerMeter,TaxFree,AllowDirectTeleport,RedirectGridX,RedirectGridY,ParentEstateID,SunPosition,PublicAccess,EstateSkipScripts,BillableFactor) values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
delete from estate_settings;
CREATE TABLE estate_users (
EstateID int(10) NOT NULL,
uuid char(36) NOT NULL
);
CREATE TABLE estateban (
EstateID int(10) NOT NULL,
bannedUUID varchar(36) NOT NULL,
bannedIp varchar(16) NOT NULL,
bannedIpHostMask varchar(16) NOT NULL,
bannedNameMask varchar(64) default NULL
);
drop table regionsettings;
CREATE TABLE regionsettings (
regionUUID char(36) NOT NULL,
block_terraform int(11) NOT NULL,
block_fly int(11) NOT NULL,
allow_damage int(11) NOT NULL,
restrict_pushing int(11) NOT NULL,
allow_land_resell int(11) NOT NULL,
allow_land_join_divide int(11) NOT NULL,
block_show_in_search int(11) NOT NULL,
agent_limit int(11) NOT NULL,
object_bonus float NOT NULL,
maturity int(11) NOT NULL,
disable_scripts int(11) NOT NULL,
disable_collisions int(11) NOT NULL,
disable_physics int(11) NOT NULL,
terrain_texture_1 char(36) NOT NULL,
terrain_texture_2 char(36) NOT NULL,
terrain_texture_3 char(36) NOT NULL,
terrain_texture_4 char(36) NOT NULL,
elevation_1_nw float NOT NULL,
elevation_2_nw float NOT NULL,
elevation_1_ne float NOT NULL,
elevation_2_ne float NOT NULL,
elevation_1_se float NOT NULL,
elevation_2_se float NOT NULL,
elevation_1_sw float NOT NULL,
elevation_2_sw float NOT NULL,
water_height float NOT NULL,
terrain_raise_limit float NOT NULL,
terrain_lower_limit float NOT NULL,
use_estate_sun int(11) NOT NULL,
fixed_sun int(11) NOT NULL,
sun_position float NOT NULL,
covenant char(36) default NULL,
Sandbox tinyint(4) NOT NULL,
PRIMARY KEY (regionUUID)
);
CREATE INDEX estate_ban_estate_id on estateban(EstateID);
CREATE INDEX estate_groups_estate_id on estate_groups(EstateID);
CREATE INDEX estate_managers_estate_id on estate_managers(EstateID);
CREATE INDEX estate_map_estate_id on estate_map(EstateID);
CREATE UNIQUE INDEX estate_map_region_id on estate_map(RegionID);
CREATE INDEX estate_users_estate_id on estate_users(EstateID);
COMMIT;

View File

@ -0,0 +1,20 @@
BEGIN TRANSACTION;
-- usersagents table
CREATE TABLE IF NOT EXISTS useragents(
UUID varchar(255) primary key,
agentIP varchar(255),
agentPort integer,
agentOnline boolean,
sessionID varchar(255),
secureSessionID varchar(255),
regionID varchar(255),
loginTime integer,
logoutTime integer,
currentRegion varchar(255),
currentHandle varchar(255),
currentPosX float,
currentPosY float,
currentPosZ float);
COMMIT;

View File

@ -0,0 +1,8 @@
begin;
alter table estate_settings add column AbuseEmail varchar(255) not null default '';
alter table estate_settings add column EstateOwner varchar(36) not null default '';
commit;

View File

@ -0,0 +1,7 @@
BEGIN TRANSACTION;
ALTER TABLE useragents add currentLookAtX float not null default 128;
ALTER TABLE useragents add currentLookAtY float not null default 128;
ALTER TABLE useragents add currentLookAtZ float not null default 70;
COMMIT;

View File

@ -0,0 +1,6 @@
begin;
alter table estate_settings add column DenyMinors tinyint not null default 0;
commit;

View File

@ -0,0 +1,5 @@
BEGIN TRANSACTION;
ALTER TABLE users add email varchar(250);
COMMIT;

View File

@ -0,0 +1,8 @@
BEGIN;
ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;
COMMIT;

View File

@ -0,0 +1,11 @@
BEGIN;
update users
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update useragents
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE prims ADD COLUMN ClickAction INTEGER NOT NULL default 0;
COMMIT;

View File

@ -0,0 +1,37 @@
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS avatarappearance(
Owner varchar(36) NOT NULL primary key,
BodyItem varchar(36) DEFAULT NULL,
BodyAsset varchar(36) DEFAULT NULL,
SkinItem varchar(36) DEFAULT NULL,
SkinAsset varchar(36) DEFAULT NULL,
HairItem varchar(36) DEFAULT NULL,
HairAsset varchar(36) DEFAULT NULL,
EyesItem varchar(36) DEFAULT NULL,
EyesAsset varchar(36) DEFAULT NULL,
ShirtItem varchar(36) DEFAULT NULL,
ShirtAsset varchar(36) DEFAULT NULL,
PantsItem varchar(36) DEFAULT NULL,
PantsAsset varchar(36) DEFAULT NULL,
ShoesItem varchar(36) DEFAULT NULL,
ShoesAsset varchar(36) DEFAULT NULL,
SocksItem varchar(36) DEFAULT NULL,
SocksAsset varchar(36) DEFAULT NULL,
JacketItem varchar(36) DEFAULT NULL,
JacketAsset varchar(36) DEFAULT NULL,
GlovesItem varchar(36) DEFAULT NULL,
GlovesAsset varchar(36) DEFAULT NULL,
UnderShirtItem varchar(36) DEFAULT NULL,
UnderShirtAsset varchar(36) DEFAULT NULL,
UnderPantsItem varchar(36) DEFAULT NULL,
UnderPantsAsset varchar(36) DEFAULT NULL,
SkirtItem varchar(36) DEFAULT NULL,
SkirtAsset varchar(36) DEFAULT NULL,
Texture blob,
VisualParams blob,
Serial int DEFAULT NULL,
AvatarHeight float DEFAULT NULL
);
COMMIT;

View File

@ -0,0 +1,28 @@
BEGIN;
ALTER TABLE prims ADD COLUMN PayPrice INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton1 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton2 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton3 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton4 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
ALTER TABLE prims ADD COLUMN LoopedSoundGain float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN TextureAnimation string;
ALTER TABLE prims ADD COLUMN ParticleSystem string;
ALTER TABLE prims ADD COLUMN OmegaX float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN OmegaY float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN OmegaZ float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetX float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetY float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN ForceMouselook string NOT NULL default 0;
ALTER TABLE prims ADD COLUMN ScriptAccessPin INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN AllowedDrop INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN DieAtEdge string NOT NULL default 0;
ALTER TABLE prims ADD COLUMN SalePrice INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN SaleType string NOT NULL default 0;
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE prims ADD COLUMN Material INTEGER NOT NULL default 3;
COMMIT;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE land ADD COLUMN OtherCleanTime INTEGER NOT NULL default 0;
ALTER TABLE land ADD COLUMN Dwell INTEGER NOT NULL default 0;
COMMIT;

View File

@ -0,0 +1,8 @@
begin;
ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0;
ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0;
ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0;
commit;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0;
COMMIT;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -0,0 +1,8 @@
BEGIN;
CREATE TEMPORARY TABLE prims_backup(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
INSERT INTO prims_backup SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims;
DROP TABLE prims;
CREATE TABLE prims(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
INSERT INTO prims SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims_backup;
DROP TABLE prims_backup;
COMMIT;

View File

@ -0,0 +1,79 @@
BEGIN;
update terrain
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
where RegionUUID not like '%-%';
update landaccesslist
set LandUUID = substr(LandUUID, 1, 8) || "-" || substr(LandUUID, 9, 4) || "-" || substr(LandUUID, 13, 4) || "-" || substr(LandUUID, 17, 4) || "-" || substr(LandUUID, 21, 12)
where LandUUID not like '%-%';
update landaccesslist
set AccessUUID = substr(AccessUUID, 1, 8) || "-" || substr(AccessUUID, 9, 4) || "-" || substr(AccessUUID, 13, 4) || "-" || substr(AccessUUID, 17, 4) || "-" || substr(AccessUUID, 21, 12)
where AccessUUID not like '%-%';
update prims
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update prims
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
where RegionUUID not like '%-%';
update prims
set SceneGroupID = substr(SceneGroupID, 1, 8) || "-" || substr(SceneGroupID, 9, 4) || "-" || substr(SceneGroupID, 13, 4) || "-" || substr(SceneGroupID, 17, 4) || "-" || substr(SceneGroupID, 21, 12)
where SceneGroupID not like '%-%';
update prims
set CreatorID = substr(CreatorID, 1, 8) || "-" || substr(CreatorID, 9, 4) || "-" || substr(CreatorID, 13, 4) || "-" || substr(CreatorID, 17, 4) || "-" || substr(CreatorID, 21, 12)
where CreatorID not like '%-%';
update prims
set OwnerID = substr(OwnerID, 1, 8) || "-" || substr(OwnerID, 9, 4) || "-" || substr(OwnerID, 13, 4) || "-" || substr(OwnerID, 17, 4) || "-" || substr(OwnerID, 21, 12)
where OwnerID not like '%-%';
update prims
set GroupID = substr(GroupID, 1, 8) || "-" || substr(GroupID, 9, 4) || "-" || substr(GroupID, 13, 4) || "-" || substr(GroupID, 17, 4) || "-" || substr(GroupID, 21, 12)
where GroupID not like '%-%';
update prims
set LastOwnerID = substr(LastOwnerID, 1, 8) || "-" || substr(LastOwnerID, 9, 4) || "-" || substr(LastOwnerID, 13, 4) || "-" || substr(LastOwnerID, 17, 4) || "-" || substr(LastOwnerID, 21, 12)
where LastOwnerID not like '%-%';
update primshapes
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update land
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
where UUID not like '%-%';
update land
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
where RegionUUID not like '%-%';
update land
set OwnerUUID = substr(OwnerUUID, 1, 8) || "-" || substr(OwnerUUID, 9, 4) || "-" || substr(OwnerUUID, 13, 4) || "-" || substr(OwnerUUID, 17, 4) || "-" || substr(OwnerUUID, 21, 12)
where OwnerUUID not like '%-%';
update land
set GroupUUID = substr(GroupUUID, 1, 8) || "-" || substr(GroupUUID, 9, 4) || "-" || substr(GroupUUID, 13, 4) || "-" || substr(GroupUUID, 17, 4) || "-" || substr(GroupUUID, 21, 12)
where GroupUUID not like '%-%';
update land
set MediaTextureUUID = substr(MediaTextureUUID, 1, 8) || "-" || substr(MediaTextureUUID, 9, 4) || "-" || substr(MediaTextureUUID, 13, 4) || "-" || substr(MediaTextureUUID, 17, 4) || "-" || substr(MediaTextureUUID, 21, 12)
where MediaTextureUUID not like '%-%';
update land
set SnapshotUUID = substr(SnapshotUUID, 1, 8) || "-" || substr(SnapshotUUID, 9, 4) || "-" || substr(SnapshotUUID, 13, 4) || "-" || substr(SnapshotUUID, 17, 4) || "-" || substr(SnapshotUUID, 21, 12)
where SnapshotUUID not like '%-%';
update land
set AuthbuyerID = substr(AuthbuyerID, 1, 8) || "-" || substr(AuthbuyerID, 9, 4) || "-" || substr(AuthbuyerID, 13, 4) || "-" || substr(AuthbuyerID, 17, 4) || "-" || substr(AuthbuyerID, 21, 12)
where AuthbuyerID not like '%-%';
COMMIT;

View File

@ -0,0 +1,20 @@
<Addin id="OpenSim.Data.SQLite" version="0.1">
<Runtime>
<Import assembly="OpenSim.Data.SQLite.dll"/>
</Runtime>
<Dependencies>
<Addin id="OpenSim.Data" version="0.5" />
</Dependencies>
<Extension path = "/OpenSim/GridData">
<Plugin id="SQLiteGridData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteGridData" />
</Extension>
<Extension path = "/OpenSim/AssetData">
<Plugin id="SQLiteAssetData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteAssetData" />
</Extension>
<Extension path = "/OpenSim/InventoryData">
<Plugin id="SQLiteInventoryData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteInventoryStore" />
</Extension>
<Extension path = "/OpenSim/UserData">
<Plugin id="SQLiteUserData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteUserData" />
</Extension>
</Addin>

View File

@ -0,0 +1,342 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Data;
using System.Reflection;
using System.Collections.Generic;
using log4net;
using Mono.Data.SqliteClient;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.SQLiteLegacy
{
/// <summary>
/// An asset storage interface for the SQLite database system
/// </summary>
public class SQLiteAssetData : AssetDataBase
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count";
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)";
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
private const string assetSelect = "select * from assets";
private SqliteConnection m_conn;
override public void Dispose()
{
if (m_conn != null)
{
m_conn.Close();
m_conn = null;
}
}
/// <summary>
/// <list type="bullet">
/// <item>Initialises AssetData interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
/// <item>use default URI if connect string is empty.</item>
/// </list>
/// </summary>
/// <param name="dbconnect">connect string</param>
override public void Initialise(string dbconnect)
{
if (dbconnect == string.Empty)
{
dbconnect = "URI=file:Asset.db,version=3";
}
m_conn = new SqliteConnection(dbconnect);
m_conn.Open();
Assembly assem = GetType().Assembly;
Migration m = new Migration(m_conn, assem, "AssetStore");
m.Update();
return;
}
/// <summary>
/// Fetch Asset
/// </summary>
/// <param name="uuid">UUID of ... ?</param>
/// <returns>Asset base</returns>
override public AssetBase GetAsset(UUID uuid)
{
lock (this)
{
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
using (IDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
AssetBase asset = buildAsset(reader);
reader.Close();
return asset;
}
else
{
reader.Close();
return null;
}
}
}
}
}
/// <summary>
/// Create an asset
/// </summary>
/// <param name="asset">Asset Base</param>
override public void StoreAsset(AssetBase asset)
{
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
if (ExistsAsset(asset.FullID))
{
//LogAssetLoad(asset);
lock (this)
{
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
}
}
}
else
{
lock (this)
{
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery();
}
}
}
}
// /// <summary>
// /// Some... logging functionnality
// /// </summary>
// /// <param name="asset"></param>
// private static void LogAssetLoad(AssetBase asset)
// {
// string temporary = asset.Temporary ? "Temporary" : "Stored";
// string local = asset.Local ? "Local" : "Remote";
//
// int assetLength = (asset.Data != null) ? asset.Data.Length : 0;
//
// m_log.Debug("[ASSET DB]: " +
// string.Format("Loaded {5} {4} Asset: [{0}][{3}] \"{1}\":{2} ({6} bytes)",
// asset.FullID, asset.Name, asset.Description, asset.Type,
// temporary, local, assetLength));
// }
/// <summary>
/// Check if an asset exist in database
/// </summary>
/// <param name="uuid">The asset UUID</param>
/// <returns>True if exist, or false.</returns>
override public bool ExistsAsset(UUID uuid)
{
lock (this) {
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
using (IDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
reader.Close();
return true;
}
else
{
reader.Close();
return false;
}
}
}
}
}
/// <summary>
/// Delete an asset from database
/// </summary>
/// <param name="uuid"></param>
public void DeleteAsset(UUID uuid)
{
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
cmd.ExecuteNonQuery();
}
}
/// <summary>
///
/// </summary>
/// <param name="row"></param>
/// <returns></returns>
private static AssetBase buildAsset(IDataReader row)
{
// TODO: this doesn't work yet because something more
// interesting has to be done to actually get these values
// back out. Not enough time to figure it out yet.
AssetBase asset = new AssetBase(
new UUID((String)row["UUID"]),
(String)row["Name"],
Convert.ToSByte(row["Type"])
);
asset.Description = (String) row["Description"];
asset.Local = Convert.ToBoolean(row["Local"]);
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
asset.Data = (byte[]) row["Data"];
return asset;
}
private static AssetMetadata buildAssetMetadata(IDataReader row)
{
AssetMetadata metadata = new AssetMetadata();
metadata.FullID = new UUID((string) row["UUID"]);
metadata.Name = (string) row["Name"];
metadata.Description = (string) row["Description"];
metadata.Type = Convert.ToSByte(row["Type"]);
metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct.
// Current SHA1s are not stored/computed.
metadata.SHA1 = new byte[] {};
return metadata;
}
/// <summary>
/// Returns a list of AssetMetadata objects. The list is a subset of
/// the entire data set offset by <paramref name="start" /> containing
/// <paramref name="count" /> elements.
/// </summary>
/// <param name="start">The number of results to discard from the total data set.</param>
/// <param name="count">The number of rows the returned list should contain.</param>
/// <returns>A list of AssetMetadata objects.</returns>
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
{
List<AssetMetadata> retList = new List<AssetMetadata>(count);
lock (this)
{
using (SqliteCommand cmd = new SqliteCommand(SelectAssetMetadataSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":start", start));
cmd.Parameters.Add(new SqliteParameter(":count", count));
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
AssetMetadata metadata = buildAssetMetadata(reader);
retList.Add(metadata);
}
}
}
}
return retList;
}
/***********************************************************************
*
* Database Binding functions
*
* These will be db specific due to typing, and minor differences
* in databases.
*
**********************************************************************/
#region IPlugin interface
/// <summary>
///
/// </summary>
override public string Version
{
get
{
Module module = GetType().Module;
// string dllName = module.Assembly.ManifestModule.Name;
Version dllVersion = module.Assembly.GetName().Version;
return
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
dllVersion.Revision);
}
}
/// <summary>
/// Initialise the AssetData interface using default URI
/// </summary>
override public void Initialise()
{
Initialise("URI=file:Asset.db,version=3");
}
/// <summary>
/// Name of this DB provider
/// </summary>
override public string Name
{
get { return "SQLite Asset storage engine"; }
}
#endregion
}
}

View File

@ -0,0 +1,262 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
using Mono.Data.SqliteClient;
namespace OpenSim.Data.SQLiteLegacy
{
public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
{
private string m_Realm;
private List<string> m_ColumnNames;
private int m_LastExpire;
private string m_connectionString;
protected static SqliteConnection m_Connection;
private static bool m_initialized = false;
public SQLiteAuthenticationData(string connectionString, string realm)
: base(connectionString)
{
m_Realm = realm;
m_connectionString = connectionString;
if (!m_initialized)
{
m_Connection = new SqliteConnection(connectionString);
m_Connection.Open();
using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone())
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
m.Update();
dbcon.Close();
}
m_initialized = true;
}
}
public AuthenticationData Get(UUID principalID)
{
AuthenticationData ret = new AuthenticationData();
ret.Data = new Dictionary<string, object>();
SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID");
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
IDataReader result = ExecuteReader(cmd, m_Connection);
try
{
if (result.Read())
{
ret.PrincipalID = principalID;
if (m_ColumnNames == null)
{
m_ColumnNames = new List<string>();
DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
m_ColumnNames.Add(row["ColumnName"].ToString());
}
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
return ret;
}
else
{
return null;
}
}
catch
{
}
finally
{
CloseCommand(cmd);
}
return null;
}
public bool Store(AuthenticationData data)
{
if (data.Data.ContainsKey("UUID"))
data.Data.Remove("UUID");
string[] fields = new List<string>(data.Data.Keys).ToArray();
string[] values = new string[data.Data.Count];
int i = 0;
foreach (object o in data.Data.Values)
values[i++] = o.ToString();
SqliteCommand cmd = new SqliteCommand();
if (Get(data.PrincipalID) != null)
{
string update = "update `" + m_Realm + "` set ";
bool first = true;
foreach (string field in fields)
{
if (!first)
update += ", ";
update += "`" + field + "` = :" + field;
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
first = false;
}
update += " where UUID = :UUID";
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
cmd.CommandText = update;
try
{
if (ExecuteNonQuery(cmd, m_Connection) < 1)
{
CloseCommand(cmd);
return false;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
CloseCommand(cmd);
return false;
}
}
else
{
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
String.Join("`, `", fields) +
"`) values (:UUID, :" + String.Join(", :", fields) + ")";
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
foreach (string field in fields)
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
cmd.CommandText = insert;
try
{
if (ExecuteNonQuery(cmd, m_Connection) < 1)
{
CloseCommand(cmd);
return false;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
CloseCommand(cmd);
return false;
}
}
CloseCommand(cmd);
return true;
}
public bool SetDataItem(UUID principalID, string item, string value)
{
SqliteCommand cmd = new SqliteCommand("update `" + m_Realm +
"` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
return true;
return false;
}
public bool SetToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
"', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
{
cmd.Dispose();
return true;
}
cmd.Dispose();
return false;
}
public bool CheckToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
{
cmd.Dispose();
return true;
}
cmd.Dispose();
return false;
}
private void DoExpire()
{
SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')");
ExecuteNonQuery(cmd, m_Connection);
cmd.Dispose();
m_LastExpire = System.Environment.TickCount;
}
}
}

View File

@ -0,0 +1,389 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using log4net;
using Mono.Data.SqliteClient;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Data.SQLiteLegacy
{
public class SQLiteEstateStore : IEstateDataStore
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private SqliteConnection m_connection;
private string m_connectionString;
private FieldInfo[] m_Fields;
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
m_connection = new SqliteConnection(m_connectionString);
m_connection.Open();
Assembly assem = GetType().Assembly;
Migration m = new Migration(m_connection, assem, "EstateStore");
m.Update();
m_connection.Close();
m_connection.Open();
Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
foreach (FieldInfo f in m_Fields)
if (f.Name.Substring(0, 2) == "m_")
m_FieldMap[f.Name.Substring(2)] = f;
}
private string[] FieldList
{
get { return new List<string>(m_FieldMap.Keys).ToArray(); }
}
public EstateSettings LoadEstateSettings(UUID regionID)
{
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
cmd.Parameters.Add(":RegionID", regionID.ToString());
return DoLoad(cmd, regionID);
}
private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID)
{
EstateSettings es = new EstateSettings();
es.OnSave += StoreEstateSettings;
IDataReader r = cmd.ExecuteReader();
if (r.Read())
{
foreach (string name in FieldList)
{
if (m_FieldMap[name].GetValue(es) is bool)
{
int v = Convert.ToInt32(r[name]);
if (v != 0)
m_FieldMap[name].SetValue(es, true);
else
m_FieldMap[name].SetValue(es, false);
}
else if (m_FieldMap[name].GetValue(es) is UUID)
{
UUID uuid = UUID.Zero;
UUID.TryParse(r[name].ToString(), out uuid);
m_FieldMap[name].SetValue(es, uuid);
}
else
{
m_FieldMap[name].SetValue(es, Convert.ChangeType(r[name], m_FieldMap[name].FieldType));
}
}
r.Close();
}
else
{
// Migration case
//
r.Close();
List<string> names = new List<string>(FieldList);
names.Remove("EstateID");
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
cmd.CommandText = sql;
cmd.Parameters.Clear();
foreach (string name in FieldList)
{
if (m_FieldMap[name].GetValue(es) is bool)
{
if ((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add(":"+name, "1");
else
cmd.Parameters.Add(":"+name, "0");
}
else
{
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd.ExecuteNonQuery();
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
cmd.Parameters.Clear();
r = cmd.ExecuteReader();
r.Read();
es.EstateID = Convert.ToUInt32(r["id"]);
r.Close();
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
cmd.Parameters.Add(":RegionID", regionID.ToString());
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
// This will throw on dupe key
try
{
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
es.Save();
}
LoadBanList(es);
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
return es;
}
public void StoreEstateSettings(EstateSettings es)
{
List<string> fields = new List<string>(FieldList);
fields.Remove("EstateID");
List<string> terms = new List<string>();
foreach (string f in fields)
terms.Add(f+" = :"+f);
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
foreach (string name in FieldList)
{
if (m_FieldMap[name].GetValue(es) is bool)
{
if ((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add(":"+name, "1");
else
cmd.Parameters.Add(":"+name, "0");
}
else
{
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd.ExecuteNonQuery();
SaveBanList(es);
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
}
private void LoadBanList(EstateSettings es)
{
es.ClearBans();
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", es.EstateID);
IDataReader r = cmd.ExecuteReader();
while (r.Read())
{
EstateBan eb = new EstateBan();
UUID uuid = new UUID();
UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
eb.BannedUserID = uuid;
eb.BannedHostAddress = "0.0.0.0";
eb.BannedHostIPMask = "0.0.0.0";
es.AddBan(eb);
}
r.Close();
}
private void SaveBanList(EstateSettings es)
{
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )";
foreach (EstateBan b in es.EstateBans)
{
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
void SaveUUIDList(uint EstateID, string table, UUID[] data)
{
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( :EstateID, :uuid )";
foreach (UUID uuid in data)
{
cmd.Parameters.Add(":EstateID", EstateID.ToString());
cmd.Parameters.Add(":uuid", uuid.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
UUID[] LoadUUIDList(uint EstateID, string table)
{
List<UUID> uuids = new List<UUID>();
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", EstateID);
IDataReader r = cmd.ExecuteReader();
while (r.Read())
{
// EstateBan eb = new EstateBan();
UUID uuid = new UUID();
UUID.TryParse(r["uuid"].ToString(), out uuid);
uuids.Add(uuid);
}
r.Close();
return uuids.ToArray();
}
public EstateSettings LoadEstateSettings(int estateID)
{
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
cmd.Parameters.Add(":EstateID", estateID.ToString());
return DoLoad(cmd, UUID.Zero);
}
public List<int> GetEstates(string search)
{
List<int> result = new List<int>();
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
cmd.Parameters.Add(":EstateName", search);
IDataReader r = cmd.ExecuteReader();
while (r.Read())
{
result.Add(Convert.ToInt32(r["EstateID"]));
}
r.Close();
return result;
}
public bool LinkRegion(UUID regionID, int estateID)
{
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
cmd.Parameters.Add(":RegionID", regionID.ToString());
cmd.Parameters.Add(":EstateID", estateID.ToString());
if (cmd.ExecuteNonQuery() == 0)
return false;
return true;
}
public List<UUID> GetRegions(int estateID)
{
return new List<UUID>();
}
public bool DeleteEstate(int estateID)
{
return false;
}
}
}

View File

@ -0,0 +1,91 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
using Mono.Data.SqliteClient;
namespace OpenSim.Data.SQLiteLegacy
{
/// <summary>
/// A database interface class to a user profile storage system
/// </summary>
public class SQLiteFramework
{
protected Object m_lockObject = new Object();
protected SQLiteFramework(string connectionString)
{
}
//////////////////////////////////////////////////////////////
//
// All non queries are funneled through one connection
// to increase performance a little
//
protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection)
{
lock (connection)
{
SqliteConnection newConnection =
(SqliteConnection)((ICloneable)connection).Clone();
newConnection.Open();
cmd.Connection = newConnection;
//Console.WriteLine("XXX " + cmd.CommandText);
return cmd.ExecuteNonQuery();
}
}
protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
{
lock (connection)
{
SqliteConnection newConnection =
(SqliteConnection)((ICloneable)connection).Clone();
newConnection.Open();
cmd.Connection = newConnection;
//Console.WriteLine("XXX " + cmd.CommandText);
return cmd.ExecuteReader();
}
}
protected void CloseCommand(SqliteCommand cmd)
{
cmd.Connection.Close();
cmd.Connection.Dispose();
cmd.Dispose();
}
}
}

View File

@ -0,0 +1,268 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using log4net;
using Mono.Data.SqliteClient;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Data.SQLiteLegacy
{
public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new()
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<string, FieldInfo> m_Fields =
new Dictionary<string, FieldInfo>();
protected List<string> m_ColumnNames = null;
protected string m_Realm;
protected FieldInfo m_DataField = null;
protected static SqliteConnection m_Connection;
private static bool m_initialized;
public SQLiteGenericTableHandler(string connectionString,
string realm, string storeName) : base(connectionString)
{
m_Realm = realm;
if (!m_initialized)
{
m_Connection = new SqliteConnection(connectionString);
m_Connection.Open();
if (storeName != String.Empty)
{
Assembly assem = GetType().Assembly;
SqliteConnection newConnection =
(SqliteConnection)((ICloneable)m_Connection).Clone();
newConnection.Open();
Migration m = new Migration(newConnection, assem, storeName);
m.Update();
newConnection.Close();
newConnection.Dispose();
}
m_initialized = true;
}
Type t = typeof(T);
FieldInfo[] fields = t.GetFields(BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
if (fields.Length == 0)
return;
foreach (FieldInfo f in fields)
{
if (f.Name != "Data")
m_Fields[f.Name] = f;
else
m_DataField = f;
}
}
private void CheckColumnNames(IDataReader reader)
{
if (m_ColumnNames != null)
return;
m_ColumnNames = new List<string>();
DataTable schemaTable = reader.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
{
if (row["ColumnName"] != null &&
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
m_ColumnNames.Add(row["ColumnName"].ToString());
}
}
public T[] Get(string field, string key)
{
return Get(new string[] { field }, new string[] { key });
}
public T[] Get(string[] fields, string[] keys)
{
if (fields.Length != keys.Length)
return new T[0];
List<string> terms = new List<string>();
SqliteCommand cmd = new SqliteCommand();
for (int i = 0 ; i < fields.Length ; i++)
{
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
terms.Add("`" + fields[i] + "` = :" + fields[i]);
}
string where = String.Join(" and ", terms.ToArray());
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
protected T[] DoQuery(SqliteCommand cmd)
{
IDataReader reader = ExecuteReader(cmd, m_Connection);
if (reader == null)
return new T[0];
CheckColumnNames(reader);
List<T> result = new List<T>();
while (reader.Read())
{
T row = new T();
foreach (string name in m_Fields.Keys)
{
if (m_Fields[name].GetValue(row) is bool)
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v != 0 ? true : false);
}
else if (m_Fields[name].GetValue(row) is UUID)
{
UUID uuid = UUID.Zero;
UUID.TryParse(reader[name].ToString(), out uuid);
m_Fields[name].SetValue(row, uuid);
}
else if (m_Fields[name].GetValue(row) is int)
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v);
}
else
{
m_Fields[name].SetValue(row, reader[name]);
}
}
if (m_DataField != null)
{
Dictionary<string, string> data =
new Dictionary<string, string>();
foreach (string col in m_ColumnNames)
{
data[col] = reader[col].ToString();
if (data[col] == null)
data[col] = String.Empty;
}
m_DataField.SetValue(row, data);
}
result.Add(row);
}
CloseCommand(cmd);
return result.ToArray();
}
public T[] Get(string where)
{
SqliteCommand cmd = new SqliteCommand();
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
public bool Store(T row)
{
SqliteCommand cmd = new SqliteCommand();
string query = "";
List<String> names = new List<String>();
List<String> values = new List<String>();
foreach (FieldInfo fi in m_Fields.Values)
{
names.Add(fi.Name);
values.Add(":" + fi.Name);
cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString()));
}
if (m_DataField != null)
{
Dictionary<string, string> data =
(Dictionary<string, string>)m_DataField.GetValue(row);
foreach (KeyValuePair<string, string> kvp in data)
{
names.Add(kvp.Key);
values.Add(":" + kvp.Key);
cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value));
}
}
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
cmd.CommandText = query;
if (ExecuteNonQuery(cmd, m_Connection) > 0)
return true;
return false;
}
public bool Delete(string field, string val)
{
SqliteCommand cmd = new SqliteCommand();
cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
cmd.Parameters.Add(new SqliteParameter(field, val));
if (ExecuteNonQuery(cmd, m_Connection) > 0)
return true;
return false;
}
}
}

View File

@ -0,0 +1,898 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using log4net;
using Mono.Data.SqliteClient;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.SQLiteLegacy
{
/// <summary>
/// An Inventory Interface to the SQLite database
/// </summary>
public class SQLiteInventoryStore : SQLiteUtil, IInventoryDataPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string invItemsSelect = "select * from inventoryitems";
private const string invFoldersSelect = "select * from inventoryfolders";
private static SqliteConnection conn;
private static DataSet ds;
private static SqliteDataAdapter invItemsDa;
private static SqliteDataAdapter invFoldersDa;
private static bool m_Initialized = false;
public void Initialise()
{
m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException(Name);
}
/// <summary>
/// <list type="bullet">
/// <item>Initialises Inventory interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
/// <item>use default URI if connect string string is empty.</item>
/// </list>
/// </summary>
/// <param name="dbconnect">connect string</param>
public void Initialise(string dbconnect)
{
if (!m_Initialized)
{
m_Initialized = true;
if (dbconnect == string.Empty)
{
dbconnect = "URI=file:inventoryStore.db,version=3";
}
m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect);
conn = new SqliteConnection(dbconnect);
conn.Open();
Assembly assem = GetType().Assembly;
Migration m = new Migration(conn, assem, "InventoryStore");
m.Update();
SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
invItemsDa = new SqliteDataAdapter(itemsSelectCmd);
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn);
invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
ds = new DataSet();
ds.Tables.Add(createInventoryFoldersTable());
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
setupFoldersCommands(invFoldersDa, conn);
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
ds.Tables.Add(createInventoryItemsTable());
invItemsDa.Fill(ds.Tables["inventoryitems"]);
setupItemsCommands(invItemsDa, conn);
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
ds.AcceptChanges();
}
}
/// <summary>
/// Closes the inventory interface
/// </summary>
public void Dispose()
{
if (conn != null)
{
conn.Close();
conn = null;
}
if (invItemsDa != null)
{
invItemsDa.Dispose();
invItemsDa = null;
}
if (invFoldersDa != null)
{
invFoldersDa.Dispose();
invFoldersDa = null;
}
if (ds != null)
{
ds.Dispose();
ds = null;
}
}
/// <summary>
///
/// </summary>
/// <param name="row"></param>
/// <returns></returns>
public InventoryItemBase buildItem(DataRow row)
{
InventoryItemBase item = new InventoryItemBase();
item.ID = new UUID((string) row["UUID"]);
item.AssetID = new UUID((string) row["assetID"]);
item.AssetType = Convert.ToInt32(row["assetType"]);
item.InvType = Convert.ToInt32(row["invType"]);
item.Folder = new UUID((string) row["parentFolderID"]);
item.Owner = new UUID((string) row["avatarID"]);
item.CreatorId = (string)row["creatorsID"];
item.Name = (string) row["inventoryName"];
item.Description = (string) row["inventoryDescription"];
item.NextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]);
item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]);
item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]);
item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]);
item.GroupPermissions = Convert.ToUInt32(row["inventoryGroupPermissions"]);
// new fields
if (!Convert.IsDBNull(row["salePrice"]))
item.SalePrice = Convert.ToInt32(row["salePrice"]);
if (!Convert.IsDBNull(row["saleType"]))
item.SaleType = Convert.ToByte(row["saleType"]);
if (!Convert.IsDBNull(row["creationDate"]))
item.CreationDate = Convert.ToInt32(row["creationDate"]);
if (!Convert.IsDBNull(row["groupID"]))
item.GroupID = new UUID((string)row["groupID"]);
if (!Convert.IsDBNull(row["groupOwned"]))
item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
if (!Convert.IsDBNull(row["Flags"]))
item.Flags = Convert.ToUInt32(row["Flags"]);
return item;
}
/// <summary>
/// Fill a database row with item data
/// </summary>
/// <param name="row"></param>
/// <param name="item"></param>
private static void fillItemRow(DataRow row, InventoryItemBase item)
{
row["UUID"] = item.ID.ToString();
row["assetID"] = item.AssetID.ToString();
row["assetType"] = item.AssetType;
row["invType"] = item.InvType;
row["parentFolderID"] = item.Folder.ToString();
row["avatarID"] = item.Owner.ToString();
row["creatorsID"] = item.CreatorId.ToString();
row["inventoryName"] = item.Name;
row["inventoryDescription"] = item.Description;
row["inventoryNextPermissions"] = item.NextPermissions;
row["inventoryCurrentPermissions"] = item.CurrentPermissions;
row["inventoryBasePermissions"] = item.BasePermissions;
row["inventoryEveryOnePermissions"] = item.EveryOnePermissions;
row["inventoryGroupPermissions"] = item.GroupPermissions;
// new fields
row["salePrice"] = item.SalePrice;
row["saleType"] = item.SaleType;
row["creationDate"] = item.CreationDate;
row["groupID"] = item.GroupID.ToString();
row["groupOwned"] = item.GroupOwned;
row["flags"] = item.Flags;
}
/// <summary>
/// Add inventory folder
/// </summary>
/// <param name="folder">Folder base</param>
/// <param name="add">true=create folder. false=update existing folder</param>
/// <remarks>nasty</remarks>
private void addFolder(InventoryFolderBase folder, bool add)
{
lock (ds)
{
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
if (inventoryRow == null)
{
if (! add)
m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID);
inventoryRow = inventoryFolderTable.NewRow();
fillFolderRow(inventoryRow, folder);
inventoryFolderTable.Rows.Add(inventoryRow);
}
else
{
if (add)
m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.ID);
fillFolderRow(inventoryRow, folder);
}
invFoldersDa.Update(ds, "inventoryfolders");
}
}
/// <summary>
/// Move an inventory folder
/// </summary>
/// <param name="folder">folder base</param>
private void moveFolder(InventoryFolderBase folder)
{
lock (ds)
{
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
if (inventoryRow == null)
{
inventoryRow = inventoryFolderTable.NewRow();
fillFolderRow(inventoryRow, folder);
inventoryFolderTable.Rows.Add(inventoryRow);
}
else
{
moveFolderRow(inventoryRow, folder);
}
invFoldersDa.Update(ds, "inventoryfolders");
}
}
/// <summary>
/// add an item in inventory
/// </summary>
/// <param name="item">the item</param>
/// <param name="add">true=add item ; false=update existing item</param>
private void addItem(InventoryItemBase item, bool add)
{
lock (ds)
{
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
DataRow inventoryRow = inventoryItemTable.Rows.Find(item.ID.ToString());
if (inventoryRow == null)
{
if (!add)
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID);
inventoryRow = inventoryItemTable.NewRow();
fillItemRow(inventoryRow, item);
inventoryItemTable.Rows.Add(inventoryRow);
}
else
{
if (add)
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID);
fillItemRow(inventoryRow, item);
}
invItemsDa.Update(ds, "inventoryitems");
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString());
if (inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either.
inventoryRow["version"] = (int)inventoryRow["version"] + 1;
invFoldersDa.Update(ds, "inventoryfolders");
}
}
/// <summary>
/// TODO : DataSet commit
/// </summary>
public void Shutdown()
{
// TODO: DataSet commit
}
/// <summary>
/// The name of this DB provider
/// </summary>
/// <returns>Name of DB provider</returns>
public string Name
{
get { return "SQLite Inventory Data Interface"; }
}
/// <summary>
/// Returns the version of this DB provider
/// </summary>
/// <returns>A string containing the DB provider version</returns>
public string Version
{
get
{
Module module = GetType().Module;
// string dllName = module.Assembly.ManifestModule.Name;
Version dllVersion = module.Assembly.GetName().Version;
return
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
dllVersion.Revision);
}
}
/// <summary>
/// Returns a list of inventory items contained within the specified folder
/// </summary>
/// <param name="folderID">The UUID of the target folder</param>
/// <returns>A List of InventoryItemBase items</returns>
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
{
lock (ds)
{
List<InventoryItemBase> retval = new List<InventoryItemBase>();
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
string selectExp = "parentFolderID = '" + folderID + "'";
DataRow[] rows = inventoryItemTable.Select(selectExp);
foreach (DataRow row in rows)
{
retval.Add(buildItem(row));
}
return retval;
}
}
/// <summary>
/// Returns a list of the root folders within a users inventory
/// </summary>
/// <param name="user">The user whos inventory is to be searched</param>
/// <returns>A list of folder objects</returns>
public List<InventoryFolderBase> getUserRootFolders(UUID user)
{
return new List<InventoryFolderBase>();
}
// see InventoryItemBase.getUserRootFolder
public InventoryFolderBase getUserRootFolder(UUID user)
{
lock (ds)
{
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'";
DataRow[] rows = inventoryFolderTable.Select(selectExp);
foreach (DataRow row in rows)
{
folders.Add(buildFolder(row));
}
// There should only ever be one root folder for a user. However, if there's more
// than one we'll simply use the first one rather than failing. It would be even
// nicer to print some message to this effect, but this feels like it's too low a
// to put such a message out, and it's too minor right now to spare the time to
// suitably refactor.
if (folders.Count > 0)
{
return folders[0];
}
return null;
}
}
/// <summary>
/// Append a list of all the child folders of a parent folder
/// </summary>
/// <param name="folders">list where folders will be appended</param>
/// <param name="parentID">ID of parent</param>
protected void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
{
lock (ds)
{
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
string selectExp = "parentID = '" + parentID + "'";
DataRow[] rows = inventoryFolderTable.Select(selectExp);
foreach (DataRow row in rows)
{
folders.Add(buildFolder(row));
}
}
}
/// <summary>
/// Returns a list of inventory folders contained in the folder 'parentID'
/// </summary>
/// <param name="parentID">The folder to get subfolders for</param>
/// <returns>A list of inventory folders</returns>
public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
{
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
getInventoryFolders(ref folders, parentID);
return folders;
}
/// <summary>
/// See IInventoryDataPlugin
/// </summary>
/// <param name="parentID"></param>
/// <returns></returns>
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
{
/* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one
* - We will only need to hit the database twice instead of n times.
* - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned
* by the same person, each user only has 1 inventory heirarchy
* - The returned list is not ordered, instead of breadth-first ordered
There are basically 2 usage cases for getFolderHeirarchy:
1) Getting the user's entire inventory heirarchy when they log in
2) Finding a subfolder heirarchy to delete when emptying the trash.
This implementation will pull all inventory folders from the database, and then prune away any folder that
is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the
database than to make n requests. This pays off only if requested heirarchy is large.
By making this choice, we are making the worst case better at the cost of making the best case worse
- Francis
*/
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
DataRow[] folderRows = null, parentRow;
InventoryFolderBase parentFolder = null;
lock (ds)
{
/* Fetch the parent folder from the database to determine the agent ID.
* Then fetch all inventory folders for that agent from the agent ID.
*/
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
string selectExp = "UUID = '" + parentID + "'";
parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result
if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
{
parentFolder = buildFolder(parentRow[0]);
UUID agentID = parentFolder.Owner;
selectExp = "agentID = '" + agentID + "'";
folderRows = inventoryFolderTable.Select(selectExp);
}
if (folderRows != null && folderRows.GetLength(0) >= 1) // No result means parent folder does not exist
{ // or has no children
/* if we're querying the root folder, just return an unordered list of all folders in the user's
* inventory
*/
if (parentFolder.ParentID == UUID.Zero)
{
foreach (DataRow row in folderRows)
{
InventoryFolderBase curFolder = buildFolder(row);
if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy
folders.Add(buildFolder(row));
}
} // If requesting root folder
/* else we are querying a non-root folder. We currently have a list of all of the user's folders,
* we must construct a list of all folders in the heirarchy below parentID.
* Our first step will be to construct a hash table of all folders, indexed by parent ID.
* Once we have constructed the hash table, we will do a breadth-first traversal on the tree using the
* hash table to find child folders.
*/
else
{ // Querying a non-root folder
// Build a hash table of all user's inventory folders, indexed by each folder's parent ID
Dictionary<UUID, List<InventoryFolderBase>> hashtable =
new Dictionary<UUID, List<InventoryFolderBase>>(folderRows.GetLength(0));
foreach (DataRow row in folderRows)
{
InventoryFolderBase curFolder = buildFolder(row);
if (curFolder.ParentID != UUID.Zero) // Discard root of tree - not needed
{
if (hashtable.ContainsKey(curFolder.ParentID))
{
// Current folder already has a sibling - append to sibling list
hashtable[curFolder.ParentID].Add(curFolder);
}
else
{
List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>();
siblingList.Add(curFolder);
// Current folder has no known (yet) siblings
hashtable.Add(curFolder.ParentID, siblingList);
}
}
} // For all inventory folders
// Note: Could release the ds lock here - we don't access folderRows or the database anymore.
// This is somewhat of a moot point as the callers of this function usually lock db anyways.
if (hashtable.ContainsKey(parentID)) // if requested folder does have children
folders.AddRange(hashtable[parentID]);
// BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static
for (int i = 0; i < folders.Count; i++)
if (hashtable.ContainsKey(folders[i].ID))
folders.AddRange(hashtable[folders[i].ID]);
} // if requesting a subfolder heirarchy
} // if folder parentID exists and has children
} // lock ds
return folders;
}
/// <summary>
/// Returns an inventory item by its UUID
/// </summary>
/// <param name="item">The UUID of the item to be returned</param>
/// <returns>A class containing item information</returns>
public InventoryItemBase getInventoryItem(UUID item)
{
lock (ds)
{
DataRow row = ds.Tables["inventoryitems"].Rows.Find(item.ToString());
if (row != null)
{
return buildItem(row);
}
else
{
return null;
}
}
}
/// <summary>
/// Returns a specified inventory folder by its UUID
/// </summary>
/// <param name="folder">The UUID of the folder to be returned</param>
/// <returns>A class containing folder information</returns>
public InventoryFolderBase getInventoryFolder(UUID folder)
{
// TODO: Deep voodoo here. If you enable this code then
// multi region breaks. No idea why, but I figured it was
// better to leave multi region at this point. It does mean
// that you don't get to see system textures why creating
// clothes and the like. :(
lock (ds)
{
DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder.ToString());
if (row != null)
{
return buildFolder(row);
}
else
{
return null;
}
}
}
/// <summary>
/// Creates a new inventory item based on item
/// </summary>
/// <param name="item">The item to be created</param>
public void addInventoryItem(InventoryItemBase item)
{
addItem(item, true);
}
/// <summary>
/// Updates an inventory item with item (updates based on ID)
/// </summary>
/// <param name="item">The updated item</param>
public void updateInventoryItem(InventoryItemBase item)
{
addItem(item, false);
}
/// <summary>
/// Delete an inventory item
/// </summary>
/// <param name="item">The item UUID</param>
public void deleteInventoryItem(UUID itemID)
{
lock (ds)
{
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID.ToString());
if (inventoryRow != null)
{
inventoryRow.Delete();
}
invItemsDa.Update(ds, "inventoryitems");
}
}
public InventoryItemBase queryInventoryItem(UUID itemID)
{
return getInventoryItem(itemID);
}
public InventoryFolderBase queryInventoryFolder(UUID folderID)
{
return getInventoryFolder(folderID);
}
/// <summary>
/// Delete all items in the specified folder
/// </summary>
/// <param name="folderId">id of the folder, whose item content should be deleted</param>
/// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo>
private void deleteItemsInFolder(UUID folderId)
{
List<InventoryItemBase> items = getInventoryInFolder(folderId);
foreach (InventoryItemBase i in items)
deleteInventoryItem(i.ID);
}
/// <summary>
/// Adds a new folder specified by folder
/// </summary>
/// <param name="folder">The inventory folder</param>
public void addInventoryFolder(InventoryFolderBase folder)
{
addFolder(folder, true);
}
/// <summary>
/// Updates a folder based on its ID with folder
/// </summary>
/// <param name="folder">The inventory folder</param>
public void updateInventoryFolder(InventoryFolderBase folder)
{
addFolder(folder, false);
}
/// <summary>
/// Moves a folder based on its ID with folder
/// </summary>
/// <param name="folder">The inventory folder</param>
public void moveInventoryFolder(InventoryFolderBase folder)
{
moveFolder(folder);
}
/// <summary>
/// Delete a folder
/// </summary>
/// <remarks>
/// This will clean-up any child folders and child items as well
/// </remarks>
/// <param name="folderID">the folder UUID</param>
public void deleteInventoryFolder(UUID folderID)
{
lock (ds)
{
List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
DataRow inventoryRow;
//Delete all sub-folders
foreach (InventoryFolderBase f in subFolders)
{
inventoryRow = inventoryFolderTable.Rows.Find(f.ID.ToString());
if (inventoryRow != null)
{
deleteItemsInFolder(f.ID);
inventoryRow.Delete();
}
}
//Delete the actual row
inventoryRow = inventoryFolderTable.Rows.Find(folderID.ToString());
if (inventoryRow != null)
{
deleteItemsInFolder(folderID);
inventoryRow.Delete();
}
invFoldersDa.Update(ds, "inventoryfolders");
}
}
/***********************************************************************
*
* Data Table definitions
*
**********************************************************************/
/// <summary>
/// Create the "inventoryitems" table
/// </summary>
private static DataTable createInventoryItemsTable()
{
DataTable inv = new DataTable("inventoryitems");
createCol(inv, "UUID", typeof (String)); //inventoryID
createCol(inv, "assetID", typeof (String));
createCol(inv, "assetType", typeof (Int32));
createCol(inv, "invType", typeof (Int32));
createCol(inv, "parentFolderID", typeof (String));
createCol(inv, "avatarID", typeof (String));
createCol(inv, "creatorsID", typeof (String));
createCol(inv, "inventoryName", typeof (String));
createCol(inv, "inventoryDescription", typeof (String));
// permissions
createCol(inv, "inventoryNextPermissions", typeof (Int32));
createCol(inv, "inventoryCurrentPermissions", typeof (Int32));
createCol(inv, "inventoryBasePermissions", typeof (Int32));
createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
createCol(inv, "inventoryGroupPermissions", typeof (Int32));
// sale info
createCol(inv, "salePrice", typeof(Int32));
createCol(inv, "saleType", typeof(Byte));
// creation date
createCol(inv, "creationDate", typeof(Int32));
// group info
createCol(inv, "groupID", typeof(String));
createCol(inv, "groupOwned", typeof(Boolean));
// Flags
createCol(inv, "flags", typeof(UInt32));
inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] };
return inv;
}
/// <summary>
/// Creates the "inventoryfolders" table
/// </summary>
/// <returns></returns>
private static DataTable createInventoryFoldersTable()
{
DataTable fol = new DataTable("inventoryfolders");
createCol(fol, "UUID", typeof (String)); //folderID
createCol(fol, "name", typeof (String));
createCol(fol, "agentID", typeof (String));
createCol(fol, "parentID", typeof (String));
createCol(fol, "type", typeof (Int32));
createCol(fol, "version", typeof (Int32));
fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]};
return fol;
}
/// <summary>
///
/// </summary>
/// <param name="da"></param>
/// <param name="conn"></param>
private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
{
lock (ds)
{
da.InsertCommand = createInsertCommand("inventoryitems", ds.Tables["inventoryitems"]);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("inventoryitems", "UUID=:UUID", ds.Tables["inventoryitems"]);
da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
delete.Connection = conn;
da.DeleteCommand = delete;
}
}
/// <summary>
///
/// </summary>
/// <param name="da"></param>
/// <param name="conn"></param>
private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
{
lock (ds)
{
da.InsertCommand = createInsertCommand("inventoryfolders", ds.Tables["inventoryfolders"]);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("inventoryfolders", "UUID=:UUID", ds.Tables["inventoryfolders"]);
da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
delete.Connection = conn;
da.DeleteCommand = delete;
}
}
/// <summary>
///
/// </summary>
/// <param name="row"></param>
/// <returns></returns>
private static InventoryFolderBase buildFolder(DataRow row)
{
InventoryFolderBase folder = new InventoryFolderBase();
folder.ID = new UUID((string) row["UUID"]);
folder.Name = (string) row["name"];
folder.Owner = new UUID((string) row["agentID"]);
folder.ParentID = new UUID((string) row["parentID"]);
folder.Type = Convert.ToInt16(row["type"]);
folder.Version = Convert.ToUInt16(row["version"]);
return folder;
}
/// <summary>
///
/// </summary>
/// <param name="row"></param>
/// <param name="folder"></param>
private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
{
row["UUID"] = folder.ID.ToString();
row["name"] = folder.Name;
row["agentID"] = folder.Owner.ToString();
row["parentID"] = folder.ParentID.ToString();
row["type"] = folder.Type;
row["version"] = folder.Version;
}
/// <summary>
///
/// </summary>
/// <param name="row"></param>
/// <param name="folder"></param>
private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
{
row["UUID"] = folder.ID.ToString();
row["parentID"] = folder.ParentID.ToString();
}
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
{
lock (ds)
{
List<InventoryItemBase> items = new List<InventoryItemBase>();
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
string selectExp
= "avatarID = '" + avatarID + "' AND assetType = " + (int)AssetType.Gesture + " AND flags = 1";
//m_log.DebugFormat("[SQL]: sql = " + selectExp);
DataRow[] rows = inventoryItemTable.Select(selectExp);
foreach (DataRow row in rows)
{
items.Add(buildItem(row));
}
return items;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,307 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Data;
using Mono.Data.SqliteClient;
namespace OpenSim.Data.SQLiteLegacy
{
/// <summary>
/// A base class for methods needed by all SQLite database classes
/// </summary>
public class SQLiteUtil
{
/***********************************************************************
*
* Database Definition Helper Functions
*
* This should be db agnostic as we define them in ADO.NET terms
*
**********************************************************************/
/// <summary>
///
/// </summary>
/// <param name="dt"></param>
/// <param name="name"></param>
/// <param name="type"></param>
public static void createCol(DataTable dt, string name, Type type)
{
DataColumn col = new DataColumn(name, type);
dt.Columns.Add(col);
}
/***********************************************************************
*
* SQL Statement Creation Functions
*
* These functions create SQL statements for update, insert, and create.
* They can probably be factored later to have a db independant
* portion and a db specific portion
*
**********************************************************************/
/// <summary>
/// Create an insert command
/// </summary>
/// <param name="table">table name</param>
/// <param name="dt">data table</param>
/// <returns>the created command</returns>
/// <remarks>
/// This is subtle enough to deserve some commentary.
/// Instead of doing *lots* and *lots of hardcoded strings
/// for database definitions we'll use the fact that
/// realistically all insert statements look like "insert
/// into A(b, c) values(:b, :c) on the parameterized query
/// front. If we just have a list of b, c, etc... we can
/// generate these strings instead of typing them out.
/// </remarks>
public static SqliteCommand createInsertCommand(string table, DataTable dt)
{
string[] cols = new string[dt.Columns.Count];
for (int i = 0; i < dt.Columns.Count; i++)
{
DataColumn col = dt.Columns[i];
cols[i] = col.ColumnName;
}
string sql = "insert into " + table + "(";
sql += String.Join(", ", cols);
// important, the first ':' needs to be here, the rest get added in the join
sql += ") values (:";
sql += String.Join(", :", cols);
sql += ")";
SqliteCommand cmd = new SqliteCommand(sql);
// this provides the binding for all our parameters, so
// much less code than it used to be
foreach (DataColumn col in dt.Columns)
{
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
}
return cmd;
}
/// <summary>
/// create an update command
/// </summary>
/// <param name="table">table name</param>
/// <param name="pk"></param>
/// <param name="dt"></param>
/// <returns>the created command</returns>
public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
{
string sql = "update " + table + " set ";
string subsql = String.Empty;
foreach (DataColumn col in dt.Columns)
{
if (subsql.Length > 0)
{
// a map function would rock so much here
subsql += ", ";
}
subsql += col.ColumnName + "= :" + col.ColumnName;
}
sql += subsql;
sql += " where " + pk;
SqliteCommand cmd = new SqliteCommand(sql);
// this provides the binding for all our parameters, so
// much less code than it used to be
foreach (DataColumn col in dt.Columns)
{
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
}
return cmd;
}
/// <summary>
///
/// </summary>
/// <param name="dt">Data Table</param>
/// <returns></returns>
public static string defineTable(DataTable dt)
{
string sql = "create table " + dt.TableName + "(";
string subsql = String.Empty;
foreach (DataColumn col in dt.Columns)
{
if (subsql.Length > 0)
{
// a map function would rock so much here
subsql += ",\n";
}
subsql += col.ColumnName + " " + sqliteType(col.DataType);
if (dt.PrimaryKey.Length > 0)
{
if (col == dt.PrimaryKey[0])
{
subsql += " primary key";
}
}
}
sql += subsql;
sql += ")";
return sql;
}
/***********************************************************************
*
* Database Binding functions
*
* These will be db specific due to typing, and minor differences
* in databases.
*
**********************************************************************/
///<summary>
/// <para>
/// This is a convenience function that collapses 5 repetitive
/// lines for defining SqliteParameters to 2 parameters:
/// column name and database type.
/// </para>
///
/// <para>
/// It assumes certain conventions like :param as the param
/// name to replace in parametrized queries, and that source
/// version is always current version, both of which are fine
/// for us.
/// </para>
///</summary>
/// <param name="name"></param>
/// <param name="type"></param>
///<returns>a built sqlite parameter</returns>
public static SqliteParameter createSqliteParameter(string name, Type type)
{
SqliteParameter param = new SqliteParameter();
param.ParameterName = ":" + name;
param.DbType = dbtypeFromType(type);
param.SourceColumn = name;
param.SourceVersion = DataRowVersion.Current;
return param;
}
/***********************************************************************
*
* Type conversion functions
*
**********************************************************************/
/// <summary>
/// Type conversion function
/// </summary>
/// <param name="type">a type</param>
/// <returns>a DbType</returns>
public static DbType dbtypeFromType(Type type)
{
if (type == typeof (String))
{
return DbType.String;
}
else if (type == typeof (Int32))
{
return DbType.Int32;
}
else if (type == typeof (UInt32))
{
return DbType.UInt32;
}
else if (type == typeof (Int64))
{
return DbType.Int64;
}
else if (type == typeof (UInt64))
{
return DbType.UInt64;
}
else if (type == typeof (Double))
{
return DbType.Double;
}
else if (type == typeof (Boolean))
{
return DbType.Boolean;
}
else if (type == typeof (Byte[]))
{
return DbType.Binary;
}
else
{
return DbType.String;
}
}
/// <summary>
/// </summary>
/// <param name="type">a Type</param>
/// <returns>a string</returns>
/// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
public static string sqliteType(Type type)
{
if (type == typeof (String))
{
return "varchar(255)";
}
else if (type == typeof (Int32))
{
return "integer";
}
else if (type == typeof (UInt32))
{
return "integer";
}
else if (type == typeof (Int64))
{
return "varchar(255)";
}
else if (type == typeof (UInt64))
{
return "varchar(255)";
}
else if (type == typeof (Double))
{
return "float";
}
else if (type == typeof (Boolean))
{
return "integer";
}
else if (type == typeof (Byte[]))
{
return "blob";
}
else
{
return "string";
}
}
}
}

View File

@ -0,0 +1,155 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Data;
using System.Reflection;
using System.Collections.Generic;
using Mono.Data.SqliteClient;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.SQLiteLegacy
{
/// <summary>
/// A MySQL Interface for the Asset Server
/// </summary>
public class SQLiteXInventoryData : IXInventoryData
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private SQLiteGenericTableHandler<XInventoryFolder> m_Folders;
private SqliteItemHandler m_Items;
public SQLiteXInventoryData(string conn, string realm)
{
m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
conn, "inventoryfolders", "InventoryStore");
m_Items = new SqliteItemHandler(
conn, "inventoryitems", String.Empty);
}
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
{
return m_Folders.Get(fields, vals);
}
public XInventoryItem[] GetItems(string[] fields, string[] vals)
{
return m_Items.Get(fields, vals);
}
public bool StoreFolder(XInventoryFolder folder)
{
return m_Folders.Store(folder);
}
public bool StoreItem(XInventoryItem item)
{
return m_Items.Store(item);
}
public bool DeleteFolders(string field, string val)
{
return m_Folders.Delete(field, val);
}
public bool DeleteItems(string field, string val)
{
return m_Items.Delete(field, val);
}
public bool MoveItem(string id, string newParent)
{
return m_Items.MoveItem(id, newParent);
}
public XInventoryItem[] GetActiveGestures(UUID principalID)
{
return m_Items.GetActiveGestures(principalID);
}
public int GetAssetPermissions(UUID principalID, UUID assetID)
{
return m_Items.GetAssetPermissions(principalID, assetID);
}
}
public class SqliteItemHandler : SQLiteGenericTableHandler<XInventoryItem>
{
public SqliteItemHandler(string c, string t, string m) :
base(c, t, m)
{
}
public bool MoveItem(string id, string newParent)
{
SqliteCommand cmd = new SqliteCommand();
cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm);
cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true;
}
public XInventoryItem[] GetActiveGestures(UUID principalID)
{
SqliteCommand cmd = new SqliteCommand();
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm);
cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture));
return DoQuery(cmd);
}
public int GetAssetPermissions(UUID principalID, UUID assetID)
{
SqliteCommand cmd = new SqliteCommand();
cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm);
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
IDataReader reader = ExecuteReader(cmd, m_Connection);
int perms = 0;
while (reader.Read())
{
perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]);
}
reader.Close();
CloseCommand(cmd);
return perms;
}
}
}

View File

@ -39,7 +39,8 @@ namespace OpenSim.Data.Tests
public class DataTestUtil public class DataTestUtil
{ {
public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue; //public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue;
public const uint UNSIGNED_INTEGER_MAX = INTEGER_MAX;
public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
public const int INTEGER_MAX = int.MaxValue; public const int INTEGER_MAX = int.MaxValue;

View File

@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{ {
if (s.RegionInfo.RegionHandle == regionHandle) if (s.RegionInfo.RegionHandle == regionHandle)
{ {
m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
if (isLocalCall) if (isLocalCall)
{ {
// We need to make a local copy of the object // We need to make a local copy of the object

View File

@ -2458,8 +2458,6 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
m_log.DebugFormat("[SCENE INVENTORY]: {0} {1} IsAttachment={2}", att.Name, att.LocalId, att.IsAttachment);
Console.WriteLine("HERE X");
ScenePresence presence; ScenePresence presence;
if (TryGetAvatar(remoteClient.AgentId, out presence)) if (TryGetAvatar(remoteClient.AgentId, out presence))
{ {
@ -2467,12 +2465,9 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item); item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
Console.WriteLine("HERE Y");
if (m_AvatarFactory != null) if (m_AvatarFactory != null)
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
Console.WriteLine("HERE Z");
} }
} }

View File

@ -124,7 +124,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (((SceneObjectGroup)ent).LocalId == primLocalID) if (((SceneObjectGroup)ent).LocalId == primLocalID)
{ {
m_log.DebugFormat("[SCENE]: Received full update request for {0} from {1}", primLocalID, remoteClient.Name);
((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
return; return;
} }

View File

@ -1874,28 +1874,6 @@ namespace OpenSim.Region.Framework.Scenes
return sceneObject; return sceneObject;
} }
/// <summary>
/// Add an object into the scene that has come from storage
/// </summary>
///
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, changes to the object will be reflected in its persisted data
/// If false, the persisted data will not be changed even if the object in the scene is changed
/// </param>
/// <param name="alreadyPersisted">
/// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately
/// </param>
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
}
/// <summary> /// <summary>
/// Add an object into the scene that has come from storage /// Add an object into the scene that has come from storage
/// </summary> /// </summary>
@ -1915,7 +1893,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddRestoredSceneObject( public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
{ {
return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted);
} }
/// <summary> /// <summary>
@ -2528,7 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
public bool IncomingCreateObject(ISceneObject sog) public bool IncomingCreateObject(ISceneObject sog)
{ {
m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
SceneObjectGroup newObject; SceneObjectGroup newObject;
try try
{ {
@ -2600,12 +2578,10 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject.IsAttachmentCheckFull()) // Attachment if (sceneObject.IsAttachmentCheckFull()) // Attachment
{ {
m_log.DebugFormat("[SCENE]: Adding attachment {0} {1}", sceneObject.Name, sceneObject.LocalId);
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.RootPart.AddFlag(PrimFlags.Phantom); sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
AddRestoredSceneObject(sceneObject, false, false, false); AddRestoredSceneObject(sceneObject, false, false);
// Handle attachment special case // Handle attachment special case
SceneObjectPart RootPrim = sceneObject.RootPart; SceneObjectPart RootPrim = sceneObject.RootPart;
@ -2613,8 +2589,6 @@ namespace OpenSim.Region.Framework.Scenes
// Fix up attachment Parent Local ID // Fix up attachment Parent Local ID
ScenePresence sp = GetScenePresence(sceneObject.OwnerID); ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
Console.WriteLine("AAAA");
//uint parentLocalID = 0; //uint parentLocalID = 0;
if (sp != null) if (sp != null)
{ {
@ -2634,24 +2608,19 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat( m_log.DebugFormat(
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
AttachObject( AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
//grp.SendGroupFullUpdate(); grp.SendGroupFullUpdate();
} }
else else
{ {
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
} }
Console.WriteLine("BBBB");
} }
else else
{ {
m_log.DebugFormat("[SCENE]: Adding ordinary object {0} {1}", sceneObject.Name, sceneObject.LocalId);
AddRestoredSceneObject(sceneObject, true, false); AddRestoredSceneObject(sceneObject, true, false);
if (!Permissions.CanObjectEntry(sceneObject.UUID, if (!Permissions.CanObjectEntry(sceneObject.UUID,

View File

@ -1410,9 +1410,7 @@ namespace OpenSim.Region.Framework.Scenes
// now we have a child agent in this region. Request all interesting data about other (root) agents // now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendInitialFullUpdateToAllClients(); agent.SendInitialFullUpdateToAllClients();
Console.WriteLine("SCS 1");
agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true);
Console.WriteLine("SCS 2");
// m_scene.SendKillObject(m_localId); // m_scene.SendKillObject(m_localId);

View File

@ -216,15 +216,11 @@ namespace OpenSim.Region.Framework.Scenes
/// If true, we won't persist this object until it changes /// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately /// If false, we'll persist this object immediately
/// </param> /// </param>
/// <param name="sendClientUpdate">
/// If true, we send updates to the client to tell it about this object
/// If false, we leave it up to the caller to do this
/// </param>
/// <returns> /// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene /// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns> /// </returns>
protected internal bool AddRestoredSceneObject( protected internal bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
{ {
// KF: Check for out-of-region, move inside and make static. // KF: Check for out-of-region, move inside and make static.
Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
@ -256,30 +252,9 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.HasGroupChanged = true; sceneObject.HasGroupChanged = true;
} }
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); return AddSceneObject(sceneObject, attachToBackup, true);
} }
// /// <summary>
// /// Add an object into the scene that has come from storage
// /// </summary>
// /// <param name="sceneObject"></param>
// /// <param name="attachToBackup">
// /// If true, changes to the object will be reflected in its persisted data
// /// If false, the persisted data will not be changed even if the object in the scene is changed
// /// </param>
// /// <param name="alreadyPersisted">
// /// If true, we won't persist this object until it changes
// /// If false, we'll persist this object immediately
// /// </param>
// /// <returns>
// /// true if the object was added, false if an object with the same uuid was already in the scene
// /// </returns>
// protected internal bool AddRestoredSceneObject(
// SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
// {
// AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
// }
/// <summary> /// <summary>
/// Add a newly created object to the scene. This will both update the scene, and send information about the /// Add a newly created object to the scene. This will both update the scene, and send information about the
/// new object to all clients interested in the scene. /// new object to all clients interested in the scene.
@ -672,13 +647,11 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool AttachObject( protected internal bool AttachObject(
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
{ {
Console.WriteLine("HERE A");
SceneObjectGroup group = GetGroupByPrim(objectLocalID); SceneObjectGroup group = GetGroupByPrim(objectLocalID);
if (group != null) if (group != null)
{ {
if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
{ {
Console.WriteLine("HERE -1");
// If the attachment point isn't the same as the one previously used // If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point // set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown. // and not in a weird location somewhere unknown.
@ -717,12 +690,9 @@ namespace OpenSim.Region.Framework.Scenes
itemId = group.GetFromItemID(); itemId = group.GetFromItemID();
} }
Console.WriteLine("HERE 0");
m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
Console.WriteLine("HERE 1");
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
Console.WriteLine("HERE 2");
// In case it is later dropped again, don't let // In case it is later dropped again, don't let
// it get cleaned up // it get cleaned up
// //

View File

@ -1651,10 +1651,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SendFullUpdateToClient(IClientAPI remoteClient) public void SendFullUpdateToClient(IClientAPI remoteClient)
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SOG]: Sending full update to client {0} for {1} {2}", remoteClient.Name, Name, LocalId);
SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
lockPartsForRead(true); lockPartsForRead(true);
@ -1677,9 +1673,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param> /// <param name="part"></param>
internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
{ {
if (IsAttachment) // m_log.DebugFormat(
m_log.DebugFormat( // "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
"[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
if (m_rootPart.UUID == part.UUID) if (m_rootPart.UUID == part.UUID)
{ {
@ -2191,8 +2186,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ScheduleFullUpdateToAvatar(ScenePresence presence) public void ScheduleFullUpdateToAvatar(ScenePresence presence)
{ {
if (IsAttachment) // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
RootPart.AddFullUpdateToAvatar(presence); RootPart.AddFullUpdateToAvatar(presence);
@ -2228,8 +2222,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleGroupForFullUpdate() public void ScheduleGroupForFullUpdate()
{ {
if (IsAttachment) // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID);
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID);
checkAtTargets(); checkAtTargets();
RootPart.ScheduleFullUpdate(); RootPart.ScheduleFullUpdate();

View File

@ -1273,14 +1273,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
AddFullUpdateToAvatar(avatars[i]); {
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
} }
public void AddFullUpdateToAvatar(ScenePresence presence) public void AddFullUpdateToAvatar(ScenePresence presence)
{ {
if (IsAttachment)
m_log.DebugFormat("AddFullUpdateToAllAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this); presence.SceneViewer.QueuePartForUpdate(this);
} }
@ -1299,14 +1298,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
AddTerseUpdateToAvatar(avatars[i]); {
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
} }
public void AddTerseUpdateToAvatar(ScenePresence presence) public void AddTerseUpdateToAvatar(ScenePresence presence)
{ {
if (IsAttachment)
m_log.DebugFormat("AddTerseUpdateToAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this); presence.SceneViewer.QueuePartForUpdate(this);
} }
@ -2715,8 +2713,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleFullUpdate() public void ScheduleFullUpdate()
{ {
if (IsAttachment) // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId);
m_log.DebugFormat("[SOP]: Scheduling full update for {0} {1}", Name, LocalId);
if (m_parentGroup != null) if (m_parentGroup != null)
{ {
@ -2829,10 +2826,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SCENE OBJECT PART]: Sending part full update to {0} for {1} {2}", remoteClient.Name, Name, LocalId);
m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags);
} }
@ -2841,10 +2834,6 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SCENE OBJECT PART]: Sending full update for {0} {1} for all clients", Name, LocalId);
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ {
@ -2856,10 +2845,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SendFullUpdateToAllClientsExcept(UUID agentID) public void SendFullUpdateToAllClientsExcept(UUID agentID)
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SCENE OBJECT PART]: Sending full update for {0} {1} to all clients except {2}", Name, LocalId, agentID);
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ {
@ -2968,9 +2953,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
{ {
if (IsAttachment)
m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId);
AddFullUpdateToAllAvatars(); AddFullUpdateToAllAvatars();
m_updateFlag = 0; //Same here m_updateFlag = 0; //Same here
} }

View File

@ -27,7 +27,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
@ -40,8 +39,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
public class SceneViewer : ISceneViewer public class SceneViewer : ISceneViewer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected ScenePresence m_presence; protected ScenePresence m_presence;
protected UpdateQueue m_partsUpdateQueue = new UpdateQueue(); protected UpdateQueue m_partsUpdateQueue = new UpdateQueue();
protected Queue<SceneObjectGroup> m_pendingObjects; protected Queue<SceneObjectGroup> m_pendingObjects;
@ -63,9 +60,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param> /// <param name="part"></param>
public void QueuePartForUpdate(SceneObjectPart part) public void QueuePartForUpdate(SceneObjectPart part)
{ {
if (part.IsAttachment)
m_log.DebugFormat("[SCENE VIEWER]: Queueing part {0} {1} for update", part.Name, part.LocalId);
lock (m_partsUpdateQueue) lock (m_partsUpdateQueue)
{ {
m_partsUpdateQueue.Enqueue(part); m_partsUpdateQueue.Enqueue(part);
@ -140,7 +134,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else if (update.LastTerseUpdateTime <= part.TimeStampTerse) else if (update.LastTerseUpdateTime <= part.TimeStampTerse)
{ {
// m_log.DebugFormat(AddFullUpdateToAvatar // m_log.DebugFormat(
// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}",
// part.Name, part.UUID, part.TimeStampTerse); // part.Name, part.UUID, part.TimeStampTerse);

View File

@ -32,7 +32,7 @@ using System.Globalization;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using Microsoft.CSharp; using Microsoft.CSharp;
using Microsoft.JScript; //using Microsoft.JScript;
using Microsoft.VisualBasic; using Microsoft.VisualBasic;
using log4net; using log4net;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -82,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider(); // private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider();
private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp
private static YP2CSConverter YP_Converter = new YP2CSConverter(); private static YP2CSConverter YP_Converter = new YP2CSConverter();
@ -395,9 +395,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
case enumCompileType.vb: case enumCompileType.vb:
compileScript = CreateVBCompilerScript(compileScript); compileScript = CreateVBCompilerScript(compileScript);
break; break;
case enumCompileType.js: // case enumCompileType.js:
compileScript = CreateJSCompilerScript(compileScript); // compileScript = CreateJSCompilerScript(compileScript);
break; // break;
case enumCompileType.yp: case enumCompileType.yp:
compileScript = CreateYPCompilerScript(compileScript); compileScript = CreateYPCompilerScript(compileScript);
break; break;
@ -420,16 +420,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
} }
} }
private static string CreateJSCompilerScript(string compileScript) // private static string CreateJSCompilerScript(string compileScript)
{ // {
compileScript = String.Empty + // compileScript = String.Empty +
"import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" + // "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
"package SecondLife {\r\n" + // "package SecondLife {\r\n" +
"class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" + // "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
compileScript + // compileScript +
"} }\r\n"; // "} }\r\n";
return compileScript; // return compileScript;
} // }
private static string CreateCSCompilerScript(string compileScript) private static string CreateCSCompilerScript(string compileScript)
{ {
@ -580,10 +580,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
} }
} while (!complete); } while (!complete);
break; break;
case enumCompileType.js: // case enumCompileType.js:
results = JScodeProvider.CompileAssemblyFromSource( // results = JScodeProvider.CompileAssemblyFromSource(
parameters, Script); // parameters, Script);
break; // break;
case enumCompileType.yp: case enumCompileType.yp:
results = YPcodeProvider.CompileAssemblyFromSource( results = YPcodeProvider.CompileAssemblyFromSource(
parameters, Script); parameters, Script);

View File

@ -542,7 +542,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_CurrentResult = null; m_CurrentResult = null;
} }
return true; return false;
} }
[DebuggerNonUserCode] //Prevents the debugger from farting in this function [DebuggerNonUserCode] //Prevents the debugger from farting in this function
@ -998,7 +998,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public string GetXMLState() public string GetXMLState()
{ {
bool run = Running; bool run = Running;
Stop(100); bool stopped = Stop(100);
Running = run; Running = run;
// We should not be doing this, but since we are about to // We should not be doing this, but since we are about to
@ -1009,6 +1009,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// Force an update of the in-memory plugin data // Force an update of the in-memory plugin data
// //
if (!stopped)
return String.Empty;
PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID); PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID);
return ScriptSerializer.Serialize(this); return ScriptSerializer.Serialize(this);

BIN
bin/Mono.Data.Sqlite.dll Normal file

Binary file not shown.

View File

@ -12,7 +12,7 @@
<log4net> <log4net>
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console"> <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss,fff} - %message" /> <conversionPattern value="%date{HH:mm:ss} - %message" />
</layout> </layout>
</appender> </appender>

View File

@ -126,9 +126,15 @@
;storage_plugin = "OpenSim.Data.Null.dll" ;storage_plugin = "OpenSim.Data.Null.dll"
; --- To use sqlite as region storage: ; --- To use sqlite as region storage:
; NOTE: SQLite and OpenSim are not functioning properly with Mono 2.4.3 or greater. ;
; If you are using Mono you probably should be using MySQL ; PLEASE NOTE: Unfortunately, the current SQLite database plugin (necessary to use SQLite with Mono on Linux) is
; not compatible with the sqlite3 library installed on Mac OSX. If you're using Mono 2.4 you can still use the old sqlite
; library by uncommenting the SQLiteLegacy.dll storage plugin (and commenting out SQLite.dll). Unfortunately, the older library
; will not work with Mono 2.6 on Mac OSX so you will either need to replace the OSX sqlite3 system library or use MySQL instead
;
; You will also need to do the same thing in config-include/StandaloneCommon.ini if you are running in standalone mode
storage_plugin = "OpenSim.Data.SQLite.dll" storage_plugin = "OpenSim.Data.SQLite.dll"
;storage_plugin = "OpenSim.Data.SQLiteLegacy.dll"
storage_connection_string="URI=file:OpenSim.db,version=3"; storage_connection_string="URI=file:OpenSim.db,version=3";
; --- To use MySQL storage, supply your own connection string (this is only an example): ; --- To use MySQL storage, supply your own connection string (this is only an example):

View File

@ -4,7 +4,15 @@
; ;
;--- For SQLite ;--- For SQLite
StorageProvider = "OpenSim.Data.SQLite.dll" StorageProvider = "OpenSim.Data.SQLite.dll"
;--- For MySql
; Unfortunately the current SQLite database plugin is not compatible with Mac OSX. You can still use the older
; legacy sqlite library if you are using Mono 2.4. Please see the notes in OpenSim.ini (search for sqlite)
; for more details
;StorageProvider = "OpenSim.Data.SQLiteLegacy.dll";
; MySql
; Uncomment these lines if you want to use mysql storage
; Change the connection string to your db details
;StorageProvider = "OpenSim.Data.MySQL.dll" ;StorageProvider = "OpenSim.Data.MySQL.dll"
;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;" ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;"

View File

@ -795,7 +795,6 @@
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<!-- For scripting in funny languages by default --> <!-- For scripting in funny languages by default -->
<Reference name="Microsoft.JScript"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
@ -1649,7 +1648,6 @@
<Reference name="GlynnTucker.Cache.dll"/> <Reference name="GlynnTucker.Cache.dll"/>
<!-- For scripting in funny languages by default --> <!-- For scripting in funny languages by default -->
<Reference name="Microsoft.JScript"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
@ -1732,7 +1730,6 @@
<Reference name="Mono.Addins.dll" /> <Reference name="Mono.Addins.dll" />
<!-- For scripting in funny languages by default --> <!-- For scripting in funny languages by default -->
<Reference name="Microsoft.JScript"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
@ -2503,7 +2500,7 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library"> <Project frameworkVersion="v3_5" name="OpenSim.Data.SQLiteLegacy" path="OpenSim/Data/SQLiteLegacy" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
<OutputPath>../../../bin/</OutputPath> <OutputPath>../../../bin/</OutputPath>
@ -2540,6 +2537,42 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="OpenSim.Data"/>
<Reference name="System.Drawing"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="Mono.Data.Sqlite"/>
<Reference name="Mono.Addins.dll" />
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true" >
<Exclude name="Tests" pattern="Tests" />
</Match>
<Match path="Resources" pattern="*.sql" buildAction="EmbeddedResource"/>
<Match pattern="*.addin.xml" path="Resources" buildAction="EmbeddedResource" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared" path="OpenSim/Region/ScriptEngine/Shared" type="Library"> <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared" path="OpenSim/Region/ScriptEngine/Shared" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
@ -2701,7 +2734,6 @@
<ReferencePath>../../../../../bin/</ReferencePath> <ReferencePath>../../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="Microsoft.JScript"/>
<Reference name="OpenSim.Framework" /> <Reference name="OpenSim.Framework" />
<Reference name="OpenSim.Region.Framework" /> <Reference name="OpenSim.Region.Framework" />
<Reference name="OpenSim.Region.ScriptEngine.Shared"/> <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
@ -2838,7 +2870,6 @@
<Reference name="Mono.Addins"/> <Reference name="Mono.Addins"/>
<!-- For scripting in funny languages by default --> <!-- For scripting in funny languages by default -->
<Reference name="Microsoft.JScript"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
@ -3300,7 +3331,6 @@
<Reference name="nunit.framework.dll"/> <Reference name="nunit.framework.dll"/>
<!-- For scripting in funny languages by default --> <!-- For scripting in funny languages by default -->
<Reference name="Microsoft.JScript"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
@ -3364,7 +3394,6 @@
<Reference name="nunit.framework.dll"/> <Reference name="nunit.framework.dll"/>
<!-- For scripting in funny languages by default --> <!-- For scripting in funny languages by default -->
<Reference name="Microsoft.JScript"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />