aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs')
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs199
1 files changed, 0 insertions, 199 deletions
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
deleted file mode 100644
index 8106727..0000000
--- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
+++ /dev/null
@@ -1,199 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29// SQLite Support
30// A bad idea, but the IRC people told me to!
31
32using System;
33using System.Collections.Generic;
34using System.Data;
35using System.Data.SQLite;
36using libsecondlife;
37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Types;
39using OpenSim.Framework.Terrain;
40
41namespace OpenSim.Storage.LocalStorageSQLite
42{
43 public class SQLiteLocalStorage : ILocalStorage
44 {
45 IDbConnection db;
46
47 public SQLiteLocalStorage()
48 {
49 try
50 {
51 string connectionstring = "URI=file:localsim.sdb";
52 db = (IDbConnection)new SQLiteConnection(connectionstring);
53 db.Open();
54 }
55 catch (Exception e)
56 {
57 db.Close();
58 OpenSim.Framework.Console.MainConsole.Instance.Warn("SQLiteLocalStorage :Constructor - Exception occured");
59 OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString());
60 }
61 }
62
63 public void Initialise(string file)
64 {
65 // Blank
66 }
67
68 public void StorePrim(PrimData prim)
69 {
70 IDbCommand cmd = db.CreateCommand();
71
72 //SECURITY WARNING:
73 // These parameters wont produce SQL injections since they are all integer based, however.
74 // if inserting strings such as name or description, you will need to use appropriate
75 // measures to prevent SQL injection (although the value of SQL injection in this is limited).
76
77 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) ";
78 sql += "VALUES (";
79 sql += "\"" + prim.OwnerID.ToStringHyphenated() + "\","; // KILL ME NOW!
80 sql += "\"" + prim.PCode.ToString() + "\",";
81 sql += "\"" + prim.PathBegin.ToString() + "\",";
82 sql += "\"" + prim.PathEnd.ToString() + "\",";
83 sql += "\"" + prim.PathScaleX.ToString() + "\",";
84 sql += "\"" + prim.PathScaleY.ToString() + "\",";
85 sql += "\"" + prim.PathShearX.ToString() + "\",";
86 sql += "\"" + prim.PathShearY.ToString() + "\",";
87 sql += "\"" + prim.PathSkew.ToString() + "\",";
88 sql += "\"" + prim.ProfileBegin.ToString() + "\",";
89 sql += "\"" + prim.ProfileEnd.ToString() + "\",";
90 sql += "\"" + prim.Scale.ToString() + "\",";
91 sql += "\"" + prim.PathCurve.ToString() + "\",";
92 sql += "\"" + prim.ProfileCurve.ToString() + "\",";
93 sql += "\"" + prim.ParentID.ToString() + "\",";
94 sql += "\"" + prim.ProfileHollow.ToString() + "\",";
95 sql += "\"" + prim.PathRadiusOffset.ToString() + "\",";
96 sql += "\"" + prim.PathRevolutions.ToString() + "\",";
97 sql += "\"" + prim.PathTaperX.ToString() + "\",";
98 sql += "\"" + prim.PathTaperY.ToString() + "\",";
99 sql += "\"" + prim.PathTwist.ToString() + "\",";
100 sql += "\"" + prim.PathTwistBegin.ToString() + "\",";
101 sql += "\"" + prim.Texture.ToString() + "\",";
102 sql += "\"" + prim.CreationDate.ToString() + "\",";
103 sql += "\"" + prim.OwnerMask.ToString() + "\",";
104 sql += "\"" + prim.NextOwnerMask.ToString() + "\",";
105 sql += "\"" + prim.GroupMask.ToString() + "\",";
106 sql += "\"" + prim.EveryoneMask.ToString() + "\",";
107 sql += "\"" + prim.BaseMask.ToString() + "\",";
108 sql += "\"" + prim.Position.ToString() + "\",";
109 sql += "\"" + prim.Rotation.ToString() + "\",";
110 sql += "\"" + prim.LocalID.ToString() + "\",";
111 sql += "\"" + prim.FullID.ToString() + "\")";
112
113 cmd.CommandText = sql;
114
115 try
116 {
117 cmd.ExecuteNonQuery();
118 }
119 catch (Exception e)
120 {
121 OpenSim.Framework.Console.MainConsole.Instance.Warn("SQLiteLocalStorage :StorePrim - Exception occured");
122 OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString());
123 }
124
125 cmd.Dispose();
126 cmd = null;
127 }
128
129 public void RemovePrim(LLUUID primID)
130 {
131 IDbCommand cmd = db.CreateCommand();
132
133 //SECURITY WARNING:
134 // These parameters wont produce SQL injections since they are all integer based, however.
135 // if inserting strings such as name or description, you will need to use appropriate
136 // measures to prevent SQL injection (although the value of SQL injection in this is limited).
137
138 string sql = "DELETE FROM prim WHERE FullID = \"" + primID.ToStringHyphenated() + "\"";
139
140 cmd.CommandText = sql;
141
142 try
143 {
144 cmd.ExecuteNonQuery();
145 }
146 catch (Exception e)
147 {
148 OpenSim.Framework.Console.MainConsole.Instance.Warn("SQLiteLocalStorage :RemovePrim - Exception occured");
149 OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString());
150 }
151
152 cmd.Dispose();
153 cmd = null;
154 }
155
156 public void LoadPrimitives(ILocalStorageReceiver receiver)
157 {
158
159 }
160
161 public float[] LoadWorld()
162 {
163 return new float[65536];
164 }
165
166 public void SaveMap(float[] heightmap)
167 {
168
169 }
170
171 public void SaveParcels(ParcelData[] parcel_manager)
172 {
173
174 }
175
176 public void SaveParcel(ParcelData parcel)
177 {
178 }
179
180 public void RemoveParcel(ParcelData parcel)
181 {
182 }
183
184 public void RemoveAllParcels()
185 {
186 }
187
188 public void LoadParcels(ILocalStorageParcelReceiver recv)
189 {
190 recv.NoParcelDataFromStorage();
191 }
192
193 public void ShutDown()
194 {
195 db.Close();
196 db = null;
197 }
198 }
199} \ No newline at end of file