diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteManager.cs | 70 |
2 files changed, 69 insertions, 3 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 921f4a6..a7ff0f7 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | |||
@@ -192,6 +192,4 @@ namespace OpenSim.Framework.Data.SQLite | |||
192 | return null; | 192 | return null; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | |||
196 | |||
197 | } | 195 | } |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index 207fc82..f73f480 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs | |||
@@ -30,10 +30,11 @@ using System.Collections.Generic; | |||
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Data.SQLite; | 31 | using System.Data.SQLite; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Console; | ||
33 | 34 | ||
34 | namespace OpenSim.Framework.Data.SQLite | 35 | namespace OpenSim.Framework.Data.SQLite |
35 | { | 36 | { |
36 | class SQLiteManager | 37 | class SQLiteManager : SQLiteBase |
37 | { | 38 | { |
38 | IDbConnection dbcon; | 39 | IDbConnection dbcon; |
39 | 40 | ||
@@ -88,6 +89,73 @@ namespace OpenSim.Framework.Data.SQLite | |||
88 | return (IDbCommand)dbcommand; | 89 | return (IDbCommand)dbcommand; |
89 | } | 90 | } |
90 | 91 | ||
92 | private bool TestTables(SQLiteConnection conn) | ||
93 | { | ||
94 | SQLiteCommand cmd = new SQLiteCommand("SELECT * FROM regions", conn); | ||
95 | SQLiteDataAdapter pDa = new SQLiteDataAdapter(cmd); | ||
96 | DataSet tmpDS = new DataSet(); | ||
97 | try | ||
98 | { | ||
99 | pDa.Fill(tmpDS, "regions"); | ||
100 | } | ||
101 | catch (Mono.Data.SqliteClient.SqliteSyntaxException) | ||
102 | { | ||
103 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); | ||
104 | InitDB(conn); | ||
105 | } | ||
106 | return true; | ||
107 | } | ||
108 | |||
109 | private DataTable createRegionsTable() | ||
110 | { | ||
111 | DataTable regions = new DataTable("regions"); | ||
112 | |||
113 | createCol(regions, "regionHandle", typeof(ulong)); | ||
114 | createCol(regions, "regionName", typeof(System.String)); | ||
115 | createCol(regions, "uuid", typeof(System.String)); | ||
116 | |||
117 | createCol(regions, "regionRecvKey", typeof(System.String)); | ||
118 | createCol(regions, "regionSecret", typeof(System.String)); | ||
119 | createCol(regions, "regionSendKey", typeof(System.String)); | ||
120 | |||
121 | createCol(regions, "regionDataURI", typeof(System.String)); | ||
122 | createCol(regions, "serverIP", typeof(System.String)); | ||
123 | createCol(regions, "serverPort", typeof(System.String)); | ||
124 | createCol(regions, "serverURI", typeof(System.String)); | ||
125 | |||
126 | |||
127 | createCol(regions, "locX", typeof( uint)); | ||
128 | createCol(regions, "locY", typeof( uint)); | ||
129 | createCol(regions, "locZ", typeof( uint)); | ||
130 | |||
131 | createCol(regions, "eastOverrideHandle", typeof( ulong )); | ||
132 | createCol(regions, "westOverrideHandle", typeof( ulong )); | ||
133 | createCol(regions, "southOverrideHandle", typeof( ulong )); | ||
134 | createCol(regions, "northOverrideHandle", typeof( ulong )); | ||
135 | |||
136 | createCol(regions, "regionAssetURI", typeof(System.String)); | ||
137 | createCol(regions, "regionAssetRecvKey", typeof(System.String)); | ||
138 | createCol(regions, "regionAssetSendKey", typeof(System.String)); | ||
139 | |||
140 | createCol(regions, "regionUserURI", typeof(System.String)); | ||
141 | createCol(regions, "regionUserRecvKey", typeof(System.String)); | ||
142 | createCol(regions, "regionUserSendKey", typeof(System.String)); | ||
143 | |||
144 | // Add in contraints | ||
145 | regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; | ||
146 | return regions; | ||
147 | } | ||
148 | |||
149 | private void InitDB(SQLiteConnection conn) | ||
150 | { | ||
151 | string createUsers = defineTable(createRegionsTable()); | ||
152 | SQLiteCommand pcmd = new SQLiteCommand(createUsers, conn); | ||
153 | conn.Open(); | ||
154 | pcmd.ExecuteNonQuery(); | ||
155 | conn.Close(); | ||
156 | } | ||
157 | |||
158 | |||
91 | /// <summary> | 159 | /// <summary> |
92 | /// Reads a region row from a database reader | 160 | /// Reads a region row from a database reader |
93 | /// </summary> | 161 | /// </summary> |