Change SQLiteNG to work with mono 2.6 and above using the Mono.Data.Sqlite.dll
Include the library so that Windows builds correctly It appears that Windows is okay with either SQLite or SQLiteNG Incorporate the latest fixes made by Diva to OpenSim.Data.SQLiteslimupdates
parent
a23bebdc0f
commit
e84cc2f9db
|
@ -30,7 +30,7 @@ using System.Data;
|
|||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
|
@ -56,13 +56,8 @@ namespace OpenSim.Data.SQLite
|
|||
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");
|
||||
Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore");
|
||||
m.Update();
|
||||
dbcon.Close();
|
||||
}
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
@ -113,7 +108,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
finally
|
||||
{
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -156,14 +151,14 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||
{
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -184,19 +179,19 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||
{
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ using System.Threading;
|
|||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
|
@ -55,8 +55,8 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
||||
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.Add(":Name", name);
|
||||
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue(":Name", name);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
finally
|
||||
{
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLite
|
|||
Migration m = new Migration(m_connection, assem, "EstateStore");
|
||||
m.Update();
|
||||
|
||||
m_connection.Close();
|
||||
m_connection.Open();
|
||||
//m_connection.Close();
|
||||
// m_connection.Open();
|
||||
|
||||
Type t = typeof(EstateSettings);
|
||||
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
||||
|
@ -87,7 +87,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||
|
||||
return DoLoad(cmd, regionID, create);
|
||||
}
|
||||
|
@ -143,13 +143,13 @@ namespace OpenSim.Data.SQLite
|
|||
if (m_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
if ((bool)m_FieldMap[name].GetValue(es))
|
||||
cmd.Parameters.Add(":"+name, "1");
|
||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||
else
|
||||
cmd.Parameters.Add(":"+name, "0");
|
||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLite
|
|||
r.Close();
|
||||
|
||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||
|
||||
// This will throw on dupe key
|
||||
try
|
||||
|
@ -211,13 +211,13 @@ namespace OpenSim.Data.SQLite
|
|||
if (m_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
if ((bool)m_FieldMap[name].GetValue(es))
|
||||
cmd.Parameters.Add(":"+name, "1");
|
||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||
else
|
||||
cmd.Parameters.Add(":"+name, "0");
|
||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
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();
|
||||
|
||||
|
@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
|
@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
foreach (EstateBan b in es.EstateBans)
|
||||
{
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
|
@ -283,7 +283,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
|
@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
foreach (UUID uuid in data)
|
||||
{
|
||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||
cmd.Parameters.Add(":uuid", uuid.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
|
@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", EstateID);
|
||||
cmd.Parameters.AddWithValue(":EstateID", EstateID);
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
|
@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
||||
|
||||
return DoLoad(cmd, UUID.Zero, false);
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(":EstateName", search);
|
||||
cmd.Parameters.AddWithValue(":EstateName", search);
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
|
@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLite
|
|||
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());
|
||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
||||
|
||||
if (cmd.ExecuteNonQuery() == 0)
|
||||
return false;
|
||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
|
@ -55,11 +55,14 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
lock (connection)
|
||||
{
|
||||
/*
|
||||
SqliteConnection newConnection =
|
||||
(SqliteConnection)((ICloneable)connection).Clone();
|
||||
newConnection.Open();
|
||||
|
||||
cmd.Connection = newConnection;
|
||||
*/
|
||||
cmd.Connection = connection;
|
||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||
|
||||
return cmd.ExecuteNonQuery();
|
||||
|
@ -70,11 +73,12 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
lock (connection)
|
||||
{
|
||||
SqliteConnection newConnection =
|
||||
(SqliteConnection)((ICloneable)connection).Clone();
|
||||
newConnection.Open();
|
||||
//SqliteConnection newConnection =
|
||||
// (SqliteConnection)((ICloneable)connection).Clone();
|
||||
//newConnection.Open();
|
||||
|
||||
cmd.Connection = newConnection;
|
||||
//cmd.Connection = newConnection;
|
||||
cmd.Connection = connection;
|
||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||
|
||||
return cmd.ExecuteReader();
|
||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
||||
cmd.Parameters.Add(":PrincipalID", userID.ToString());
|
||||
cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString());
|
||||
|
||||
return DoQuery(cmd);
|
||||
|
||||
|
@ -58,8 +58,8 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
||||
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.Add(":Friend", friend);
|
||||
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue(":Friend", friend);
|
||||
|
||||
ExecuteNonQuery(cmd, cmd.Connection);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
@ -59,19 +59,21 @@ namespace OpenSim.Data.SQLite
|
|||
if (!m_initialized)
|
||||
{
|
||||
m_Connection = new SqliteConnection(connectionString);
|
||||
Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString));
|
||||
m_Connection.Open();
|
||||
|
||||
if (storeName != String.Empty)
|
||||
{
|
||||
Assembly assem = GetType().Assembly;
|
||||
SqliteConnection newConnection =
|
||||
(SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||
newConnection.Open();
|
||||
//SqliteConnection newConnection =
|
||||
// (SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||
//newConnection.Open();
|
||||
|
||||
Migration m = new Migration(newConnection, assem, storeName);
|
||||
//Migration m = new Migration(newConnection, assem, storeName);
|
||||
Migration m = new Migration(m_Connection, assem, storeName);
|
||||
m.Update();
|
||||
newConnection.Close();
|
||||
newConnection.Dispose();
|
||||
//newConnection.Close();
|
||||
//newConnection.Dispose();
|
||||
}
|
||||
|
||||
m_initialized = true;
|
||||
|
@ -197,7 +199,7 @@ namespace OpenSim.Data.SQLite
|
|||
result.Add(row);
|
||||
}
|
||||
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
|
@ -98,11 +98,13 @@ namespace OpenSim.Data.SQLite
|
|||
ds.Tables.Add(createInventoryFoldersTable());
|
||||
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
||||
setupFoldersCommands(invFoldersDa, conn);
|
||||
CreateDataSetMapping(invFoldersDa, "inventoryfolders");
|
||||
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
||||
|
||||
ds.Tables.Add(createInventoryItemsTable());
|
||||
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
||||
setupItemsCommands(invItemsDa, conn);
|
||||
CreateDataSetMapping(invItemsDa, "inventoryitems");
|
||||
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
||||
|
||||
ds.AcceptChanges();
|
||||
|
@ -728,6 +730,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>
|
||||
/// Create the "inventoryitems" table
|
||||
/// </summary>
|
||||
|
|
|
@ -32,7 +32,7 @@ using System.Drawing;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
@ -86,19 +86,21 @@ namespace OpenSim.Data.SQLite
|
|||
/// </summary>
|
||||
/// <param name="connectionString">the connection string</param>
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
|
||||
ds = new DataSet();
|
||||
ds = new DataSet("Region");
|
||||
|
||||
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);
|
||||
//SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
|
||||
//primDa = new SqliteDataAdapter(primSelectCmd);
|
||||
primDa = new SqliteDataAdapter(primSelect, m_connectionString);
|
||||
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
|
||||
|
||||
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
|
||||
|
@ -126,9 +128,10 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
lock (ds)
|
||||
{
|
||||
ds.Tables.Add(createPrimTable());
|
||||
setupPrimCommands(primDa, m_conn);
|
||||
primDa.Fill(ds.Tables["prims"]);
|
||||
//ds.Tables.Add(createPrimTable());
|
||||
//setupPrimCommands(primDa, m_conn);
|
||||
//primDa.Fill(ds.Tables["prims"]);
|
||||
primDa.Fill(ds, "prims");
|
||||
|
||||
ds.Tables.Add(createShapeTable());
|
||||
setupShapeCommands(shapeDa, m_conn);
|
||||
|
@ -198,9 +201,26 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
|
||||
}
|
||||
return;
|
||||
|
||||
// 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
|
||||
CreateDataSetMapping(primDa, "prims");
|
||||
CreateDataSetMapping(shapeDa, "primshapes");
|
||||
CreateDataSetMapping(itemsDa, "primitems");
|
||||
CreateDataSetMapping(terrainDa, "terrain");
|
||||
CreateDataSetMapping(landDa, "land");
|
||||
CreateDataSetMapping(landAccessListDa, "landaccesslist");
|
||||
CreateDataSetMapping(regionSettingsDa, "regionsettings");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e);
|
||||
Environment.Exit(23);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
@ -603,7 +623,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
}
|
||||
}
|
||||
rev = (int) row["Revision"];
|
||||
rev = Convert.ToInt32(row["Revision"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -755,6 +775,7 @@ namespace OpenSim.Data.SQLite
|
|||
/// </summary>
|
||||
public void Commit()
|
||||
{
|
||||
m_log.Debug("[SQLITE]: Starting commit");
|
||||
lock (ds)
|
||||
{
|
||||
primDa.Update(ds, "prims");
|
||||
|
@ -769,19 +790,12 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
regionSettingsDa.Update(ds, "regionsettings");
|
||||
}
|
||||
catch (SqliteExecutionException SqlEx)
|
||||
{
|
||||
if (SqlEx.Message.Contains("logic error"))
|
||||
catch (SqliteException SqlEx)
|
||||
{
|
||||
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!",
|
||||
SqlEx);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw SqlEx;
|
||||
}
|
||||
}
|
||||
ds.AcceptChanges();
|
||||
}
|
||||
}
|
||||
|
@ -802,6 +816,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>
|
||||
|
@ -1964,6 +1987,7 @@ namespace OpenSim.Data.SQLite
|
|||
sql += ") values (:";
|
||||
sql += String.Join(", :", cols);
|
||||
sql += ")";
|
||||
m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
|
||||
SqliteCommand cmd = new SqliteCommand(sql);
|
||||
|
||||
// this provides the binding for all our parameters, so
|
||||
|
@ -2260,5 +2284,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
if (words.Length == 1)
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||
cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||
m_Realm, scopeID.ToString(), words[0]);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Data;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ using System;
|
|||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
|
||||
reader.Close();
|
||||
CloseCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
|
||||
return perms;
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Data.SQLite.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class SQLiteAssetTest : BasicAssetTest
|
||||
{
|
||||
public string file;
|
||||
public string connect;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// SQLite doesn't work on power or z linux
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
{
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
SuperInit();
|
||||
file = Path.GetTempFileName() + ".db";
|
||||
connect = "URI=file:" + file + ",version=3";
|
||||
db = new SQLiteAssetData();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
db.Dispose();
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Data.SQLite.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class SQLiteEstateTest : BasicEstateTest
|
||||
{
|
||||
public string file = "regiontest.db";
|
||||
public string connect;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// SQLite doesn't work on power or z linux
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
{
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
SuperInit();
|
||||
file = Path.GetTempFileName() + ".db";
|
||||
connect = "URI=file:" + file + ",version=3";
|
||||
db = new SQLiteEstateStore();
|
||||
db.Initialise(connect);
|
||||
regionDb = new SQLiteRegionData();
|
||||
regionDb.Initialise(connect);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
regionDb.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Data.SQLite.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class SQLiteInventoryTest : BasicInventoryTest
|
||||
{
|
||||
public string file;
|
||||
public string connect;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// SQLite doesn't work on power or z linux
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
{
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
SuperInit();
|
||||
|
||||
file = Path.GetTempFileName() + ".db";
|
||||
connect = "URI=file:" + file + ",version=3";
|
||||
|
||||
db = new SQLiteInventoryStore();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
db.Dispose();
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Data.SQLite.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class SQLiteRegionTest : BasicRegionTest
|
||||
{
|
||||
public string file = "regiontest.db";
|
||||
public string connect;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// SQLite doesn't work on power or z linux
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
{
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
SuperInit();
|
||||
file = Path.GetTempFileName() + ".db";
|
||||
connect = "URI=file:" + file + ",version=3";
|
||||
db = new SQLiteRegionData();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
db.Dispose();
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2231,7 +2231,6 @@
|
|||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Data.SQLite.dll"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
|
@ -2239,7 +2238,7 @@
|
|||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenMetaverseTypes.dll"/>
|
||||
<Reference name="OpenMetaverse.dll"/>
|
||||
<Reference name="Mono.Data.SqliteClient"/>
|
||||
<Reference name="Mono.Data.Sqlite"/>
|
||||
<Reference name="Mono.Addins.dll" />
|
||||
<Reference name="log4net.dll"/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue