diff options
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.Sqlite/SqliteDataStore.cs | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.Sqlite/SqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.Sqlite/SqliteDataStore.cs new file mode 100644 index 0000000..e80252b --- /dev/null +++ b/OpenSim/Region/Storage/OpenSim.DataStore.Sqlite/SqliteDataStore.cs | |||
@@ -0,0 +1,116 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | using OpenSim.Region.Environment.Scenes; | ||
6 | using OpenSim.Region.Environment.LandManagement; | ||
7 | using OpenSim.Region.Environment; | ||
8 | using OpenSim.Region.Interfaces; | ||
9 | using OpenSim.Framework.Console; | ||
10 | using libsecondlife; | ||
11 | |||
12 | using System.Data; | ||
13 | // Yes, this won't compile on MS, need to deal with that later | ||
14 | using Mono.Data.SqliteClient; | ||
15 | |||
16 | namespace OpenSim.DataStore.SqliteStorage | ||
17 | { | ||
18 | |||
19 | // public class SceneObjectQuery : Predicate | ||
20 | // { | ||
21 | // private LLUUID globalIDSearch; | ||
22 | |||
23 | // public SceneObjectQuery(LLUUID find) | ||
24 | // { | ||
25 | // globalIDSearch = find; | ||
26 | // } | ||
27 | |||
28 | // public bool Match(SceneObject obj) | ||
29 | // { | ||
30 | // return obj.rootUUID == globalIDSearch; | ||
31 | // } | ||
32 | // } | ||
33 | |||
34 | |||
35 | public class SqliteDataStore : IRegionDataStore | ||
36 | { | ||
37 | private const primSelect = "select * from prims"; | ||
38 | private const shapeSelect = "select * from primshapes"; | ||
39 | |||
40 | private DataSet ds; | ||
41 | private IObjectContainer db; | ||
42 | |||
43 | public void Initialise(string dbfile, string dbname) | ||
44 | { | ||
45 | // for us, dbfile will be the connect string | ||
46 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + dbfile); | ||
47 | SqliteConnection conn = new SqliteConnection(dbfile); | ||
48 | |||
49 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); | ||
50 | SqliteDataAdapter primDa = new SqliteDataAdapter(primSelectCmd); | ||
51 | |||
52 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); | ||
53 | SqliteDataAdapter shapeDa = new SqliteDataAdapter(shapeSelectCmd); | ||
54 | |||
55 | ds = new DataSet(); | ||
56 | |||
57 | // We fill the data set, now we've got copies in memory for the information | ||
58 | // TODO: see if the linkage actually holds. | ||
59 | primDa.FillSchema(ds, SchemaType.Mapped, "PrimSchema"); | ||
60 | primDa.Fill(ds, "prims"); | ||
61 | |||
62 | shapeDa.FillSchema(ds, SchemaType.Mapped, "ShapeSchema"); | ||
63 | shapeDa.Fill(ds, "primshapes"); | ||
64 | |||
65 | return; | ||
66 | } | ||
67 | |||
68 | public void StoreObject(SceneObject obj) | ||
69 | { | ||
70 | // TODO: Serializing code | ||
71 | } | ||
72 | |||
73 | public void RemoveObject(LLUUID obj) | ||
74 | { | ||
75 | // TODO: remove code | ||
76 | } | ||
77 | |||
78 | public List<SceneObject> LoadObjects() | ||
79 | { | ||
80 | List<SceneObject> retvals = new List<SceneObject>(); | ||
81 | |||
82 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + " objects"); | ||
83 | |||
84 | } | ||
85 | |||
86 | public void StoreTerrain(double[,] ter) | ||
87 | { | ||
88 | |||
89 | } | ||
90 | |||
91 | public double[,] LoadTerrain() | ||
92 | { | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | public void RemoveLandObject(uint id) | ||
97 | { | ||
98 | |||
99 | } | ||
100 | |||
101 | public void StoreParcel(Land parcel) | ||
102 | { | ||
103 | |||
104 | } | ||
105 | |||
106 | public List<Land> LoadLandObjects() | ||
107 | { | ||
108 | return new List<Land>(); | ||
109 | } | ||
110 | |||
111 | public void Shutdown() | ||
112 | { | ||
113 | // TODO: DataSet commit | ||
114 | } | ||
115 | } | ||
116 | } | ||