aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
authorMelanie Thielker2008-07-18 02:40:47 +0000
committerMelanie Thielker2008-07-18 02:40:47 +0000
commit263633e274082135b21b8183b92280b768d18883 (patch)
treef6104eef3633a8b454a4e8ac09d15182970c6bae /OpenSim/Data/SQLite
parentadded region port number to output of "show regions" command (diff)
downloadopensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.zip
opensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.tar.gz
opensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.tar.bz2
opensim-SC_OLD-263633e274082135b21b8183b92280b768d18883.tar.xz
Patch #9151
Makes the estate dialog fully functional. Implements all client facing functionality. Moves estate data from estate_settings.xml, which is used to provide defaults, to the region data store. Creates one estate for each region, and places the region in it. Converts all region bans to estate bans.
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r--OpenSim/Data/SQLite/Resources/006_RegionStore.sql92
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs333
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs114
3 files changed, 425 insertions, 114 deletions
diff --git a/OpenSim/Data/SQLite/Resources/006_RegionStore.sql b/OpenSim/Data/SQLite/Resources/006_RegionStore.sql
new file mode 100644
index 0000000..025f1a9
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/006_RegionStore.sql
@@ -0,0 +1,92 @@
1CREATE TABLE `estate_groups` (
2 `EstateID` int(10) NOT NULL,
3 `uuid` char(36) NOT NULL
4);
5CREATE TABLE `estate_managers` (
6 `EstateID` int(10) NOT NULL,
7 `uuid` char(36) NOT NULL
8);
9CREATE TABLE `estate_map` (
10 `RegionID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
11 `EstateID` int(11) NOT NULL
12);
13CREATE TABLE `estate_settings` (
14 `EstateID` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
15 `EstateName` varchar(64) default NULL,
16 `AbuseEmailToEstateOwner` tinyint(4) NOT NULL,
17 `DenyAnonymous` tinyint(4) NOT NULL,
18 `ResetHomeOnTeleport` tinyint(4) NOT NULL,
19 `FixedSun` tinyint(4) NOT NULL,
20 `DenyTransacted` tinyint(4) NOT NULL,
21 `BlockDwell` tinyint(4) NOT NULL,
22 `DenyIdentified` tinyint(4) NOT NULL,
23 `AllowVoice` tinyint(4) NOT NULL,
24 `UseGlobalTime` tinyint(4) NOT NULL,
25 `PricePerMeter` int(11) NOT NULL,
26 `TaxFree` tinyint(4) NOT NULL,
27 `AllowDirectTeleport` tinyint(4) NOT NULL,
28 `RedirectGridX` int(11) NOT NULL,
29 `RedirectGridY` int(11) NOT NULL,
30 `ParentEstateID` int(10) NOT NULL,
31 `SunPosition` double NOT NULL,
32 `EstateSkipScripts` tinyint(4) NOT NULL,
33 `BillableFactor` float NOT NULL,
34 `PublicAccess` tinyint(4) NOT NULL
35);
36insert into `estate_settings` (`EstateID`,`EstateName`,`AbuseEmailToEstateOwner`,`DenyAnonymous`,`ResetHomeOnTeleport`,`FixedSun`,`DenyTransacted`,`BlockDwell`,`DenyIdentified`,`AllowVoice`,`UseGlobalTime`,`PricePerMeter`,`TaxFree`,`AllowDirectTeleport`,`RedirectGridX`,`RedirectGridY`,`ParentEstateID`,`SunPosition`,`PublicAccess`,`EstateSkipScripts`,`BillableFactor`) values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
37delete from `estate_settings`;
38CREATE TABLE `estate_users` (
39 `EstateID` int(10) NOT NULL,
40 `uuid` char(36) NOT NULL
41);
42CREATE TABLE `estateban` (
43 `EstateID` int(10) NOT NULL,
44 `bannedUUID` varchar(36) NOT NULL,
45 `bannedIp` varchar(16) NOT NULL,
46 `bannedIpHostMask` varchar(16) NOT NULL,
47 `bannedNameMask` varchar(64) default NULL
48);
49drop table if exists `regionsettings`;
50CREATE TABLE `regionsettings` (
51 `regionUUID` char(36) NOT NULL,
52 `block_terraform` int(11) NOT NULL,
53 `block_fly` int(11) NOT NULL,
54 `allow_damage` int(11) NOT NULL,
55 `restrict_pushing` int(11) NOT NULL,
56 `allow_land_resell` int(11) NOT NULL,
57 `allow_land_join_divide` int(11) NOT NULL,
58 `block_show_in_search` int(11) NOT NULL,
59 `agent_limit` int(11) NOT NULL,
60 `object_bonus` float NOT NULL,
61 `maturity` int(11) NOT NULL,
62 `disable_scripts` int(11) NOT NULL,
63 `disable_collisions` int(11) NOT NULL,
64 `disable_physics` int(11) NOT NULL,
65 `terrain_texture_1` char(36) NOT NULL,
66 `terrain_texture_2` char(36) NOT NULL,
67 `terrain_texture_3` char(36) NOT NULL,
68 `terrain_texture_4` char(36) NOT NULL,
69 `elevation_1_nw` float NOT NULL,
70 `elevation_2_nw` float NOT NULL,
71 `elevation_1_ne` float NOT NULL,
72 `elevation_2_ne` float NOT NULL,
73 `elevation_1_se` float NOT NULL,
74 `elevation_2_se` float NOT NULL,
75 `elevation_1_sw` float NOT NULL,
76 `elevation_2_sw` float NOT NULL,
77 `water_height` float NOT NULL,
78 `terrain_raise_limit` float NOT NULL,
79 `terrain_lower_limit` float NOT NULL,
80 `use_estate_sun` int(11) NOT NULL,
81 `fixed_sun` int(11) NOT NULL,
82 `sun_position` float NOT NULL,
83 `covenant` char(36) default NULL,
84 `Sandbox` tinyint(4) NOT NULL,
85 PRIMARY KEY (`regionUUID`)
86);
87CREATE INDEX `estate_ban_estate_id` on `estateban`(`EstateID`);
88CREATE INDEX `estate_groups_estate_id` on `estate_groups`(`EstateID`);
89CREATE INDEX `estate_managers_estate_id` on `estate_managers`(`EstateID`);
90CREATE INDEX `estate_map_estate_id` on `estate_map`(`EstateID`);
91CREATE UNIQUE INDEX `estate_map_region)id` on `estate_map`(`RegionID`);
92CREATE INDEX `estate_users_estate_id` on `estate_users`(`EstateID`);
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
new file mode 100644
index 0000000..2d046f2
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -0,0 +1,333 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.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
28using System;
29using System.Collections.Generic;
30using System.Data;
31using System.IO;
32using System.Reflection;
33using System.Threading;
34using libsecondlife;
35using Mono.Data.SqliteClient;
36using log4net;
37using OpenSim.Framework;
38using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.Scenes;
40
41namespace OpenSim.Data.MySQL
42{
43 public class MySQLEstateStore : IEstateDataStore
44 {
45 private static readonly ILog m_log =
46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private SqliteConnection m_connection;
49 private string m_connectionString;
50
51 private FieldInfo[] m_Fields;
52 private Dictionary<string, FieldInfo> m_FieldMap =
53 new Dictionary<string, FieldInfo>();
54
55 public void Initialise(string connectionString)
56 {
57 m_connectionString = connectionString;
58
59 m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
60
61 m_connection = new SqliteConnection(m_connectionString);
62 m_connection.Open();
63
64 Assembly assem = GetType().Assembly;
65 Migration m = new Migration(m_connection, assem, "EstateStore");
66 m.Update();
67
68 m_connection.Close();
69 m_connection.Open();
70
71 Type t = typeof(EstateSettings);
72 m_Fields = t.GetFields(BindingFlags.NonPublic |
73 BindingFlags.Instance |
74 BindingFlags.DeclaredOnly);
75
76 foreach (FieldInfo f in m_Fields)
77 if(f.Name.Substring(0, 2) == "m_")
78 m_FieldMap[f.Name.Substring(2)] = f;
79 }
80
81 private string[] FieldList
82 {
83 get { return new List<string>(m_FieldMap.Keys).ToArray(); }
84 }
85
86 public EstateSettings LoadEstateSettings(LLUUID regionID)
87 {
88 EstateSettings es = new EstateSettings();
89
90 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = @RegionID";
91
92 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
93
94 cmd.CommandText = sql;
95 cmd.Parameters.Add("@RegionID", regionID.ToString());
96
97 IDataReader r = cmd.ExecuteReader();
98
99 if(r.Read())
100 {
101 foreach (string name in FieldList)
102 {
103 if(m_FieldMap[name].GetValue(es) is bool)
104 {
105 int v = Convert.ToInt32(r[name]);
106 if(v != 0)
107 m_FieldMap[name].SetValue(es, true);
108 else
109 m_FieldMap[name].SetValue(es, false);
110 }
111 else
112 {
113 m_FieldMap[name].SetValue(es, Convert.ChangeType(r[name], m_FieldMap[name].FieldType));
114 }
115 }
116 r.Close();
117 }
118 else
119 {
120 // Migration case
121 //
122 r.Close();
123
124 List<string> names = new List<string>(FieldList);
125
126 names.Remove("EstateID");
127
128 sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( @"+String.Join(", @", names.ToArray())+")";
129
130 cmd.CommandText = sql;
131 cmd.Parameters.Clear();
132
133 foreach (string name in FieldList)
134 {
135 if(m_FieldMap[name].GetValue(es) is bool)
136 {
137 if((bool)m_FieldMap[name].GetValue(es))
138 cmd.Parameters.Add("@"+name, "1");
139 else
140 cmd.Parameters.Add("@"+name, "0");
141 }
142 else
143 {
144 cmd.Parameters.Add("@"+name, m_FieldMap[name].GetValue(es).ToString());
145 }
146 }
147
148 cmd.ExecuteNonQuery();
149
150 cmd.CommandText = "select LAST_INSERT_ROWID() as id";
151 cmd.Parameters.Clear();
152
153 r = cmd.ExecuteReader();
154
155 r.Read();
156
157 es.EstateID = Convert.ToUInt32(r["id"]);
158
159 r.Close();
160
161 cmd.CommandText = "insert into estate_map values (@RegionID, @EstateID)";
162 cmd.Parameters.Add("@RegionID", regionID.ToString());
163 cmd.Parameters.Add("@EstateID", es.EstateID.ToString());
164
165 // This will throw on dupe key
166 try
167 {
168 cmd.ExecuteNonQuery();
169 }
170 catch (Exception)
171 {
172 }
173
174 // Munge and transfer the ban list
175 //
176 cmd.Parameters.Clear();
177 cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID";
178 cmd.Parameters.Add("@UUID", regionID.ToString());
179
180 try
181 {
182 cmd.ExecuteNonQuery();
183 }
184 catch (Exception)
185 {
186 }
187 }
188
189 LoadBanList(es);
190
191 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
192 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
193 es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
194 return es;
195 }
196
197 public void StoreEstateSettings(EstateSettings es)
198 {
199 List<string> fields = new List<string>(FieldList);
200 fields.Remove("EstateID");
201
202 List<string> terms = new List<string>();
203
204 foreach (string f in fields)
205 terms.Add(f+" = @"+f);
206
207 string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = @EstateID";
208
209 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
210
211 cmd.CommandText = sql;
212
213 foreach (string name in FieldList)
214 {
215 if(m_FieldMap[name].GetValue(es) is bool)
216 {
217 if((bool)m_FieldMap[name].GetValue(es))
218 cmd.Parameters.Add("@"+name, "1");
219 else
220 cmd.Parameters.Add("@"+name, "0");
221 }
222 else
223 {
224 cmd.Parameters.Add("@"+name, m_FieldMap[name].GetValue(es).ToString());
225 }
226 }
227
228 cmd.ExecuteNonQuery();
229
230 SaveBanList(es);
231 SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
232 SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
233 SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
234 }
235
236 private void LoadBanList(EstateSettings es)
237 {
238 es.ClearBans();
239
240 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
241
242 cmd.CommandText = "select bannedUUID from estateban where EstateID = @EstateID";
243 cmd.Parameters.Add("@EstateID", es.EstateID);
244
245 IDataReader r = cmd.ExecuteReader();
246
247 while(r.Read())
248 {
249 EstateBan eb = new EstateBan();
250
251 LLUUID uuid = new LLUUID();
252 LLUUID.TryParse(r["bannedUUID"].ToString(), out uuid);
253
254 eb.bannedUUID = uuid;
255 eb.bannedIP = "0.0.0.0";
256 eb.bannedIPHostMask = "0.0.0.0";
257 es.AddBan(eb);
258 }
259 r.Close();
260 }
261
262 private void SaveBanList(EstateSettings es)
263 {
264 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
265
266 cmd.CommandText = "delete from estateban where EstateID = @EstateID";
267 cmd.Parameters.Add("@EstateID", es.EstateID.ToString());
268
269 cmd.ExecuteNonQuery();
270
271 cmd.Parameters.Clear();
272
273 cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( @EstateID, @bannedUUID, '', '', '' )";
274
275 foreach(EstateBan b in es.EstateBans)
276 {
277 cmd.Parameters.Add("@EstateID", es.EstateID.ToString());
278 cmd.Parameters.Add("@bannedUUID", b.bannedUUID.ToString());
279
280 cmd.ExecuteNonQuery();
281 cmd.Parameters.Clear();
282 }
283 }
284
285 void SaveUUIDList(uint EstateID, string table, LLUUID[] data)
286 {
287 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
288
289 cmd.CommandText = "delete from "+table+" where EstateID = @EstateID";
290 cmd.Parameters.Add("@EstateID", EstateID.ToString());
291
292 cmd.ExecuteNonQuery();
293
294 cmd.Parameters.Clear();
295
296 cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( @EstateID, @uuid )";
297
298 foreach(LLUUID uuid in data)
299 {
300 cmd.Parameters.Add("@EstateID", EstateID.ToString());
301 cmd.Parameters.Add("@uuid", uuid.ToString());
302
303 cmd.ExecuteNonQuery();
304 cmd.Parameters.Clear();
305 }
306 }
307
308 LLUUID[] LoadUUIDList(uint EstateID, string table)
309 {
310 List<LLUUID> uuids = new List<LLUUID>();
311
312 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
313
314 cmd.CommandText = "select uuid from "+table+" where EstateID = @EstateID";
315 cmd.Parameters.Add("@EstateID", EstateID);
316
317 IDataReader r = cmd.ExecuteReader();
318
319 while(r.Read())
320 {
321 EstateBan eb = new EstateBan();
322
323 LLUUID uuid = new LLUUID();
324 LLUUID.TryParse(r["uuid"].ToString(), out uuid);
325
326 uuids.Add(uuid);
327 }
328 r.Close();
329
330 return uuids.ToArray();
331 }
332 }
333}
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 0e67fb9..4e87e0d 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -62,7 +62,6 @@ namespace OpenSim.Data.SQLite
62 private SqliteDataAdapter terrainDa; 62 private SqliteDataAdapter terrainDa;
63 private SqliteDataAdapter landDa; 63 private SqliteDataAdapter landDa;
64 private SqliteDataAdapter landAccessListDa; 64 private SqliteDataAdapter landAccessListDa;
65 private SqliteDataAdapter regionBanListDa;
66 65
67 private SqliteConnection m_conn; 66 private SqliteConnection m_conn;
68 67
@@ -119,9 +118,6 @@ namespace OpenSim.Data.SQLite
119 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); 118 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
120 landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); 119 landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
121 120
122 SqliteCommand regionBanListSelectCmd = new SqliteCommand(regionbanListSelect, m_conn);
123 regionBanListDa = new SqliteDataAdapter(regionBanListSelectCmd);
124
125 // This actually does the roll forward assembly stuff 121 // This actually does the roll forward assembly stuff
126 Assembly assem = GetType().Assembly; 122 Assembly assem = GetType().Assembly;
127 Migration m = new Migration(m_conn, assem, "RegionStore"); 123 Migration m = new Migration(m_conn, assem, "RegionStore");
@@ -157,10 +153,6 @@ namespace OpenSim.Data.SQLite
157 ds.Tables.Add(createLandAccessListTable()); 153 ds.Tables.Add(createLandAccessListTable());
158 setupLandAccessCommands(landAccessListDa, m_conn); 154 setupLandAccessCommands(landAccessListDa, m_conn);
159 155
160 ds.Tables.Add(createRegionBanListTable());
161 setupRegionBanCommands(regionBanListDa, m_conn);
162
163
164 // WORKAROUND: This is a work around for sqlite on 156 // WORKAROUND: This is a work around for sqlite on
165 // windows, which gets really unhappy with blob columns 157 // windows, which gets really unhappy with blob columns
166 // that have no sample data in them. At some point we 158 // that have no sample data in them. At some point we
@@ -201,15 +193,6 @@ namespace OpenSim.Data.SQLite
201 m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); 193 m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
202 } 194 }
203 195
204 try
205 {
206 regionBanListDa.Fill(ds.Tables["regionban"]);
207 }
208 catch (Exception)
209 {
210 m_log.Info("[REGION DB]: Caught fill error on regionban table");
211 }
212
213 return; 196 return;
214 } 197 }
215 } 198 }
@@ -900,21 +883,6 @@ namespace OpenSim.Data.SQLite
900 return landaccess; 883 return landaccess;
901 } 884 }
902 885
903 /// <summary>
904 /// create "regionban" table
905 /// </summary>
906 /// <returns>regionban datatable</returns>
907 private static DataTable createRegionBanListTable()
908 {
909 DataTable regionbanlist = new DataTable("regionban");
910 createCol(regionbanlist, "regionUUID", typeof(String));
911 createCol(regionbanlist, "bannedUUID", typeof(String));
912 createCol(regionbanlist, "bannedIp", typeof(String));
913 createCol(regionbanlist, "bannedIpHostMask", typeof(String));
914
915 return regionbanlist;
916 }
917
918 /*********************************************************************** 886 /***********************************************************************
919 * 887 *
920 * Convert between ADO.NET <=> OpenSim Objects 888 * Convert between ADO.NET <=> OpenSim Objects
@@ -1178,74 +1146,6 @@ namespace OpenSim.Data.SQLite
1178 return entry; 1146 return entry;
1179 } 1147 }
1180 1148
1181
1182 /// <summary>
1183 /// Load a region banlist
1184 /// </summary>
1185 /// <param name="regionUUID">the region UUID</param>
1186 /// <returns>The banlist</returns>
1187 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
1188 {
1189 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
1190 lock (ds)
1191 {
1192 DataTable regionban = ds.Tables["regionban"];
1193 string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
1194 DataRow[] rawbanlist = regionban.Select(searchExp);
1195 foreach (DataRow rawbanrow in rawbanlist)
1196 {
1197 RegionBanListItem rbli = new RegionBanListItem();
1198 LLUUID tmpvalue = LLUUID.Zero;
1199
1200 rbli.regionUUID = regionUUID;
1201
1202 if (Helpers.TryParse((string)rawbanrow["bannedUUID"], out tmpvalue))
1203 rbli.bannedUUID = tmpvalue;
1204
1205 rbli.bannedIP = (string)rawbanrow["bannedIp"];
1206 rbli.bannedIPHostMask = (string)rawbanrow["bannedIpHostMask"];
1207 regionbanlist.Add(rbli);
1208 }
1209 }
1210 return regionbanlist;
1211 }
1212
1213 /// <summary>
1214 /// Add en entry into region banlist
1215 /// </summary>
1216 /// <param name="item"></param>
1217 public void AddToRegionBanlist(RegionBanListItem item)
1218 {
1219 lock (ds)
1220 {
1221 using (SqliteCommand cmd = new SqliteCommand("insert into regionban (regionUUID, bannedUUID, bannedIp, bannedIpHostMask) values (:regionUUID,:bannedUUID,:bannedIp,:bannedIpHostMask)", m_conn))
1222 {
1223 cmd.Parameters.Add(new SqliteParameter(":regionUUID", item.regionUUID.ToString()));
1224 cmd.Parameters.Add(new SqliteParameter(":bannedUUID", item.bannedUUID.ToString()));
1225 cmd.Parameters.Add(new SqliteParameter(":bannedIp", item.bannedIP));
1226 cmd.Parameters.Add(new SqliteParameter(":bannedIpHostMask", item.bannedIPHostMask));
1227 cmd.ExecuteNonQuery();
1228 }
1229 }
1230 }
1231
1232 /// <summary>
1233 /// remove an entry from the region banlist
1234 /// </summary>
1235 /// <param name="item"></param>
1236 public void RemoveFromRegionBanlist(RegionBanListItem item)
1237 {
1238 lock (ds)
1239 {
1240 using (SqliteCommand cmd = new SqliteCommand("delete from regionban where regionUUID=:regionUUID AND bannedUUID=:bannedUUID", m_conn))
1241 {
1242 cmd.Parameters.Add(new SqliteParameter(":regionUUID", item.regionUUID.ToString()));
1243 cmd.Parameters.Add(new SqliteParameter(":bannedUUID", item.bannedUUID.ToString()));
1244 cmd.ExecuteNonQuery();
1245 }
1246 }
1247 }
1248
1249 /// <summary> 1149 /// <summary>
1250 /// 1150 ///
1251 /// </summary> 1151 /// </summary>
@@ -1827,20 +1727,6 @@ namespace OpenSim.Data.SQLite
1827 /// </summary> 1727 /// </summary>
1828 /// <param name="da"></param> 1728 /// <param name="da"></param>
1829 /// <param name="conn"></param> 1729 /// <param name="conn"></param>
1830 private void setupRegionBanCommands(SqliteDataAdapter da, SqliteConnection conn)
1831 {
1832 da.InsertCommand = createInsertCommand("regionban", ds.Tables["regionban"]);
1833 da.InsertCommand.Connection = conn;
1834
1835 da.UpdateCommand = createUpdateCommand("regionban", "regionUUID=:regionUUID AND bannedUUID=:bannedUUID", ds.Tables["regionban"]);
1836 da.UpdateCommand.Connection = conn;
1837 }
1838
1839 /// <summary>
1840 ///
1841 /// </summary>
1842 /// <param name="da"></param>
1843 /// <param name="conn"></param>
1844 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) 1730 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
1845 { 1731 {
1846 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); 1732 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);