diff options
Diffstat (limited to 'OpenSim.Storage.LocalStorageSQLite')
17 files changed, 283 insertions, 0 deletions
diff --git a/OpenSim.Storage.LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj b/OpenSim.Storage.LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj new file mode 100644 index 0000000..615ea58 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj | |||
@@ -0,0 +1,65 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ProductVersion>8.0.50727</ProductVersion> | ||
6 | <SchemaVersion>2.0</SchemaVersion> | ||
7 | <ProjectGuid>{2D49BA72-FF23-41EF-987C-0D6643FBE727}</ProjectGuid> | ||
8 | <OutputType>Library</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>OpenSim.Storage.LocalStorageSQLite</RootNamespace> | ||
11 | <AssemblyName>OpenSim.Storage.LocalStorageSQLite</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>bin\Release\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>bin\libsecondlife.dll</HintPath> | ||
34 | </Reference> | ||
35 | <Reference Include="System" /> | ||
36 | <Reference Include="System.Data" /> | ||
37 | <Reference Include="System.Data.SQLite, Version=1.0.40.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"> | ||
38 | <SpecificVersion>False</SpecificVersion> | ||
39 | <HintPath>bin\System.Data.SQLite.DLL</HintPath> | ||
40 | </Reference> | ||
41 | <Reference Include="System.Xml" /> | ||
42 | </ItemGroup> | ||
43 | <ItemGroup> | ||
44 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
45 | <Compile Include="SQLiteLocalStorage.cs" /> | ||
46 | </ItemGroup> | ||
47 | <ItemGroup> | ||
48 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
49 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
50 | <Name>OpenSim.Framework.Console</Name> | ||
51 | </ProjectReference> | ||
52 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
53 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
54 | <Name>OpenSim.Framework</Name> | ||
55 | </ProjectReference> | ||
56 | </ItemGroup> | ||
57 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
58 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
59 | Other similar extension points exist, see Microsoft.Common.targets. | ||
60 | <Target Name="BeforeBuild"> | ||
61 | </Target> | ||
62 | <Target Name="AfterBuild"> | ||
63 | </Target> | ||
64 | --> | ||
65 | </Project> \ No newline at end of file | ||
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 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using 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..4ccc8a2 --- /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 | |||
31 | using System; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Data; | ||
34 | using System.Data.SQLite; | ||
35 | using libsecondlife; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework.Assets; | ||
38 | using OpenSim.Framework.Terrain; | ||
39 | |||
40 | namespace 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.db"; | ||
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 | ||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/Db4objects.Db4o.dll b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/Db4objects.Db4o.dll new file mode 100644 index 0000000..be976a1 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/Db4objects.Db4o.dll | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.Console.dll b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.Console.dll new file mode 100644 index 0000000..eff4853 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.Console.dll | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.Console.pdb b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.Console.pdb new file mode 100644 index 0000000..aeea334 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.Console.pdb | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.dll b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.dll new file mode 100644 index 0000000..6e84c97 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.dll | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.pdb b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.pdb new file mode 100644 index 0000000..b6bade2 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Framework.pdb | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Storage.LocalStorageSQLite.dll b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Storage.LocalStorageSQLite.dll new file mode 100644 index 0000000..374ebf1 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Storage.LocalStorageSQLite.dll | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Storage.LocalStorageSQLite.pdb b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Storage.LocalStorageSQLite.pdb new file mode 100644 index 0000000..f2e9d8d --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/OpenSim.Storage.LocalStorageSQLite.pdb | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/System.Data.SQLite.DLL b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/System.Data.SQLite.DLL new file mode 100644 index 0000000..70d84e7 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/System.Data.SQLite.DLL | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/Debug/libsecondlife.dll b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/libsecondlife.dll new file mode 100644 index 0000000..89d692a --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/Debug/libsecondlife.dll | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/System.Data.SQLite.DLL b/OpenSim.Storage.LocalStorageSQLite/bin/System.Data.SQLite.DLL new file mode 100644 index 0000000..70d84e7 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/System.Data.SQLite.DLL | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/bin/libsecondlife.dll b/OpenSim.Storage.LocalStorageSQLite/bin/libsecondlife.dll new file mode 100644 index 0000000..89d692a --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/bin/libsecondlife.dll | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/obj/Debug/OpenSim.Storage.LocalStorageSQLite.dll b/OpenSim.Storage.LocalStorageSQLite/obj/Debug/OpenSim.Storage.LocalStorageSQLite.dll new file mode 100644 index 0000000..374ebf1 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/obj/Debug/OpenSim.Storage.LocalStorageSQLite.dll | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/obj/Debug/OpenSim.Storage.LocalStorageSQLite.pdb b/OpenSim.Storage.LocalStorageSQLite/obj/Debug/OpenSim.Storage.LocalStorageSQLite.pdb new file mode 100644 index 0000000..f2e9d8d --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/obj/Debug/OpenSim.Storage.LocalStorageSQLite.pdb | |||
Binary files differ | |||
diff --git a/OpenSim.Storage.LocalStorageSQLite/obj/OpenSim.Storage.LocalStorageSQLite.csproj.FileList.txt b/OpenSim.Storage.LocalStorageSQLite/obj/OpenSim.Storage.LocalStorageSQLite.csproj.FileList.txt new file mode 100644 index 0000000..1f52df8 --- /dev/null +++ b/OpenSim.Storage.LocalStorageSQLite/obj/OpenSim.Storage.LocalStorageSQLite.csproj.FileList.txt | |||
@@ -0,0 +1,12 @@ | |||
1 | obj\Debug\ResolveAssemblyReference.cache | ||
2 | bin\Debug\OpenSim.Storage.LocalStorageSQLite.dll | ||
3 | bin\Debug\OpenSim.Storage.LocalStorageSQLite.pdb | ||
4 | bin\Debug\libsecondlife.dll | ||
5 | bin\Debug\OpenSim.Framework.Console.dll | ||
6 | bin\Debug\OpenSim.Framework.dll | ||
7 | bin\Debug\System.Data.SQLite.DLL | ||
8 | bin\Debug\Db4objects.Db4o.dll | ||
9 | bin\Debug\OpenSim.Framework.pdb | ||
10 | bin\Debug\OpenSim.Framework.Console.pdb | ||
11 | obj\Debug\OpenSim.Storage.LocalStorageSQLite.dll | ||
12 | obj\Debug\OpenSim.Storage.LocalStorageSQLite.pdb | ||