aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Storage
diff options
context:
space:
mode:
authorMW2007-04-11 13:32:50 +0000
committerMW2007-04-11 13:32:50 +0000
commit00b7058e000d7871df2ae40075ead1042e8e81ac (patch)
tree2a7e4d5c51b4567b97a7fc06c1c970e6a4ac9d44 /OpenSim.Storage
parentsmall improvement to the jvm and test script (diff)
downloadopensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.zip
opensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.tar.gz
opensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.tar.bz2
opensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.tar.xz
Attempt to rearrange some of the directories
Diffstat (limited to 'OpenSim.Storage')
-rw-r--r--OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs90
-rw-r--r--OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj112
-rw-r--r--OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj.user12
-rw-r--r--OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build46
-rw-r--r--OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj111
-rw-r--r--OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj.user12
-rw-r--r--OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build46
-rw-r--r--OpenSim.Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs35
-rw-r--r--OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs171
9 files changed, 635 insertions, 0 deletions
diff --git a/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
new file mode 100644
index 0000000..db7252b
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
@@ -0,0 +1,90 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28// BDB Support
29// Apparently broken on Mono
30
31using System;
32using System.Collections.Generic;
33using System.Data;
34using libsecondlife;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Assets;
37using OpenSim.Framework.Terrain;
38using BerkeleyDb;
39using Kds.Serialization;
40using Kds.Serialization.Buffer;
41
42namespace OpenSim.Storage.LocalStorageBDB
43{
44 public class BDBLocalStorage : ILocalStorage
45 {
46 const string simDbName = "localsim.db";
47
48 DbHash sim;
49 Db DB;
50 BEFormatter formatter;
51
52 public BDBLocalStorage()
53 {
54 DB = new Db(DbCreateFlags.None);
55 sim = (DbHash)DB.Open(null, simDbName, null, BerkeleyDb.DbType.Hash, Db.OpenFlags.Create, 0);
56 //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0);
57 }
58
59 public void StorePrim(PrimData prim)
60 {
61 DbEntry key = new DbEntry();
62 DbEntry data = new DbEntry();
63 lock (sim)
64 {
65 sim.PutUnique(null, ref key, ref data, DbFile.WriteFlags.AutoCommit);
66 }
67 }
68 public void RemovePrim(LLUUID primID)
69 {
70
71 }
72 public void LoadPrimitives(ILocalStorageReceiver receiver)
73 {
74
75 }
76 public float[] LoadWorld()
77 {
78 return new float[65536];
79 }
80 public void SaveMap(float[] heightmap)
81 {
82
83 }
84 public void ShutDown()
85 {
86 sim.GetDb().Close();
87 DB.Close();
88 }
89 }
90} \ No newline at end of file
diff --git a/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj b/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj
new file mode 100644
index 0000000..12c5016
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj
@@ -0,0 +1,112 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{EE9E5D96-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Storage.LocalStorageBerkeleyDB</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Storage.LocalStorageBerkeleyDB</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="Kds.Serialization.dll" >
74 <HintPath>..\..\bin\Kds.Serialization.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="libdb_dotNET43.dll" >
78 <HintPath>..\..\bin\libdb_dotNET43.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 <Reference Include="libsecondlife.dll" >
82 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 </ItemGroup>
86 <ItemGroup>
87 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
88 <Name>OpenSim.Framework</Name>
89 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
90 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
91 <Private>False</Private>
92 </ProjectReference>
93 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
94 <Name>OpenSim.Framework.Console</Name>
95 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
96 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
97 <Private>False</Private>
98 </ProjectReference>
99 </ItemGroup>
100 <ItemGroup>
101 <Compile Include="BDBLocalStorage.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 </ItemGroup>
105 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
106 <PropertyGroup>
107 <PreBuildEvent>
108 </PreBuildEvent>
109 <PostBuildEvent>
110 </PostBuildEvent>
111 </PropertyGroup>
112</Project>
diff --git a/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj.user b/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj.user
new file mode 100644
index 0000000..e1615f7
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim11-04trunk\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build b/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build
new file mode 100644
index 0000000..885b088
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Storage.LocalStorageBerkeleyDB" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Storage.LocalStorageBerkeleyDB" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="BDBLocalStorage.cs" />
15 </sources>
16 <references basedir="${project::get-base-directory()}">
17 <lib>
18 <include name="${project::get-base-directory()}" />
19 <include name="${project::get-base-directory()}/${build.dir}" />
20 </lib>
21 <include name="System.dll" />
22 <include name="System.Xml.dll" />
23 <include name="System.Data.dll" />
24 <include name="../../bin/Kds.Serialization.dll" />
25 <include name="../../bin/libdb_dotNET43.dll" />
26 <include name="../../bin/libsecondlife.dll" />
27 <include name="../../bin/OpenSim.Framework.dll" />
28 <include name="../../bin/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj b/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj
new file mode 100644
index 0000000..8039721
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj
@@ -0,0 +1,111 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{6B20B603-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Storage.LocalStorageSQLite</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Storage.LocalStorageSQLite</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="System.Data.SQLite.dll" >
74 <HintPath>..\..\bin\System.Data.SQLite.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="libsecondlife.dll" >
78 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 </ItemGroup>
96 <ItemGroup>
97 <Compile Include="SQLiteLocalStorage.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="Properties\AssemblyInfo.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 </ItemGroup>
104 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
105 <PropertyGroup>
106 <PreBuildEvent>
107 </PreBuildEvent>
108 <PostBuildEvent>
109 </PostBuildEvent>
110 </PropertyGroup>
111</Project>
diff --git a/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj.user b/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj.user
new file mode 100644
index 0000000..e1615f7
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim11-04trunk\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build b/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build
new file mode 100644
index 0000000..79c27fc
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Storage.LocalStorageSQLite" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Storage.LocalStorageSQLite" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="SQLiteLocalStorage.cs" />
15 <include name="Properties/AssemblyInfo.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="System.Xml.dll" />
24 <include name="System.Data.dll" />
25 <include name="../../bin/System.Data.SQLite.dll" />
26 <include name="../../bin/libsecondlife.dll" />
27 <include name="../../bin/OpenSim.Framework.dll" />
28 <include name="../../bin/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenSim.Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs b/OpenSim.Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..fe81f8a
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Storage.LocalStorageSQLite")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.Storage.LocalStorageSQLite")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("ecd6e0c1-7909-413e-9e3f-659678ac3bc3")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.*")]
35[assembly: AssemblyFileVersion("1.0.0.*")]
diff --git a/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
new file mode 100644
index 0000000..8c9a5e1
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
@@ -0,0 +1,171 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28// SQLite Support
29// A bad idea, but the IRC people told me to!
30
31using System;
32using System.Collections.Generic;
33using System.Data;
34using System.Data.SQLite;
35using libsecondlife;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Assets;
38using OpenSim.Framework.Terrain;
39
40namespace OpenSim.Storage.LocalStorageSQLite
41{
42 public class SQLiteLocalStorage : ILocalStorage
43 {
44 IDbConnection db;
45
46 public SQLiteLocalStorage()
47 {
48 try
49 {
50 string connectionstring = "URI=file:localsim.sdb";
51 db = (IDbConnection)new SQLiteConnection(connectionstring);
52 db.Open();
53 }
54 catch (Exception e)
55 {
56 db.Close();
57 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SQLiteLocalStorage :Constructor - Exception occured");
58 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
59 }
60 }
61
62 public void StorePrim(PrimData prim)
63 {
64 IDbCommand cmd = db.CreateCommand();
65
66 //SECURITY WARNING:
67 // These parameters wont produce SQL injections since they are all integer based, however.
68 // if inserting strings such as name or description, you will need to use appropriate
69 // measures to prevent SQL injection (although the value of SQL injection in this is limited).
70
71 string sql = "REPLACE INTO prim (OwnerID,PCode,PathBegin,PathEnd,PathScaleX,PathScaleY,PathShearX,PathShearY,PathSkew,ProfileBegin,ProfileEnd,Scale,PathCurve,ProfileCurve,ParentID,ProfileHollow,PathRadiusOffset,PathRevolutions,PathTaperX,PathTaperY,PathTwist,PathTwistBegin,Texture,CreationDate,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,Position,Rotation,LocalID,FullID) ";
72 sql += "VALUES (";
73 sql += "\"" + prim.OwnerID.ToStringHyphenated() + "\","; // KILL ME NOW!
74 sql += "\"" + prim.PCode.ToString() + "\",";
75 sql += "\"" + prim.PathBegin.ToString() + "\",";
76 sql += "\"" + prim.PathEnd.ToString() + "\",";
77 sql += "\"" + prim.PathScaleX.ToString() + "\",";
78 sql += "\"" + prim.PathScaleY.ToString() + "\",";
79 sql += "\"" + prim.PathShearX.ToString() + "\",";
80 sql += "\"" + prim.PathShearY.ToString() + "\",";
81 sql += "\"" + prim.PathSkew.ToString() + "\",";
82 sql += "\"" + prim.ProfileBegin.ToString() + "\",";
83 sql += "\"" + prim.ProfileEnd.ToString() + "\",";
84 sql += "\"" + prim.Scale.ToString() + "\",";
85 sql += "\"" + prim.PathCurve.ToString() + "\",";
86 sql += "\"" + prim.ProfileCurve.ToString() + "\",";
87 sql += "\"" + prim.ParentID.ToString() + "\",";
88 sql += "\"" + prim.ProfileHollow.ToString() + "\",";
89 sql += "\"" + prim.PathRadiusOffset.ToString() + "\",";
90 sql += "\"" + prim.PathRevolutions.ToString() + "\",";
91 sql += "\"" + prim.PathTaperX.ToString() + "\",";
92 sql += "\"" + prim.PathTaperY.ToString() + "\",";
93 sql += "\"" + prim.PathTwist.ToString() + "\",";
94 sql += "\"" + prim.PathTwistBegin.ToString() + "\",";
95 sql += "\"" + prim.Texture.ToString() + "\",";
96 sql += "\"" + prim.CreationDate.ToString() + "\",";
97 sql += "\"" + prim.OwnerMask.ToString() + "\",";
98 sql += "\"" + prim.NextOwnerMask.ToString() + "\",";
99 sql += "\"" + prim.GroupMask.ToString() + "\",";
100 sql += "\"" + prim.EveryoneMask.ToString() + "\",";
101 sql += "\"" + prim.BaseMask.ToString() + "\",";
102 sql += "\"" + prim.Position.ToString() + "\",";
103 sql += "\"" + prim.Rotation.ToString() + "\",";
104 sql += "\"" + prim.LocalID.ToString() + "\",";
105 sql += "\"" + prim.FullID.ToString() + "\")";
106
107 cmd.CommandText = sql;
108
109 try
110 {
111 cmd.ExecuteNonQuery();
112 }
113 catch (Exception e)
114 {
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SQLiteLocalStorage :StorePrim - Exception occured");
116 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
117 }
118
119 cmd.Dispose();
120 cmd = null;
121 }
122
123 public void RemovePrim(LLUUID primID)
124 {
125 IDbCommand cmd = db.CreateCommand();
126
127 //SECURITY WARNING:
128 // These parameters wont produce SQL injections since they are all integer based, however.
129 // if inserting strings such as name or description, you will need to use appropriate
130 // measures to prevent SQL injection (although the value of SQL injection in this is limited).
131
132 string sql = "DELETE FROM prim WHERE FullID = \"" + primID.ToStringHyphenated() + "\"";
133
134 cmd.CommandText = sql;
135
136 try
137 {
138 cmd.ExecuteNonQuery();
139 }
140 catch (Exception e)
141 {
142 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SQLiteLocalStorage :RemovePrim - Exception occured");
143 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
144 }
145
146 cmd.Dispose();
147 cmd = null;
148 }
149
150 public void LoadPrimitives(ILocalStorageReceiver receiver)
151 {
152
153 }
154
155 public float[] LoadWorld()
156 {
157 return new float[65536];
158 }
159
160 public void SaveMap(float[] heightmap)
161 {
162
163 }
164
165 public void ShutDown()
166 {
167 db.Close();
168 db = null;
169 }
170 }
171} \ No newline at end of file