aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r--OpenSim/Data/SQLite/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Data/SQLite/Resources/AgentPrefs.migrations2
-rw-r--r--OpenSim/Data/SQLite/Resources/AssetStore.migrations71
-rw-r--r--OpenSim/Data/SQLite/Resources/EstateStore.migrations68
-rw-r--r--OpenSim/Data/SQLite/Resources/InventoryStore.migrations92
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations549
-rw-r--r--OpenSim/Data/SQLite/Resources/UserAccount.migrations8
-rw-r--r--OpenSim/Data/SQLite/Resources/UserProfiles.migrations2
-rw-r--r--OpenSim/Data/SQLite/Resources/UserStore.migrations169
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs12
-rw-r--r--OpenSim/Data/SQLite/SQLiteAuthenticationData.cs6
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs12
-rw-r--r--OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteGridUserData.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteHGTravelData.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs916
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs158
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserAccountData.cs7
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserProfilesData.cs165
-rw-r--r--OpenSim/Data/SQLite/SQLiteUtils.cs6
-rw-r--r--OpenSim/Data/SQLite/SQLiteXInventoryData.cs14
21 files changed, 455 insertions, 1812 deletions
diff --git a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
index d2e62d2..9884f74 100644
--- a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.8.2.*")] 64[assembly : AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
65 65
diff --git a/OpenSim/Data/SQLite/Resources/AgentPrefs.migrations b/OpenSim/Data/SQLite/Resources/AgentPrefs.migrations
index 7e0525d..8c2663e 100644
--- a/OpenSim/Data/SQLite/Resources/AgentPrefs.migrations
+++ b/OpenSim/Data/SQLite/Resources/AgentPrefs.migrations
@@ -11,7 +11,7 @@ CREATE TABLE `AgentPrefs` (
11 `PermEveryone` INT(6) NOT NULL DEFAULT 0, 11 `PermEveryone` INT(6) NOT NULL DEFAULT 0,
12 `PermGroup` INT(6) NOT NULL DEFAULT 0, 12 `PermGroup` INT(6) NOT NULL DEFAULT 0,
13 `PermNextOwner` INT(6) NOT NULL DEFAULT 532480, 13 `PermNextOwner` INT(6) NOT NULL DEFAULT 532480,
14 UNIQUE KEY `PrincipalID` (`PrincipalID`), 14 UNIQUE (`PrincipalID`),
15 PRIMARY KEY(`PrincipalID`)); 15 PRIMARY KEY(`PrincipalID`));
16 16
17COMMIT; 17COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/AssetStore.migrations b/OpenSim/Data/SQLite/Resources/AssetStore.migrations
index f20631c..0743c45 100644
--- a/OpenSim/Data/SQLite/Resources/AssetStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/AssetStore.migrations
@@ -1,66 +1,17 @@
1:VERSION 1 1:VERSION 6
2 2
3BEGIN TRANSACTION; 3BEGIN TRANSACTION;
4CREATE TABLE assets(
5 UUID varchar(255) primary key,
6 Name varchar(255),
7 Description varchar(255),
8 Type integer,
9 InvType integer,
10 Local integer,
11 Temporary integer,
12 Data blob);
13 4
14COMMIT; 5CREATE TABLE IF NOT EXISTS assets(
15 6 UUID NOT NULL PRIMARY KEY,
16:VERSION 2 7 Name,
17 8 Description,
18BEGIN TRANSACTION; 9 Type,
19 10 Local,
20CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data); 11 Temporary,
21INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets; 12 asset_flags INTEGER NOT NULL DEFAULT 0,
22DROP TABLE assets; 13 CreatorID varchar(128) default '',
23CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data); 14 Data);
24INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup;
25DROP TABLE assets_backup;
26
27COMMIT;
28
29:VERSION 3
30
31DELETE FROM assets WHERE UUID = 'dc4b9f0bd00845c696a401dd947ac621'
32
33:VERSION 4
34
35BEGIN;
36
37update assets
38 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
39 where UUID not like '%-%';
40
41COMMIT;
42
43:VERSION 5
44
45BEGIN TRANSACTION;
46
47CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data);
48INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets;
49DROP TABLE assets;
50CREATE TABLE assets(
51 UUID NOT NULL PRIMARY KEY,
52 Name,
53 Description,
54 Type,
55 Local,
56 Temporary,
57 asset_flags INTEGER NOT NULL DEFAULT 0,
58 CreatorID varchar(128) default '',
59 Data);
60
61INSERT INTO assets(UUID,Name,Description,Type,Local,Temporary,Data)
62SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup;
63DROP TABLE assets_backup;
64 15
65COMMIT; 16COMMIT;
66 17
diff --git a/OpenSim/Data/SQLite/Resources/EstateStore.migrations b/OpenSim/Data/SQLite/Resources/EstateStore.migrations
index 0aec49b..37fa1d9 100644
--- a/OpenSim/Data/SQLite/Resources/EstateStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/EstateStore.migrations
@@ -1,23 +1,27 @@
1:VERSION 6 1:VERSION 10
2 2
3BEGIN TRANSACTION; 3BEGIN TRANSACTION;
4 4
5CREATE TABLE estate_groups ( 5CREATE TABLE IF NOT EXISTS estate_groups (
6 EstateID int(10) NOT NULL, 6 EstateID int(10) NOT NULL,
7 uuid char(36) NOT NULL 7 uuid char(36) NOT NULL
8); 8);
9CREATE INDEX estate_groups_estate_id on estate_groups(EstateID);
9 10
10CREATE TABLE estate_managers ( 11CREATE TABLE IF NOT EXISTS estate_managers (
11 EstateID int(10) NOT NULL, 12 EstateID int(10) NOT NULL,
12 uuid char(36) NOT NULL 13 uuid char(36) NOT NULL
13); 14);
15CREATE INDEX estate_managers_estate_id on estate_managers(EstateID);
14 16
15CREATE TABLE estate_map ( 17CREATE TABLE IF NOT EXISTS estate_map (
16 RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000', 18 RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
17 EstateID int(11) NOT NULL 19 EstateID int(11) NOT NULL
18); 20);
21CREATE INDEX estate_map_estate_id on estate_map(EstateID);
22CREATE UNIQUE INDEX estate_map_region_id on estate_map(RegionID);
19 23
20CREATE TABLE estate_settings ( 24CREATE TABLE IF NOT EXISTS estate_settings (
21 EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 25 EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
22 EstateName varchar(64) default NULL, 26 EstateName varchar(64) default NULL,
23 AbuseEmailToEstateOwner tinyint(4) NOT NULL, 27 AbuseEmailToEstateOwner tinyint(4) NOT NULL,
@@ -38,60 +42,28 @@ CREATE TABLE estate_settings (
38 SunPosition double NOT NULL, 42 SunPosition double NOT NULL,
39 EstateSkipScripts tinyint(4) NOT NULL, 43 EstateSkipScripts tinyint(4) NOT NULL,
40 BillableFactor float NOT NULL, 44 BillableFactor float NOT NULL,
41 PublicAccess tinyint(4) NOT NULL 45 PublicAccess tinyint(4) NOT NULL,
42); 46 AbuseEmail varchar(255) not null default '',
43 47 EstateOwner varchar(36) not null default '',
44insert into estate_settings ( 48 DenyMinors tinyint not null default 0,
45 EstateID,EstateName,AbuseEmailToEstateOwner,DenyAnonymous,ResetHomeOnTeleport,FixedSun,DenyTransacted,BlockDwell,DenyIdentified,AllowVoice,UseGlobalTime,PricePerMeter,TaxFree,AllowDirectTeleport,RedirectGridX,RedirectGridY,ParentEstateID,SunPosition,PublicAccess,EstateSkipScripts,BillableFactor) 49 AllowLandmark tinyint not null default '1',
46 values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); 50 AllowParcelChanges tinyint not null default '1',
47delete from estate_settings; 51 AllowSetHome tinyint not null default '1');
48 52
49CREATE TABLE estate_users ( 53CREATE TABLE IF NOT EXISTS estate_users (
50 EstateID int(10) NOT NULL, 54 EstateID int(10) NOT NULL,
51 uuid char(36) NOT NULL 55 uuid char(36) NOT NULL
52); 56);
57CREATE INDEX estate_users_estate_id on estate_users(EstateID);
53 58
54CREATE TABLE estateban ( 59CREATE TABLE IF NOT EXISTS estateban (
55 EstateID int(10) NOT NULL, 60 EstateID int(10) NOT NULL,
56 bannedUUID varchar(36) NOT NULL, 61 bannedUUID varchar(36) NOT NULL,
57 bannedIp varchar(16) NOT NULL, 62 bannedIp varchar(16) NOT NULL,
58 bannedIpHostMask varchar(16) NOT NULL, 63 bannedIpHostMask varchar(16) NOT NULL,
59 bannedNameMask varchar(64) default NULL 64 bannedNameMask varchar(64) default NULL
60); 65);
61
62CREATE INDEX estate_ban_estate_id on estateban(EstateID); 66CREATE INDEX estate_ban_estate_id on estateban(EstateID);
63CREATE INDEX estate_groups_estate_id on estate_groups(EstateID);
64CREATE INDEX estate_managers_estate_id on estate_managers(EstateID);
65CREATE INDEX estate_map_estate_id on estate_map(EstateID);
66CREATE UNIQUE INDEX estate_map_region_id on estate_map(RegionID);
67CREATE INDEX estate_users_estate_id on estate_users(EstateID);
68 67
69COMMIT; 68COMMIT;
70 69
71
72:VERSION 7
73
74begin;
75
76alter table estate_settings add column AbuseEmail varchar(255) not null default '';
77
78alter table estate_settings add column EstateOwner varchar(36) not null default '';
79
80commit;
81
82:VERSION 8
83
84begin;
85
86alter table estate_settings add column DenyMinors tinyint not null default 0;
87
88commit;
89
90:VERSION 9
91
92begin;
93alter table estate_settings add column AllowLandmark tinyint not null default '1';
94alter table estate_settings add column AllowParcelChanges tinyint not null default '1';
95alter table estate_settings add column AllowSetHome tinyint not null default '1';
96commit;
97
diff --git a/OpenSim/Data/SQLite/Resources/InventoryStore.migrations b/OpenSim/Data/SQLite/Resources/InventoryStore.migrations
deleted file mode 100644
index 585ac49..0000000
--- a/OpenSim/Data/SQLite/Resources/InventoryStore.migrations
+++ /dev/null
@@ -1,92 +0,0 @@
1:VERSION 1
2
3BEGIN TRANSACTION;
4
5CREATE TABLE inventoryfolders(
6 UUID varchar(255) primary key,
7 name varchar(255),
8 agentID varchar(255),
9 parentID varchar(255),
10 type integer,
11 version integer);
12
13CREATE TABLE inventoryitems(
14 UUID varchar(255) primary key,
15 assetID varchar(255),
16 assetType integer,
17 invType integer,
18 parentFolderID varchar(255),
19 avatarID varchar(255),
20 creatorsID varchar(255),
21 inventoryName varchar(255),
22 inventoryDescription varchar(255),
23 inventoryNextPermissions integer,
24 inventoryCurrentPermissions integer,
25 inventoryBasePermissions integer,
26 inventoryEveryOnePermissions integer,
27 salePrice integer default 99,
28 saleType integer default 0,
29 creationDate integer default 2000,
30 groupID varchar(255) default '00000000-0000-0000-0000-000000000000',
31 groupOwned integer default 0,
32 flags integer default 0);
33
34COMMIT;
35
36:VERSION 2
37
38BEGIN TRANSACTION;
39
40create index inventoryfolders_agentid on inventoryfolders(agentid);
41create index inventoryfolders_parentid on inventoryfolders(parentid);
42create index inventoryitems_parentfolderid on inventoryitems(parentfolderid);
43create index inventoryitems_avatarid on inventoryitems(avatarid);
44
45COMMIT;
46
47:VERSION 3
48
49BEGIN;
50
51alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0;
52
53COMMIT;
54
55:VERSION 4
56
57BEGIN;
58
59update inventoryitems
60 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
61 where UUID not like '%-%';
62
63update inventoryitems
64 set assetID = substr(assetID, 1, 8) || "-" || substr(assetID, 9, 4) || "-" || substr(assetID, 13, 4) || "-" || substr(assetID, 17, 4) || "-" || substr(assetID, 21, 12)
65 where assetID not like '%-%';
66
67update inventoryitems
68 set parentFolderID = substr(parentFolderID, 1, 8) || "-" || substr(parentFolderID, 9, 4) || "-" || substr(parentFolderID, 13, 4) || "-" || substr(parentFolderID, 17, 4) || "-" || substr(parentFolderID, 21, 12)
69 where parentFolderID not like '%-%';
70
71update inventoryitems
72 set avatarID = substr(avatarID, 1, 8) || "-" || substr(avatarID, 9, 4) || "-" || substr(avatarID, 13, 4) || "-" || substr(avatarID, 17, 4) || "-" || substr(avatarID, 21, 12)
73 where avatarID not like '%-%';
74
75update inventoryitems
76 set creatorsID = substr(creatorsID, 1, 8) || "-" || substr(creatorsID, 9, 4) || "-" || substr(creatorsID, 13, 4) || "-" || substr(creatorsID, 17, 4) || "-" || substr(creatorsID, 21, 12)
77 where creatorsID not like '%-%';
78
79
80update inventoryfolders
81 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
82 where UUID not like '%-%';
83
84update inventoryfolders
85 set agentID = substr(agentID, 1, 8) || "-" || substr(agentID, 9, 4) || "-" || substr(agentID, 13, 4) || "-" || substr(agentID, 17, 4) || "-" || substr(agentID, 21, 12)
86 where agentID not like '%-%';
87
88update inventoryfolders
89 set parentID = substr(parentID, 1, 8) || "-" || substr(parentID, 9, 4) || "-" || substr(parentID, 13, 4) || "-" || substr(parentID, 17, 4) || "-" || substr(parentID, 21, 12)
90 where parentID not like '%-%';
91
92COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index 901068f..fb154cf 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -1,56 +1,99 @@
1:VERSION 1 1:VERSION 31
2 2
3BEGIN TRANSACTION; 3BEGIN TRANSACTION;
4 4
5CREATE TABLE prims( 5CREATE TABLE IF NOT EXISTS prims(
6 UUID varchar(255) primary key, 6 UUID varchar(255) primary key,
7 RegionUUID varchar(255), 7 RegionUUID varchar(255),
8 ParentID integer, 8 CreationDate integer,
9 CreationDate integer, 9 Name varchar(255),
10 Name varchar(255), 10 SceneGroupID varchar(255),
11 SceneGroupID varchar(255), 11 Text varchar(255),
12 Text varchar(255), 12 Description varchar(255),
13 Description varchar(255), 13 SitName varchar(255),
14 SitName varchar(255), 14 TouchName varchar(255),
15 TouchName varchar(255), 15 CreatorID varchar(255),
16 CreatorID varchar(255), 16 OwnerID varchar(255),
17 OwnerID varchar(255), 17 GroupID varchar(255),
18 GroupID varchar(255), 18 LastOwnerID varchar(255),
19 LastOwnerID varchar(255), 19 OwnerMask integer,
20 OwnerMask integer, 20 NextOwnerMask integer,
21 NextOwnerMask integer, 21 GroupMask integer,
22 GroupMask integer, 22 EveryoneMask integer,
23 EveryoneMask integer, 23 BaseMask integer,
24 BaseMask integer, 24 PositionX float,
25 PositionX float, 25 PositionY float,
26 PositionY float, 26 PositionZ float,
27 PositionZ float, 27 GroupPositionX float,
28 GroupPositionX float, 28 GroupPositionY float,
29 GroupPositionY float, 29 GroupPositionZ float,
30 GroupPositionZ float, 30 VelocityX float,
31 VelocityX float, 31 VelocityY float,
32 VelocityY float, 32 VelocityZ float,
33 VelocityZ float, 33 AngularVelocityX float,
34 AngularVelocityX float, 34 AngularVelocityY float,
35 AngularVelocityY float, 35 AngularVelocityZ float,
36 AngularVelocityZ float, 36 AccelerationX float,
37 AccelerationX float, 37 AccelerationY float,
38 AccelerationY float, 38 AccelerationZ float,
39 AccelerationZ float, 39 RotationX float,
40 RotationX float, 40 RotationY float,
41 RotationY float, 41 RotationZ float,
42 RotationZ float, 42 RotationW float,
43 RotationW float, 43 ObjectFlags integer,
44 ObjectFlags integer, 44 SitTargetOffsetX float NOT NULL default 0,
45 SitTargetOffsetX float NOT NULL default 0, 45 SitTargetOffsetY float NOT NULL default 0,
46 SitTargetOffsetY float NOT NULL default 0, 46 SitTargetOffsetZ float NOT NULL default 0,
47 SitTargetOffsetZ float NOT NULL default 0, 47 SitTargetOrientW float NOT NULL default 0,
48 SitTargetOrientW float NOT NULL default 0, 48 SitTargetOrientX float NOT NULL default 0,
49 SitTargetOrientX float NOT NULL default 0, 49 SitTargetOrientY float NOT NULL default 0,
50 SitTargetOrientY float NOT NULL default 0, 50 SitTargetOrientZ float NOT NULL default 0,
51 SitTargetOrientZ float NOT NULL default 0); 51 ColorR integer not null default 0,
52 52 ColorG integer not null default 0,
53CREATE TABLE primshapes( 53 ColorB integer not null default 0,
54 ColorA integer not null default 0,
55 ClickAction integer not null default 0,
56 PayPrice integer not null default 0,
57 PayButton1 integer not null default 0,
58 PayButton2 integer not null default 0,
59 PayButton3 integer not null default 0,
60 PayButton4 integer not null default 0,
61 LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
62 LoopedSoundGain float NOT NULL default 0,
63 TextureAnimation string,
64 ParticleSystem string,
65 OmegaX float NOT NULL default 0,
66 OmegaY float NOT NULL default 0,
67 OmegaZ float NOT NULL default 0,
68 CameraEyeOffsetX float NOT NULL default 0,
69 CameraEyeOffsetY float NOT NULL default 0,
70 CameraEyeOffsetZ float NOT NULL default 0,
71 CameraAtOffsetX float NOT NULL default 0,
72 CameraAtOffsetY float NOT NULL default 0,
73 CameraAtOffsetZ float NOT NULL default 0,
74 ForceMouselook string NOT NULL default 0,
75 ScriptAccessPin INTEGER NOT NULL default 0,
76 AllowedDrop INTEGER NOT NULL default 0,
77 DieAtEdge string NOT NULL default 0,
78 SalePrice INTEGER NOT NULL default 0,
79 SaleType string NOT NULL default 0,
80 Material INTEGER NOT NULL default 3,
81 CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
82 CollisionSoundVolume float NOT NULL default 0,
83 VolumeDetect INTEGER NOT NULL DEFAULT 0,
84 MediaURL varchar(255),
85 DynAttrs TEXT,
86 `PhysicsShapeType` tinyint(4) NOT NULL default '0',
87 `Density` double NOT NULL default '1000',
88 `GravityModifier` double NOT NULL default '1',
89 `Friction` double NOT NULL default '0.6',
90 `Restitution` double NOT NULL default '0.5',
91 `KeyframeMotion` blob,
92 AttachedPosX double default '0',
93 AttachedPosY double default '0',
94 AttachedPosZ double default '0');
95
96CREATE TABLE IF NOT EXISTS primshapes(
54 UUID varchar(255) primary key, 97 UUID varchar(255) primary key,
55 Shape integer, 98 Shape integer,
56 ScaleX float, 99 ScaleX float,
@@ -76,10 +119,12 @@ CREATE TABLE primshapes(
76 ProfileCurve integer, 119 ProfileCurve integer,
77 ProfileHollow integer, 120 ProfileHollow integer,
78 Texture blob, 121 Texture blob,
79 ExtraParams blob, 122 ExtraParams blob,
80 State Integer NOT NULL default 0); 123 State Integer NOT NULL default 0,
124 Media TEXT,
125 LastAttachPoint int not null default '0');
81 126
82CREATE TABLE primitems( 127CREATE TABLE IF NOT EXISTS primitems(
83 itemID varchar(255) primary key, 128 itemID varchar(255) primary key,
84 primID varchar(255), 129 primID varchar(255),
85 assetID varchar(255), 130 assetID varchar(255),
@@ -97,14 +142,15 @@ CREATE TABLE primitems(
97 currentPermissions string, 142 currentPermissions string,
98 basePermissions string, 143 basePermissions string,
99 everyonePermissions string, 144 everyonePermissions string,
100 groupPermissions string); 145 groupPermissions string,
146 flags integer not null default 0);
101 147
102CREATE TABLE terrain( 148CREATE TABLE IF NOT EXISTS terrain(
103 RegionUUID varchar(255), 149 RegionUUID varchar(255),
104 Revision integer, 150 Revision integer,
105 Heightfield blob); 151 Heightfield blob);
106 152
107CREATE TABLE land( 153CREATE TABLE IF NOT EXISTS land(
108 UUID varchar(255) primary key, 154 UUID varchar(255) primary key,
109 RegionUUID varchar(255), 155 RegionUUID varchar(255),
110 LocalLandID string, 156 LocalLandID string,
@@ -135,92 +181,30 @@ CREATE TABLE land(
135 UserLocationZ float, 181 UserLocationZ float,
136 UserLookAtX float, 182 UserLookAtX float,
137 UserLookAtY float, 183 UserLookAtY float,
138 UserLookAtZ float, 184 UserLookAtZ float,
139 AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'); 185 AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
140 186 OtherCleanTime INTEGER NOT NULL default 0,
141CREATE TABLE landaccesslist( 187 Dwell INTEGER NOT NULL default 0,
188 `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none',
189 `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '',
190 `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0',
191 `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE,
192 `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE,
193 `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE);
194
195CREATE TABLE IF NOT EXISTS landaccesslist(
142 LandUUID varchar(255), 196 LandUUID varchar(255),
143 AccessUUID varchar(255), 197 AccessUUID varchar(255),
144 Flags string); 198 Flags string);
145 199
146COMMIT; 200CREATE TABLE IF NOT EXISTS regionban(
147 201 regionUUID varchar (255),
148:VERSION 2 202 bannedUUID varchar (255),
149 203 bannedIp varchar (255),
150BEGIN TRANSACTION; 204 bannedIpHostMask varchar (255)
151 205 );
152CREATE TABLE regionban(
153 regionUUID varchar (255),
154 bannedUUID varchar (255),
155 bannedIp varchar (255),
156 bannedIpHostMask varchar (255)
157 );
158
159COMMIT;
160
161:VERSION 3
162
163BEGIN;
164
165ALTER TABLE primitems add flags integer not null default 0;
166
167COMMIT;
168
169:VERSION 4
170
171BEGIN;
172
173create table regionsettings (
174 regionUUID char(36) not null,
175 block_terraform integer not null,
176 block_fly integer not null,
177 allow_damage integer not null,
178 restrict_pushing integer not null,
179 allow_land_resell integer not null,
180 allow_land_join_divide integer not null,
181 block_show_in_search integer not null,
182 agent_limit integer not null,
183 object_bonus float not null,
184 maturity integer not null,
185 disable_scripts integer not null,
186 disable_collisions integer not null,
187 disable_physics integer not null,
188 terrain_texture_1 char(36) not null,
189 terrain_texture_2 char(36) not null,
190 terrain_texture_3 char(36) not null,
191 terrain_texture_4 char(36) not null,
192 elevation_1_nw float not null,
193 elevation_2_nw float not null,
194 elevation_1_ne float not null,
195 elevation_2_ne float not null,
196 elevation_1_se float not null,
197 elevation_2_se float not null,
198 elevation_1_sw float not null,
199 elevation_2_sw float not null,
200 water_height float not null,
201 terrain_raise_limit float not null,
202 terrain_lower_limit float not null,
203 use_estate_sun integer not null,
204 fixed_sun integer not null,
205 sun_position float not null,
206 covenant char(36));
207
208COMMIT;
209
210:VERSION 5
211
212BEGIN;
213
214delete from regionsettings;
215
216COMMIT;
217
218:VERSION 6
219 206
220BEGIN TRANSACTION; 207CREATE TABLE IF NOT EXISTS regionsettings (
221
222drop table regionsettings;
223CREATE TABLE regionsettings (
224 regionUUID char(36) NOT NULL, 208 regionUUID char(36) NOT NULL,
225 block_terraform int(11) NOT NULL, 209 block_terraform int(11) NOT NULL,
226 block_fly int(11) NOT NULL, 210 block_fly int(11) NOT NULL,
@@ -254,228 +238,18 @@ CREATE TABLE regionsettings (
254 fixed_sun int(11) NOT NULL, 238 fixed_sun int(11) NOT NULL,
255 sun_position float NOT NULL, 239 sun_position float NOT NULL,
256 covenant char(36) default NULL, 240 covenant char(36) default NULL,
257 sandbox tinyint(4) NOT NULL, 241 sandbox tinyint(4) NOT NULL,
242 sunvectorx double NOT NULL default 0,
243 sunvectory double NOT NULL default 0,
244 sunvectorz double NOT NULL default 0,
245 map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
246 covenant_datetime INTEGER NOT NULL default 0,
247 `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
248 `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
258 PRIMARY KEY (regionUUID) 249 PRIMARY KEY (regionUUID)
259); 250);
260 251
261COMMIT; 252CREATE TABLE IF NOT EXISTS regionwindlight (
262
263:VERSION 9
264
265BEGIN;
266
267ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
268ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
269ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
270ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;
271
272COMMIT;
273
274:VERSION 10
275
276BEGIN;
277
278ALTER TABLE prims ADD COLUMN ClickAction INTEGER NOT NULL default 0;
279
280COMMIT;
281
282:VERSION 11
283
284BEGIN;
285
286ALTER TABLE prims ADD COLUMN PayPrice INTEGER NOT NULL default 0;
287ALTER TABLE prims ADD COLUMN PayButton1 INTEGER NOT NULL default 0;
288ALTER TABLE prims ADD COLUMN PayButton2 INTEGER NOT NULL default 0;
289ALTER TABLE prims ADD COLUMN PayButton3 INTEGER NOT NULL default 0;
290ALTER TABLE prims ADD COLUMN PayButton4 INTEGER NOT NULL default 0;
291ALTER TABLE prims ADD COLUMN LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
292ALTER TABLE prims ADD COLUMN LoopedSoundGain float NOT NULL default 0;
293ALTER TABLE prims ADD COLUMN TextureAnimation string;
294ALTER TABLE prims ADD COLUMN ParticleSystem string;
295ALTER TABLE prims ADD COLUMN OmegaX float NOT NULL default 0;
296ALTER TABLE prims ADD COLUMN OmegaY float NOT NULL default 0;
297ALTER TABLE prims ADD COLUMN OmegaZ float NOT NULL default 0;
298ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float NOT NULL default 0;
299ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float NOT NULL default 0;
300ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float NOT NULL default 0;
301ALTER TABLE prims ADD COLUMN CameraAtOffsetX float NOT NULL default 0;
302ALTER TABLE prims ADD COLUMN CameraAtOffsetY float NOT NULL default 0;
303ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float NOT NULL default 0;
304ALTER TABLE prims ADD COLUMN ForceMouselook string NOT NULL default 0;
305ALTER TABLE prims ADD COLUMN ScriptAccessPin INTEGER NOT NULL default 0;
306ALTER TABLE prims ADD COLUMN AllowedDrop INTEGER NOT NULL default 0;
307ALTER TABLE prims ADD COLUMN DieAtEdge string NOT NULL default 0;
308ALTER TABLE prims ADD COLUMN SalePrice INTEGER NOT NULL default 0;
309ALTER TABLE prims ADD COLUMN SaleType string NOT NULL default 0;
310
311COMMIT;
312
313:VERSION 12
314
315BEGIN;
316
317ALTER TABLE prims ADD COLUMN Material INTEGER NOT NULL default 3;
318
319COMMIT;
320
321:VERSION 13
322
323BEGIN;
324
325ALTER TABLE land ADD COLUMN OtherCleanTime INTEGER NOT NULL default 0;
326ALTER TABLE land ADD COLUMN Dwell INTEGER NOT NULL default 0;
327
328COMMIT;
329
330:VERSION 14
331
332begin;
333
334ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0;
335ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0;
336ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0;
337
338commit;
339
340:VERSION 15
341
342BEGIN;
343
344ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
345ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0;
346
347COMMIT;
348
349:VERSION 16
350
351BEGIN;
352
353ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
354
355COMMIT;
356
357:VERSION 17
358
359BEGIN;
360CREATE TEMPORARY TABLE prims_backup(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
361INSERT INTO prims_backup SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims;
362DROP TABLE prims;
363CREATE TABLE prims(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
364INSERT INTO prims SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims_backup;
365DROP TABLE prims_backup;
366COMMIT;
367
368:VERSION 18
369
370BEGIN;
371
372update terrain
373 set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
374 where RegionUUID not like '%-%';
375
376
377update landaccesslist
378 set LandUUID = substr(LandUUID, 1, 8) || "-" || substr(LandUUID, 9, 4) || "-" || substr(LandUUID, 13, 4) || "-" || substr(LandUUID, 17, 4) || "-" || substr(LandUUID, 21, 12)
379 where LandUUID not like '%-%';
380
381update landaccesslist
382 set AccessUUID = substr(AccessUUID, 1, 8) || "-" || substr(AccessUUID, 9, 4) || "-" || substr(AccessUUID, 13, 4) || "-" || substr(AccessUUID, 17, 4) || "-" || substr(AccessUUID, 21, 12)
383 where AccessUUID not like '%-%';
384
385
386update prims
387 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
388 where UUID not like '%-%';
389
390update prims
391 set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
392 where RegionUUID not like '%-%';
393
394update prims
395 set SceneGroupID = substr(SceneGroupID, 1, 8) || "-" || substr(SceneGroupID, 9, 4) || "-" || substr(SceneGroupID, 13, 4) || "-" || substr(SceneGroupID, 17, 4) || "-" || substr(SceneGroupID, 21, 12)
396 where SceneGroupID not like '%-%';
397
398update prims
399 set CreatorID = substr(CreatorID, 1, 8) || "-" || substr(CreatorID, 9, 4) || "-" || substr(CreatorID, 13, 4) || "-" || substr(CreatorID, 17, 4) || "-" || substr(CreatorID, 21, 12)
400 where CreatorID not like '%-%';
401
402update prims
403 set OwnerID = substr(OwnerID, 1, 8) || "-" || substr(OwnerID, 9, 4) || "-" || substr(OwnerID, 13, 4) || "-" || substr(OwnerID, 17, 4) || "-" || substr(OwnerID, 21, 12)
404 where OwnerID not like '%-%';
405
406update prims
407 set GroupID = substr(GroupID, 1, 8) || "-" || substr(GroupID, 9, 4) || "-" || substr(GroupID, 13, 4) || "-" || substr(GroupID, 17, 4) || "-" || substr(GroupID, 21, 12)
408 where GroupID not like '%-%';
409
410update prims
411 set LastOwnerID = substr(LastOwnerID, 1, 8) || "-" || substr(LastOwnerID, 9, 4) || "-" || substr(LastOwnerID, 13, 4) || "-" || substr(LastOwnerID, 17, 4) || "-" || substr(LastOwnerID, 21, 12)
412 where LastOwnerID not like '%-%';
413
414
415update primshapes
416 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
417 where UUID not like '%-%';
418
419
420update land
421 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
422 where UUID not like '%-%';
423
424update land
425 set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
426 where RegionUUID not like '%-%';
427
428update land
429 set OwnerUUID = substr(OwnerUUID, 1, 8) || "-" || substr(OwnerUUID, 9, 4) || "-" || substr(OwnerUUID, 13, 4) || "-" || substr(OwnerUUID, 17, 4) || "-" || substr(OwnerUUID, 21, 12)
430 where OwnerUUID not like '%-%';
431
432update land
433 set GroupUUID = substr(GroupUUID, 1, 8) || "-" || substr(GroupUUID, 9, 4) || "-" || substr(GroupUUID, 13, 4) || "-" || substr(GroupUUID, 17, 4) || "-" || substr(GroupUUID, 21, 12)
434 where GroupUUID not like '%-%';
435
436update land
437 set MediaTextureUUID = substr(MediaTextureUUID, 1, 8) || "-" || substr(MediaTextureUUID, 9, 4) || "-" || substr(MediaTextureUUID, 13, 4) || "-" || substr(MediaTextureUUID, 17, 4) || "-" || substr(MediaTextureUUID, 21, 12)
438 where MediaTextureUUID not like '%-%';
439
440update land
441 set SnapshotUUID = substr(SnapshotUUID, 1, 8) || "-" || substr(SnapshotUUID, 9, 4) || "-" || substr(SnapshotUUID, 13, 4) || "-" || substr(SnapshotUUID, 17, 4) || "-" || substr(SnapshotUUID, 21, 12)
442 where SnapshotUUID not like '%-%';
443
444update land
445 set AuthbuyerID = substr(AuthbuyerID, 1, 8) || "-" || substr(AuthbuyerID, 9, 4) || "-" || substr(AuthbuyerID, 13, 4) || "-" || substr(AuthbuyerID, 17, 4) || "-" || substr(AuthbuyerID, 21, 12)
446 where AuthbuyerID not like '%-%';
447
448COMMIT;
449
450:VERSION 19
451BEGIN;
452ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
453COMMIT;
454
455:VERSION 20
456BEGIN;
457ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
458ALTER TABLE primshapes ADD COLUMN Media TEXT;
459COMMIT;
460
461:VERSION 21
462BEGIN;
463ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none';
464ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
465ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
466ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
467ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
468ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
469COMMIT;
470
471:VERSION 22
472BEGIN;
473ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0;
474COMMIT;
475
476:VERSION 23
477BEGIN;
478CREATE TABLE regionwindlight (
479 region_id VARCHAR(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY, 253 region_id VARCHAR(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
480 water_color_r FLOAT NOT NULL DEFAULT '4.000000', 254 water_color_r FLOAT NOT NULL DEFAULT '4.000000',
481 water_color_g FLOAT NOT NULL DEFAULT '38.000000', 255 water_color_g FLOAT NOT NULL DEFAULT '38.000000',
@@ -541,13 +315,6 @@ CREATE TABLE regionwindlight (
541 cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0', 315 cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0',
542 draw_classic_clouds INTEGER NOT NULL DEFAULT '1'); 316 draw_classic_clouds INTEGER NOT NULL DEFAULT '1');
543 317
544COMMIT;
545
546
547:VERSION 24
548
549BEGIN;
550
551CREATE TABLE IF NOT EXISTS `spawn_points` ( 318CREATE TABLE IF NOT EXISTS `spawn_points` (
552 `RegionID` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', 319 `RegionID` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
553 `Yaw` float NOT NULL, 320 `Yaw` float NOT NULL,
@@ -555,60 +322,58 @@ CREATE TABLE IF NOT EXISTS `spawn_points` (
555 `Distance` float NOT NULL 322 `Distance` float NOT NULL
556); 323);
557 324
558ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; 325CREATE TABLE IF NOT EXISTS `regionenvironment` (
326 `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
327 `llsd_settings` TEXT NOT NULL
328);
559 329
560COMMIT; 330COMMIT;
561 331
562:VERSION 25
563
564BEGIN;
565ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
566COMMIT;
567 332
568:VERSION 26 333:VERSION 32 #---- avination fields plus a few others
569 334
570BEGIN; 335BEGIN;
571 336
572CREATE TABLE `regionenvironment` ( 337ALTER TABLE `prims` ADD COLUMN `PassTouches` BOOLEAN NOT NULL DEFAULT FALSE;
573 `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY, 338ALTER TABLE `prims` ADD COLUMN `PassCollisions`BOOLEAN NOT NULL DEFAULT FALSE;
574 `llsd_settings` TEXT NOT NULL 339ALTER TABLE `prims` ADD COLUMN `Vehicle` TEXT default NULL;
575); 340ALTER TABLE `regionsettings` ADD COLUMN `block_search` BOOLEAN NOT NULL DEFAULT FALSE;;
341ALTER TABLE `regionsettings` ADD COLUMN `casino` BOOLEAN NOT NULL DEFAULT FALSE;;
342ALTER TABLE `land` ADD COLUMN `SeeAVs` BOOLEAN NOT NULL DEFAULT TRUE;
343ALTER TABLE `land` ADD COLUMN `AnyAVSounds` BOOLEAN NOT NULL DEFAULT TRUE;
344ALTER TABLE `land` ADD COLUMN `GroupAVSounds` BOOLEAN NOT NULL DEFAULT TRUE;
576 345
577COMMIT; 346COMMIT;
578 347
579:VERSION 27 348:VERSION 33 #---- Rotation axis locks
580BEGIN;
581ALTER TABLE prims ADD COLUMN DynAttrs TEXT;
582COMMIT;
583
584:VERSION 28
585 349
586BEGIN; 350BEGIN;
587 351
588ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0'; 352ALTER TABLE prims ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0';
589ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000';
590ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1';
591ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6';
592ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5';
593 353
594COMMIT; 354COMMIT;
595 355
596:VERSION 29 #---------------- Keyframes 356:VERSION 34 #---- add baked terrain store
597 357
598BEGIN; 358BEGIN;
599 359
600ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; 360CREATE TABLE IF NOT EXISTS bakedterrain(
361 RegionUUID varchar(255),
362 Revision integer,
363 Heightfield blob);
601 364
602COMMIT; 365COMMIT;
603 366
604:VERSION 30 #---------------- Save Attachment info 367:VERSION 35 #----- Add RezzerID field in table prims
605 368
606BEGIN; 369BEGIN;
607 370
608ALTER TABLE prims ADD COLUMN AttachedPosX double default '0'; 371ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
609ALTER TABLE prims ADD COLUMN AttachedPosY double default '0';
610ALTER TABLE prims ADD COLUMN AttachedPosZ double default '0';
611ALTER TABLE primshapes ADD COLUMN LastAttachPoint int not null default '0';
612 372
613COMMIT; 373COMMIT;
614 374
375:VERSION 36 #----- Add physics inertia data
376
377BEGIN;
378ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
379COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/UserAccount.migrations b/OpenSim/Data/SQLite/Resources/UserAccount.migrations
index 854fe69..f37a222 100644
--- a/OpenSim/Data/SQLite/Resources/UserAccount.migrations
+++ b/OpenSim/Data/SQLite/Resources/UserAccount.migrations
@@ -25,3 +25,11 @@ BEGIN TRANSACTION;
25INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users; 25INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users;
26 26
27COMMIT; 27COMMIT;
28
29:VERSION 3 # -------------------------
30
31BEGIN;
32
33ALTER TABLE `UserAccounts` ADD `active` BOOLEAN NOT NULL DEFAULT TRUE;
34
35COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
index 86434e8..207dde0 100644
--- a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations
@@ -99,4 +99,4 @@ CREATE TABLE IF NOT EXISTS usersettings (
99 email varchar(254) NOT NULL, 99 email varchar(254) NOT NULL,
100 PRIMARY KEY (useruuid) 100 PRIMARY KEY (useruuid)
101) 101)
102commit; \ No newline at end of file 102commit;
diff --git a/OpenSim/Data/SQLite/Resources/UserStore.migrations b/OpenSim/Data/SQLite/Resources/UserStore.migrations
deleted file mode 100644
index 73d35e8..0000000
--- a/OpenSim/Data/SQLite/Resources/UserStore.migrations
+++ /dev/null
@@ -1,169 +0,0 @@
1:VERSION 1
2
3BEGIN TRANSACTION;
4
5-- users table
6CREATE TABLE users(
7 UUID varchar(255) primary key,
8 username varchar(255),
9 surname varchar(255),
10 passwordHash varchar(255),
11 passwordSalt varchar(255),
12 homeRegionX integer,
13 homeRegionY integer,
14 homeLocationX float,
15 homeLocationY float,
16 homeLocationZ float,
17 homeLookAtX float,
18 homeLookAtY float,
19 homeLookAtZ float,
20 created integer,
21 lastLogin integer,
22 rootInventoryFolderID varchar(255),
23 userInventoryURI varchar(255),
24 userAssetURI varchar(255),
25 profileCanDoMask integer,
26 profileWantDoMask integer,
27 profileAboutText varchar(255),
28 profileFirstText varchar(255),
29 profileImage varchar(255),
30 profileFirstImage varchar(255),
31 webLoginKey text default '00000000-0000-0000-0000-000000000000');
32-- friends table
33CREATE TABLE userfriends(
34 ownerID varchar(255),
35 friendID varchar(255),
36 friendPerms integer,
37 ownerPerms integer,
38 datetimestamp integer);
39
40COMMIT;
41
42:VERSION 2
43
44BEGIN;
45
46ALTER TABLE users add homeRegionID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
47
48COMMIT;
49
50:VERSION 3
51
52BEGIN;
53
54ALTER TABLE users add userFlags integer NOT NULL default 0;
55ALTER TABLE users add godLevel integer NOT NULL default 0;
56
57COMMIT;
58
59:VERSION 4
60
61BEGIN;
62
63ALTER TABLE users add customType varchar(32) not null default '';
64ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000';
65
66COMMIT;
67
68:VERSION 5
69
70BEGIN;
71
72CREATE TABLE `avatarattachments` (`UUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `attachpoint` int(11) NOT NULL DEFAULT 0, `item` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `asset` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000');
73
74COMMIT;
75
76:VERSION 6
77
78BEGIN TRANSACTION;
79
80-- usersagents table
81CREATE TABLE IF NOT EXISTS useragents(
82 UUID varchar(255) primary key,
83 agentIP varchar(255),
84 agentPort integer,
85 agentOnline boolean,
86 sessionID varchar(255),
87 secureSessionID varchar(255),
88 regionID varchar(255),
89 loginTime integer,
90 logoutTime integer,
91 currentRegion varchar(255),
92 currentHandle varchar(255),
93 currentPosX float,
94 currentPosY float,
95 currentPosZ float);
96
97COMMIT;
98
99:VERSION 7
100
101BEGIN TRANSACTION;
102
103ALTER TABLE useragents add currentLookAtX float not null default 128;
104ALTER TABLE useragents add currentLookAtY float not null default 128;
105ALTER TABLE useragents add currentLookAtZ float not null default 70;
106
107COMMIT;
108
109:VERSION 8
110
111BEGIN TRANSACTION;
112
113ALTER TABLE users add email varchar(250);
114
115COMMIT;
116
117:VERSION 9
118
119BEGIN;
120
121update users
122 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
123 where UUID not like '%-%';
124
125update useragents
126 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
127 where UUID not like '%-%';
128
129COMMIT;
130
131:VERSION 10
132
133BEGIN TRANSACTION;
134
135CREATE TABLE IF NOT EXISTS avatarappearance(
136 Owner varchar(36) NOT NULL primary key,
137 BodyItem varchar(36) DEFAULT NULL,
138 BodyAsset varchar(36) DEFAULT NULL,
139 SkinItem varchar(36) DEFAULT NULL,
140 SkinAsset varchar(36) DEFAULT NULL,
141 HairItem varchar(36) DEFAULT NULL,
142 HairAsset varchar(36) DEFAULT NULL,
143 EyesItem varchar(36) DEFAULT NULL,
144 EyesAsset varchar(36) DEFAULT NULL,
145 ShirtItem varchar(36) DEFAULT NULL,
146 ShirtAsset varchar(36) DEFAULT NULL,
147 PantsItem varchar(36) DEFAULT NULL,
148 PantsAsset varchar(36) DEFAULT NULL,
149 ShoesItem varchar(36) DEFAULT NULL,
150 ShoesAsset varchar(36) DEFAULT NULL,
151 SocksItem varchar(36) DEFAULT NULL,
152 SocksAsset varchar(36) DEFAULT NULL,
153 JacketItem varchar(36) DEFAULT NULL,
154 JacketAsset varchar(36) DEFAULT NULL,
155 GlovesItem varchar(36) DEFAULT NULL,
156 GlovesAsset varchar(36) DEFAULT NULL,
157 UnderShirtItem varchar(36) DEFAULT NULL,
158 UnderShirtAsset varchar(36) DEFAULT NULL,
159 UnderPantsItem varchar(36) DEFAULT NULL,
160 UnderPantsAsset varchar(36) DEFAULT NULL,
161 SkirtItem varchar(36) DEFAULT NULL,
162 SkirtAsset varchar(36) DEFAULT NULL,
163 Texture blob,
164 VisualParams blob,
165 Serial int DEFAULT NULL,
166 AvatarHeight float DEFAULT NULL
167);
168
169COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index 30b26c4..966d0b8 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Data.SQLite
86 86
87 if (dbconnect == string.Empty) 87 if (dbconnect == string.Empty)
88 { 88 {
89 dbconnect = "URI=file:../db/Asset.db,version=3"; 89 dbconnect = "URI=file:Asset.db,version=3";
90 } 90 }
91 m_conn = new SqliteConnection(dbconnect); 91 m_conn = new SqliteConnection(dbconnect);
92 m_conn.Open(); 92 m_conn.Open();
@@ -131,14 +131,14 @@ namespace OpenSim.Data.SQLite
131 /// Create an asset 131 /// Create an asset
132 /// </summary> 132 /// </summary>
133 /// <param name="asset">Asset Base</param> 133 /// <param name="asset">Asset Base</param>
134 override public void StoreAsset(AssetBase asset) 134 override public bool StoreAsset(AssetBase asset)
135 { 135 {
136 string assetName = asset.Name; 136 string assetName = asset.Name;
137 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) 137 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
138 { 138 {
139 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); 139 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
140 m_log.WarnFormat( 140 m_log.WarnFormat(
141 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", 141 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
142 asset.Name, asset.ID, asset.Name.Length, assetName.Length); 142 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
143 } 143 }
144 144
@@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite
147 { 147 {
148 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); 148 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
149 m_log.WarnFormat( 149 m_log.WarnFormat(
150 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", 150 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
151 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); 151 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
152 } 152 }
153 153
@@ -171,6 +171,7 @@ namespace OpenSim.Data.SQLite
171 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 171 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
172 172
173 cmd.ExecuteNonQuery(); 173 cmd.ExecuteNonQuery();
174 return true;
174 } 175 }
175 } 176 }
176 } 177 }
@@ -191,6 +192,7 @@ namespace OpenSim.Data.SQLite
191 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 192 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
192 193
193 cmd.ExecuteNonQuery(); 194 cmd.ExecuteNonQuery();
195 return true;
194 } 196 }
195 } 197 }
196 } 198 }
@@ -358,7 +360,7 @@ namespace OpenSim.Data.SQLite
358 /// </summary> 360 /// </summary>
359 override public void Initialise() 361 override public void Initialise()
360 { 362 {
361 Initialise("URI=file:../db/Asset.db,version=3"); 363 Initialise("URI=file:Asset.db,version=3");
362 } 364 }
363 365
364 /// <summary> 366 /// <summary>
diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
index 0428c11..8fb955c 100644
--- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Data.SQLite
45 public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData 45 public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private string m_Realm; 49 private string m_Realm;
50 private List<string> m_ColumnNames; 50 private List<string> m_ColumnNames;
51 private int m_LastExpire; 51 private int m_LastExpire;
@@ -223,7 +223,7 @@ namespace OpenSim.Data.SQLite
223 if (System.Environment.TickCount - m_LastExpire > 30000) 223 if (System.Environment.TickCount - m_LastExpire > 30000)
224 DoExpire(); 224 DoExpire();
225 225
226 using (SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() + 226 using (SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
227 "', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))")) 227 "', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))"))
228 { 228 {
229 if (ExecuteNonQuery(cmd, m_Connection) > 0) 229 if (ExecuteNonQuery(cmd, m_Connection) > 0)
@@ -238,7 +238,7 @@ namespace OpenSim.Data.SQLite
238 if (System.Environment.TickCount - m_LastExpire > 30000) 238 if (System.Environment.TickCount - m_LastExpire > 30000)
239 DoExpire(); 239 DoExpire();
240 240
241 using (SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() + 241 using (SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
242 " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')")) 242 " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')"))
243 { 243 {
244 if (ExecuteNonQuery(cmd, m_Connection) > 0) 244 if (ExecuteNonQuery(cmd, m_Connection) > 0)
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index d51f2d4..0fcab21 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -190,7 +190,7 @@ namespace OpenSim.Data.SQLite
190 IDataReader r = null; 190 IDataReader r = null;
191 191
192 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 192 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
193 { 193 {
194 names.Remove("EstateID"); 194 names.Remove("EstateID");
195 195
196 string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; 196 string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
@@ -386,15 +386,15 @@ namespace OpenSim.Data.SQLite
386 return DoLoad(cmd, UUID.Zero, false); 386 return DoLoad(cmd, UUID.Zero, false);
387 } 387 }
388 } 388 }
389 389
390 public List<EstateSettings> LoadEstateSettingsAll() 390 public List<EstateSettings> LoadEstateSettingsAll()
391 { 391 {
392 List<EstateSettings> estateSettings = new List<EstateSettings>(); 392 List<EstateSettings> estateSettings = new List<EstateSettings>();
393 393
394 List<int> estateIds = GetEstatesAll(); 394 List<int> estateIds = GetEstatesAll();
395 foreach (int estateId in estateIds) 395 foreach (int estateId in estateIds)
396 estateSettings.Add(LoadEstateSettings(estateId)); 396 estateSettings.Add(LoadEstateSettings(estateId));
397 397
398 return estateSettings; 398 return estateSettings;
399 } 399 }
400 400
@@ -421,7 +421,7 @@ namespace OpenSim.Data.SQLite
421 421
422 return result; 422 return result;
423 } 423 }
424 424
425 public List<int> GetEstatesAll() 425 public List<int> GetEstatesAll()
426 { 426 {
427 List<int> result = new List<int>(); 427 List<int> result = new List<int>();
@@ -442,7 +442,7 @@ namespace OpenSim.Data.SQLite
442 } 442 }
443 r.Close(); 443 r.Close();
444 444
445 return result; 445 return result;
446 } 446 }
447 447
448 public List<int> GetEstatesByOwner(UUID ownerID) 448 public List<int> GetEstatesByOwner(UUID ownerID)
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
index 9fbeb10..a4b84b1 100644
--- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
+++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
@@ -189,7 +189,7 @@ namespace OpenSim.Data.SQLite
189 m_Fields[name].SetValue(row, reader[name]); 189 m_Fields[name].SetValue(row, reader[name]);
190 } 190 }
191 } 191 }
192 192
193 if (m_DataField != null) 193 if (m_DataField != null)
194 { 194 {
195 Dictionary<string, string> data = 195 Dictionary<string, string> data =
@@ -268,7 +268,7 @@ namespace OpenSim.Data.SQLite
268 public virtual bool Delete(string field, string key) 268 public virtual bool Delete(string field, string key)
269 { 269 {
270 return Delete(new string[] { field }, new string[] { key }); 270 return Delete(new string[] { field }, new string[] { key });
271 } 271 }
272 272
273 public virtual bool Delete(string[] fields, string[] keys) 273 public virtual bool Delete(string[] fields, string[] keys)
274 { 274 {
diff --git a/OpenSim/Data/SQLite/SQLiteGridUserData.cs b/OpenSim/Data/SQLite/SQLiteGridUserData.cs
index d8c52f8..987240c 100644
--- a/OpenSim/Data/SQLite/SQLiteGridUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteGridUserData.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLite
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 public SQLiteGridUserData(string connectionString, string realm) 46 public SQLiteGridUserData(string connectionString, string realm)
47 : base(connectionString, realm, "GridUserStore") {} 47 : base(connectionString, realm, "GridUserStore") {}
48 48
49 public new GridUserData Get(string userID) 49 public new GridUserData Get(string userID)
diff --git a/OpenSim/Data/SQLite/SQLiteHGTravelData.cs b/OpenSim/Data/SQLite/SQLiteHGTravelData.cs
index db288b2..dd34710 100644
--- a/OpenSim/Data/SQLite/SQLiteHGTravelData.cs
+++ b/OpenSim/Data/SQLite/SQLiteHGTravelData.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite
44 { 44 {
45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 public SQLiteHGTravelData(string connectionString, string realm) 47 public SQLiteHGTravelData(string connectionString, string realm)
48 : base(connectionString, realm, "HGTravelStore") {} 48 : base(connectionString, realm, "HGTravelStore") {}
49 49
50 public HGTravelingData Get(UUID sessionID) 50 public HGTravelingData Get(UUID sessionID)
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
deleted file mode 100644
index 7caf347..0000000
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ /dev/null
@@ -1,916 +0,0 @@
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 OpenSimulator 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.Reflection;
32using log4net;
33#if CSharpSqlite
34 using Community.CsharpSqlite.Sqlite;
35#else
36 using Mono.Data.Sqlite;
37#endif
38using OpenMetaverse;
39using OpenSim.Framework;
40
41namespace OpenSim.Data.SQLite
42{
43 /// <summary>
44 /// An Inventory Interface to the SQLite database
45 /// </summary>
46 public class SQLiteInventoryStore : SQLiteUtil, IInventoryDataPlugin
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 private const string invItemsSelect = "select * from inventoryitems";
51 private const string invFoldersSelect = "select * from inventoryfolders";
52
53 private static SqliteConnection conn;
54 private static DataSet ds;
55 private static SqliteDataAdapter invItemsDa;
56 private static SqliteDataAdapter invFoldersDa;
57
58 private static bool m_Initialized = false;
59
60 public void Initialise()
61 {
62 m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
63 throw new PluginNotInitialisedException(Name);
64 }
65
66 /// <summary>
67 /// <list type="bullet">
68 /// <item>Initialises Inventory interface</item>
69 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
70 /// <item>use default URI if connect string string is empty.</item>
71 /// </list>
72 /// </summary>
73 /// <param name="dbconnect">connect string</param>
74 public void Initialise(string dbconnect)
75 {
76 if (!m_Initialized)
77 {
78 m_Initialized = true;
79
80 if (Util.IsWindows())
81 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
82
83 if (dbconnect == string.Empty)
84 {
85 dbconnect = "URI=file:../db/inventoryStore.db,version=3";
86 }
87 m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect);
88 conn = new SqliteConnection(dbconnect);
89
90 conn.Open();
91
92 Assembly assem = GetType().Assembly;
93 Migration m = new Migration(conn, assem, "InventoryStore");
94 m.Update();
95
96 SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
97 invItemsDa = new SqliteDataAdapter(itemsSelectCmd);
98 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
99
100 SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn);
101 invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
102
103 ds = new DataSet();
104
105 ds.Tables.Add(createInventoryFoldersTable());
106 invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
107 setupFoldersCommands(invFoldersDa, conn);
108 CreateDataSetMapping(invFoldersDa, "inventoryfolders");
109 m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
110
111 ds.Tables.Add(createInventoryItemsTable());
112 invItemsDa.Fill(ds.Tables["inventoryitems"]);
113 setupItemsCommands(invItemsDa, conn);
114 CreateDataSetMapping(invItemsDa, "inventoryitems");
115 m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
116
117 ds.AcceptChanges();
118 }
119 }
120
121 /// <summary>
122 /// Closes the inventory interface
123 /// </summary>
124 public void Dispose()
125 {
126 if (conn != null)
127 {
128 conn.Close();
129 conn = null;
130 }
131 if (invItemsDa != null)
132 {
133 invItemsDa.Dispose();
134 invItemsDa = null;
135 }
136 if (invFoldersDa != null)
137 {
138 invFoldersDa.Dispose();
139 invFoldersDa = null;
140 }
141 if (ds != null)
142 {
143 ds.Dispose();
144 ds = null;
145 }
146 }
147
148 /// <summary>
149 ///
150 /// </summary>
151 /// <param name="row"></param>
152 /// <returns></returns>
153 public InventoryItemBase buildItem(DataRow row)
154 {
155 InventoryItemBase item = new InventoryItemBase();
156 item.ID = new UUID((string) row["UUID"]);
157 item.AssetID = new UUID((string) row["assetID"]);
158 item.AssetType = Convert.ToInt32(row["assetType"]);
159 item.InvType = Convert.ToInt32(row["invType"]);
160 item.Folder = new UUID((string) row["parentFolderID"]);
161 item.Owner = new UUID((string) row["avatarID"]);
162 item.CreatorIdentification = (string)row["creatorsID"];
163 item.Name = (string) row["inventoryName"];
164 item.Description = (string) row["inventoryDescription"];
165
166 item.NextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]);
167 item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]);
168 item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]);
169 item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]);
170 item.GroupPermissions = Convert.ToUInt32(row["inventoryGroupPermissions"]);
171
172 // new fields
173 if (!Convert.IsDBNull(row["salePrice"]))
174 item.SalePrice = Convert.ToInt32(row["salePrice"]);
175
176 if (!Convert.IsDBNull(row["saleType"]))
177 item.SaleType = Convert.ToByte(row["saleType"]);
178
179 if (!Convert.IsDBNull(row["creationDate"]))
180 item.CreationDate = Convert.ToInt32(row["creationDate"]);
181
182 if (!Convert.IsDBNull(row["groupID"]))
183 item.GroupID = new UUID((string)row["groupID"]);
184
185 if (!Convert.IsDBNull(row["groupOwned"]))
186 item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
187
188 if (!Convert.IsDBNull(row["Flags"]))
189 item.Flags = Convert.ToUInt32(row["Flags"]);
190
191 return item;
192 }
193
194 /// <summary>
195 /// Fill a database row with item data
196 /// </summary>
197 /// <param name="row"></param>
198 /// <param name="item"></param>
199 private static void fillItemRow(DataRow row, InventoryItemBase item)
200 {
201 row["UUID"] = item.ID.ToString();
202 row["assetID"] = item.AssetID.ToString();
203 row["assetType"] = item.AssetType;
204 row["invType"] = item.InvType;
205 row["parentFolderID"] = item.Folder.ToString();
206 row["avatarID"] = item.Owner.ToString();
207 row["creatorsID"] = item.CreatorIdentification.ToString();
208 row["inventoryName"] = item.Name;
209 row["inventoryDescription"] = item.Description;
210
211 row["inventoryNextPermissions"] = item.NextPermissions;
212 row["inventoryCurrentPermissions"] = item.CurrentPermissions;
213 row["inventoryBasePermissions"] = item.BasePermissions;
214 row["inventoryEveryOnePermissions"] = item.EveryOnePermissions;
215 row["inventoryGroupPermissions"] = item.GroupPermissions;
216
217 // new fields
218 row["salePrice"] = item.SalePrice;
219 row["saleType"] = item.SaleType;
220 row["creationDate"] = item.CreationDate;
221 row["groupID"] = item.GroupID.ToString();
222 row["groupOwned"] = item.GroupOwned;
223 row["flags"] = item.Flags;
224 }
225
226 /// <summary>
227 /// Add inventory folder
228 /// </summary>
229 /// <param name="folder">Folder base</param>
230 /// <param name="add">true=create folder. false=update existing folder</param>
231 /// <remarks>nasty</remarks>
232 private void addFolder(InventoryFolderBase folder, bool add)
233 {
234 lock (ds)
235 {
236 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
237
238 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
239 if (inventoryRow == null)
240 {
241 if (! add)
242 m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existent inventory folder: {0}", folder.ID);
243
244 inventoryRow = inventoryFolderTable.NewRow();
245 fillFolderRow(inventoryRow, folder);
246 inventoryFolderTable.Rows.Add(inventoryRow);
247 }
248 else
249 {
250 if (add)
251 m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.ID);
252
253 fillFolderRow(inventoryRow, folder);
254 }
255
256 invFoldersDa.Update(ds, "inventoryfolders");
257 }
258 }
259
260 /// <summary>
261 /// Move an inventory folder
262 /// </summary>
263 /// <param name="folder">folder base</param>
264 private void moveFolder(InventoryFolderBase folder)
265 {
266 lock (ds)
267 {
268 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
269
270 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
271 if (inventoryRow == null)
272 {
273 inventoryRow = inventoryFolderTable.NewRow();
274 fillFolderRow(inventoryRow, folder);
275 inventoryFolderTable.Rows.Add(inventoryRow);
276 }
277 else
278 {
279 moveFolderRow(inventoryRow, folder);
280 }
281
282 invFoldersDa.Update(ds, "inventoryfolders");
283 }
284 }
285
286 /// <summary>
287 /// add an item in inventory
288 /// </summary>
289 /// <param name="item">the item</param>
290 /// <param name="add">true=add item ; false=update existing item</param>
291 private void addItem(InventoryItemBase item, bool add)
292 {
293 lock (ds)
294 {
295 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
296
297 DataRow inventoryRow = inventoryItemTable.Rows.Find(item.ID.ToString());
298 if (inventoryRow == null)
299 {
300 if (!add)
301 m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existent inventory item: {0}", item.ID);
302
303 inventoryRow = inventoryItemTable.NewRow();
304 fillItemRow(inventoryRow, item);
305 inventoryItemTable.Rows.Add(inventoryRow);
306 }
307 else
308 {
309 if (add)
310 m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID);
311
312 fillItemRow(inventoryRow, item);
313 }
314
315 invItemsDa.Update(ds, "inventoryitems");
316
317 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
318
319 inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString());
320 if (inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either.
321 inventoryRow["version"] = (int)inventoryRow["version"] + 1;
322
323 invFoldersDa.Update(ds, "inventoryfolders");
324 }
325 }
326
327 /// <summary>
328 /// TODO : DataSet commit
329 /// </summary>
330 public void Shutdown()
331 {
332 // TODO: DataSet commit
333 }
334
335 /// <summary>
336 /// The name of this DB provider
337 /// </summary>
338 /// <returns>Name of DB provider</returns>
339 public string Name
340 {
341 get { return "SQLite Inventory Data Interface"; }
342 }
343
344 /// <summary>
345 /// Returns the version of this DB provider
346 /// </summary>
347 /// <returns>A string containing the DB provider version</returns>
348 public string Version
349 {
350 get
351 {
352 Module module = GetType().Module;
353 // string dllName = module.Assembly.ManifestModule.Name;
354 Version dllVersion = module.Assembly.GetName().Version;
355
356
357 return
358 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
359 dllVersion.Revision);
360 }
361 }
362
363 /// <summary>
364 /// Returns a list of inventory items contained within the specified folder
365 /// </summary>
366 /// <param name="folderID">The UUID of the target folder</param>
367 /// <returns>A List of InventoryItemBase items</returns>
368 public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
369 {
370 lock (ds)
371 {
372 List<InventoryItemBase> retval = new List<InventoryItemBase>();
373 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
374 string selectExp = "parentFolderID = '" + folderID + "'";
375 DataRow[] rows = inventoryItemTable.Select(selectExp);
376 foreach (DataRow row in rows)
377 {
378 retval.Add(buildItem(row));
379 }
380
381 return retval;
382 }
383 }
384
385 /// <summary>
386 /// Returns a list of the root folders within a users inventory
387 /// </summary>
388 /// <param name="user">The user whos inventory is to be searched</param>
389 /// <returns>A list of folder objects</returns>
390 public List<InventoryFolderBase> getUserRootFolders(UUID user)
391 {
392 return new List<InventoryFolderBase>();
393 }
394
395 // see InventoryItemBase.getUserRootFolder
396 public InventoryFolderBase getUserRootFolder(UUID user)
397 {
398 lock (ds)
399 {
400 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
401 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
402 string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'";
403 DataRow[] rows = inventoryFolderTable.Select(selectExp);
404 foreach (DataRow row in rows)
405 {
406 folders.Add(buildFolder(row));
407 }
408
409 // There should only ever be one root folder for a user. However, if there's more
410 // than one we'll simply use the first one rather than failing. It would be even
411 // nicer to print some message to this effect, but this feels like it's too low a
412 // to put such a message out, and it's too minor right now to spare the time to
413 // suitably refactor.
414 if (folders.Count > 0)
415 {
416 return folders[0];
417 }
418
419 return null;
420 }
421 }
422
423 /// <summary>
424 /// Append a list of all the child folders of a parent folder
425 /// </summary>
426 /// <param name="folders">list where folders will be appended</param>
427 /// <param name="parentID">ID of parent</param>
428 protected void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
429 {
430 lock (ds)
431 {
432 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
433 string selectExp = "parentID = '" + parentID + "'";
434 DataRow[] rows = inventoryFolderTable.Select(selectExp);
435 foreach (DataRow row in rows)
436 {
437 folders.Add(buildFolder(row));
438 }
439
440 }
441 }
442
443 /// <summary>
444 /// Returns a list of inventory folders contained in the folder 'parentID'
445 /// </summary>
446 /// <param name="parentID">The folder to get subfolders for</param>
447 /// <returns>A list of inventory folders</returns>
448 public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
449 {
450 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
451 getInventoryFolders(ref folders, parentID);
452 return folders;
453 }
454
455 /// <summary>
456 /// See IInventoryDataPlugin
457 /// </summary>
458 /// <param name="parentID"></param>
459 /// <returns></returns>
460 public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
461 {
462 /* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one
463 * - We will only need to hit the database twice instead of n times.
464 * - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned
465 * by the same person, each user only has 1 inventory heirarchy
466 * - The returned list is not ordered, instead of breadth-first ordered
467 There are basically 2 usage cases for getFolderHeirarchy:
468 1) Getting the user's entire inventory heirarchy when they log in
469 2) Finding a subfolder heirarchy to delete when emptying the trash.
470 This implementation will pull all inventory folders from the database, and then prune away any folder that
471 is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the
472 database than to make n requests. This pays off only if requested heirarchy is large.
473 By making this choice, we are making the worst case better at the cost of making the best case worse
474 - Francis
475 */
476
477 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
478 DataRow[] folderRows = null, parentRow;
479 InventoryFolderBase parentFolder = null;
480 lock (ds)
481 {
482 /* Fetch the parent folder from the database to determine the agent ID.
483 * Then fetch all inventory folders for that agent from the agent ID.
484 */
485 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
486 string selectExp = "UUID = '" + parentID + "'";
487 parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result
488 if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
489 {
490 parentFolder = buildFolder(parentRow[0]);
491 UUID agentID = parentFolder.Owner;
492 selectExp = "agentID = '" + agentID + "'";
493 folderRows = inventoryFolderTable.Select(selectExp);
494 }
495
496 if (folderRows != null && folderRows.GetLength(0) >= 1) // No result means parent folder does not exist
497 { // or has no children
498 /* if we're querying the root folder, just return an unordered list of all folders in the user's
499 * inventory
500 */
501 if (parentFolder.ParentID == UUID.Zero)
502 {
503 foreach (DataRow row in folderRows)
504 {
505 InventoryFolderBase curFolder = buildFolder(row);
506 if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy
507 folders.Add(buildFolder(row));
508 }
509 } // If requesting root folder
510 /* else we are querying a non-root folder. We currently have a list of all of the user's folders,
511 * we must construct a list of all folders in the heirarchy below parentID.
512 * Our first step will be to construct a hash table of all folders, indexed by parent ID.
513 * Once we have constructed the hash table, we will do a breadth-first traversal on the tree using the
514 * hash table to find child folders.
515 */
516 else
517 { // Querying a non-root folder
518
519 // Build a hash table of all user's inventory folders, indexed by each folder's parent ID
520 Dictionary<UUID, List<InventoryFolderBase>> hashtable =
521 new Dictionary<UUID, List<InventoryFolderBase>>(folderRows.GetLength(0));
522
523 foreach (DataRow row in folderRows)
524 {
525 InventoryFolderBase curFolder = buildFolder(row);
526 if (curFolder.ParentID != UUID.Zero) // Discard root of tree - not needed
527 {
528 if (hashtable.ContainsKey(curFolder.ParentID))
529 {
530 // Current folder already has a sibling - append to sibling list
531 hashtable[curFolder.ParentID].Add(curFolder);
532 }
533 else
534 {
535 List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>();
536 siblingList.Add(curFolder);
537 // Current folder has no known (yet) siblings
538 hashtable.Add(curFolder.ParentID, siblingList);
539 }
540 }
541 } // For all inventory folders
542
543 // Note: Could release the ds lock here - we don't access folderRows or the database anymore.
544 // This is somewhat of a moot point as the callers of this function usually lock db anyways.
545
546 if (hashtable.ContainsKey(parentID)) // if requested folder does have children
547 folders.AddRange(hashtable[parentID]);
548
549 // BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static
550 for (int i = 0; i < folders.Count; i++)
551 if (hashtable.ContainsKey(folders[i].ID))
552 folders.AddRange(hashtable[folders[i].ID]);
553
554 } // if requesting a subfolder heirarchy
555 } // if folder parentID exists and has children
556 } // lock ds
557 return folders;
558 }
559
560 /// <summary>
561 /// Returns an inventory item by its UUID
562 /// </summary>
563 /// <param name="item">The UUID of the item to be returned</param>
564 /// <returns>A class containing item information</returns>
565 public InventoryItemBase getInventoryItem(UUID item)
566 {
567 lock (ds)
568 {
569 DataRow row = ds.Tables["inventoryitems"].Rows.Find(item.ToString());
570 if (row != null)
571 {
572 return buildItem(row);
573 }
574 else
575 {
576 return null;
577 }
578 }
579 }
580
581 /// <summary>
582 /// Returns a specified inventory folder by its UUID
583 /// </summary>
584 /// <param name="folder">The UUID of the folder to be returned</param>
585 /// <returns>A class containing folder information</returns>
586 public InventoryFolderBase getInventoryFolder(UUID folder)
587 {
588 // TODO: Deep voodoo here. If you enable this code then
589 // multi region breaks. No idea why, but I figured it was
590 // better to leave multi region at this point. It does mean
591 // that you don't get to see system textures why creating
592 // clothes and the like. :(
593 lock (ds)
594 {
595 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder.ToString());
596 if (row != null)
597 {
598 return buildFolder(row);
599 }
600 else
601 {
602 return null;
603 }
604 }
605 }
606
607 /// <summary>
608 /// Creates a new inventory item based on item
609 /// </summary>
610 /// <param name="item">The item to be created</param>
611 public void addInventoryItem(InventoryItemBase item)
612 {
613 addItem(item, true);
614 }
615
616 /// <summary>
617 /// Updates an inventory item with item (updates based on ID)
618 /// </summary>
619 /// <param name="item">The updated item</param>
620 public void updateInventoryItem(InventoryItemBase item)
621 {
622 addItem(item, false);
623 }
624
625 /// <summary>
626 /// Delete an inventory item
627 /// </summary>
628 /// <param name="item">The item UUID</param>
629 public void deleteInventoryItem(UUID itemID)
630 {
631 lock (ds)
632 {
633 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
634
635 DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID.ToString());
636 if (inventoryRow != null)
637 {
638 inventoryRow.Delete();
639 }
640
641 invItemsDa.Update(ds, "inventoryitems");
642 }
643 }
644
645 public InventoryItemBase queryInventoryItem(UUID itemID)
646 {
647 return getInventoryItem(itemID);
648 }
649
650 public InventoryFolderBase queryInventoryFolder(UUID folderID)
651 {
652 return getInventoryFolder(folderID);
653 }
654
655 /// <summary>
656 /// Delete all items in the specified folder
657 /// </summary>
658 /// <param name="folderId">id of the folder, whose item content should be deleted</param>
659 /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo>
660 private void deleteItemsInFolder(UUID folderId)
661 {
662 List<InventoryItemBase> items = getInventoryInFolder(folderId);
663
664 foreach (InventoryItemBase i in items)
665 deleteInventoryItem(i.ID);
666 }
667
668 /// <summary>
669 /// Adds a new folder specified by folder
670 /// </summary>
671 /// <param name="folder">The inventory folder</param>
672 public void addInventoryFolder(InventoryFolderBase folder)
673 {
674 addFolder(folder, true);
675 }
676
677 /// <summary>
678 /// Updates a folder based on its ID with folder
679 /// </summary>
680 /// <param name="folder">The inventory folder</param>
681 public void updateInventoryFolder(InventoryFolderBase folder)
682 {
683 addFolder(folder, false);
684 }
685
686 /// <summary>
687 /// Moves a folder based on its ID with folder
688 /// </summary>
689 /// <param name="folder">The inventory folder</param>
690 public void moveInventoryFolder(InventoryFolderBase folder)
691 {
692 moveFolder(folder);
693 }
694
695 /// <summary>
696 /// Delete a folder
697 /// </summary>
698 /// <remarks>
699 /// This will clean-up any child folders and child items as well
700 /// </remarks>
701 /// <param name="folderID">the folder UUID</param>
702 public void deleteInventoryFolder(UUID folderID)
703 {
704 lock (ds)
705 {
706 List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
707
708 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
709 DataRow inventoryRow;
710
711 //Delete all sub-folders
712 foreach (InventoryFolderBase f in subFolders)
713 {
714 inventoryRow = inventoryFolderTable.Rows.Find(f.ID.ToString());
715 if (inventoryRow != null)
716 {
717 deleteItemsInFolder(f.ID);
718 inventoryRow.Delete();
719 }
720 }
721
722 //Delete the actual row
723 inventoryRow = inventoryFolderTable.Rows.Find(folderID.ToString());
724 if (inventoryRow != null)
725 {
726 deleteItemsInFolder(folderID);
727 inventoryRow.Delete();
728 }
729
730 invFoldersDa.Update(ds, "inventoryfolders");
731 }
732 }
733
734 /***********************************************************************
735 *
736 * Data Table definitions
737 *
738 **********************************************************************/
739
740 protected void CreateDataSetMapping(IDataAdapter da, string tableName)
741 {
742 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
743 foreach (DataColumn col in ds.Tables[tableName].Columns)
744 {
745 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
746 }
747 }
748
749 /// <summary>
750 /// Create the "inventoryitems" table
751 /// </summary>
752 private static DataTable createInventoryItemsTable()
753 {
754 DataTable inv = new DataTable("inventoryitems");
755
756 createCol(inv, "UUID", typeof (String)); //inventoryID
757 createCol(inv, "assetID", typeof (String));
758 createCol(inv, "assetType", typeof (Int32));
759 createCol(inv, "invType", typeof (Int32));
760 createCol(inv, "parentFolderID", typeof (String));
761 createCol(inv, "avatarID", typeof (String));
762 createCol(inv, "creatorsID", typeof (String));
763
764 createCol(inv, "inventoryName", typeof (String));
765 createCol(inv, "inventoryDescription", typeof (String));
766 // permissions
767 createCol(inv, "inventoryNextPermissions", typeof (Int32));
768 createCol(inv, "inventoryCurrentPermissions", typeof (Int32));
769 createCol(inv, "inventoryBasePermissions", typeof (Int32));
770 createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
771 createCol(inv, "inventoryGroupPermissions", typeof (Int32));
772
773 // sale info
774 createCol(inv, "salePrice", typeof(Int32));
775 createCol(inv, "saleType", typeof(Byte));
776
777 // creation date
778 createCol(inv, "creationDate", typeof(Int32));
779
780 // group info
781 createCol(inv, "groupID", typeof(String));
782 createCol(inv, "groupOwned", typeof(Boolean));
783
784 // Flags
785 createCol(inv, "flags", typeof(UInt32));
786
787 inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] };
788 return inv;
789 }
790
791 /// <summary>
792 /// Creates the "inventoryfolders" table
793 /// </summary>
794 /// <returns></returns>
795 private static DataTable createInventoryFoldersTable()
796 {
797 DataTable fol = new DataTable("inventoryfolders");
798
799 createCol(fol, "UUID", typeof (String)); //folderID
800 createCol(fol, "name", typeof (String));
801 createCol(fol, "agentID", typeof (String));
802 createCol(fol, "parentID", typeof (String));
803 createCol(fol, "type", typeof (Int32));
804 createCol(fol, "version", typeof (Int32));
805
806 fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]};
807 return fol;
808 }
809
810 /// <summary>
811 ///
812 /// </summary>
813 /// <param name="da"></param>
814 /// <param name="conn"></param>
815 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
816 {
817 lock (ds)
818 {
819 da.InsertCommand = createInsertCommand("inventoryitems", ds.Tables["inventoryitems"]);
820 da.InsertCommand.Connection = conn;
821
822 da.UpdateCommand = createUpdateCommand("inventoryitems", "UUID=:UUID", ds.Tables["inventoryitems"]);
823 da.UpdateCommand.Connection = conn;
824
825 SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
826 delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
827 delete.Connection = conn;
828 da.DeleteCommand = delete;
829 }
830 }
831
832 /// <summary>
833 ///
834 /// </summary>
835 /// <param name="da"></param>
836 /// <param name="conn"></param>
837 private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
838 {
839 lock (ds)
840 {
841 da.InsertCommand = createInsertCommand("inventoryfolders", ds.Tables["inventoryfolders"]);
842 da.InsertCommand.Connection = conn;
843
844 da.UpdateCommand = createUpdateCommand("inventoryfolders", "UUID=:UUID", ds.Tables["inventoryfolders"]);
845 da.UpdateCommand.Connection = conn;
846
847 SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
848 delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
849 delete.Connection = conn;
850 da.DeleteCommand = delete;
851 }
852 }
853
854 /// <summary>
855 ///
856 /// </summary>
857 /// <param name="row"></param>
858 /// <returns></returns>
859 private static InventoryFolderBase buildFolder(DataRow row)
860 {
861 InventoryFolderBase folder = new InventoryFolderBase();
862 folder.ID = new UUID((string) row["UUID"]);
863 folder.Name = (string) row["name"];
864 folder.Owner = new UUID((string) row["agentID"]);
865 folder.ParentID = new UUID((string) row["parentID"]);
866 folder.Type = Convert.ToInt16(row["type"]);
867 folder.Version = Convert.ToUInt16(row["version"]);
868 return folder;
869 }
870
871 /// <summary>
872 ///
873 /// </summary>
874 /// <param name="row"></param>
875 /// <param name="folder"></param>
876 private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
877 {
878 row["UUID"] = folder.ID.ToString();
879 row["name"] = folder.Name;
880 row["agentID"] = folder.Owner.ToString();
881 row["parentID"] = folder.ParentID.ToString();
882 row["type"] = folder.Type;
883 row["version"] = folder.Version;
884 }
885
886 /// <summary>
887 ///
888 /// </summary>
889 /// <param name="row"></param>
890 /// <param name="folder"></param>
891 private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
892 {
893 row["UUID"] = folder.ID.ToString();
894 row["parentID"] = folder.ParentID.ToString();
895 }
896
897 public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
898 {
899 lock (ds)
900 {
901 List<InventoryItemBase> items = new List<InventoryItemBase>();
902
903 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
904 string selectExp
905 = "avatarID = '" + avatarID + "' AND assetType = " + (int)AssetType.Gesture + " AND flags = 1";
906 //m_log.DebugFormat("[SQL]: sql = " + selectExp);
907 DataRow[] rows = inventoryItemTable.Select(selectExp);
908 foreach (DataRow row in rows)
909 {
910 items.Add(buildItem(row));
911 }
912 return items;
913 }
914 }
915 }
916}
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 6ed3d40..19880de 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -707,7 +707,7 @@ namespace OpenSim.Data.SQLite
707 DataRow[] primsForRegion = prims.Select(byRegion); 707 DataRow[] primsForRegion = prims.Select(byRegion);
708// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 708// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
709 709
710 // First, create all groups 710 // First, create all groups
711 foreach (DataRow primRow in primsForRegion) 711 foreach (DataRow primRow in primsForRegion)
712 { 712 {
713 try 713 try
@@ -733,12 +733,12 @@ namespace OpenSim.Data.SQLite
733 } 733 }
734 734
735 SceneObjectGroup group = new SceneObjectGroup(prim); 735 SceneObjectGroup group = new SceneObjectGroup(prim);
736 736
737 createdObjects.Add(group.UUID, group); 737 createdObjects.Add(group.UUID, group);
738 retvals.Add(group); 738 retvals.Add(group);
739 LoadItems(prim); 739 LoadItems(prim);
740 740
741 741
742 } 742 }
743 } 743 }
744 catch (Exception e) 744 catch (Exception e)
@@ -827,7 +827,7 @@ namespace OpenSim.Data.SQLite
827 } 827 }
828 828
829 /// <summary> 829 /// <summary>
830 /// Store a terrain revision in region storage 830 /// Store a terrain in region storage
831 /// </summary> 831 /// </summary>
832 /// <param name="ter">terrain heightfield</param> 832 /// <param name="ter">terrain heightfield</param>
833 /// <param name="regionID">region UUID</param> 833 /// <param name="regionID">region UUID</param>
@@ -851,7 +851,44 @@ namespace OpenSim.Data.SQLite
851 Array terrainDBblob; 851 Array terrainDBblob;
852 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); 852 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
853 853
854 m_log.DebugFormat("{0} Storing terrain revision r {1}", LogHeader, terrainDBRevision); 854 m_log.DebugFormat("{0} Storing terrain format {1}", LogHeader, terrainDBRevision);
855
856 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
857 {
858 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
859 cmd.Parameters.Add(new SqliteParameter(":Revision", terrainDBRevision));
860 cmd.Parameters.Add(new SqliteParameter(":Heightfield", terrainDBblob));
861 cmd.ExecuteNonQuery();
862 }
863 }
864 }
865
866 /// <summary>
867 /// Store baked terrain in region storage
868 /// </summary>
869 /// <param name="ter">terrain heightfield</param>
870 /// <param name="regionID">region UUID</param>
871 public void StoreBakedTerrain(TerrainData terrData, UUID regionID)
872 {
873 lock (ds)
874 {
875 using (
876 SqliteCommand cmd = new SqliteCommand("delete from bakedterrain where RegionUUID=:RegionUUID", m_conn))
877 {
878 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
879 cmd.ExecuteNonQuery();
880 }
881
882 // the following is an work around for .NET. The perf
883 // issues associated with it aren't as bad as you think.
884 String sql = "insert into bakedterrain(RegionUUID, Revision, Heightfield)" +
885 " values(:RegionUUID, :Revision, :Heightfield)";
886
887 int terrainDBRevision;
888 Array terrainDBblob;
889 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
890
891 m_log.DebugFormat("{0} Storing bakedterrain format {1}", LogHeader, terrainDBRevision);
855 892
856 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) 893 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
857 { 894 {
@@ -913,6 +950,34 @@ namespace OpenSim.Data.SQLite
913 return terrData; 950 return terrData;
914 } 951 }
915 952
953 public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
954 {
955 TerrainData terrData = null;
956
957 lock (ds)
958 {
959 String sql = "select RegionUUID, Revision, Heightfield from bakedterrain" +
960 " where RegionUUID=:RegionUUID";
961
962 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
963 {
964 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
965
966 using (IDataReader row = cmd.ExecuteReader())
967 {
968 int rev = 0;
969 if (row.Read())
970 {
971 rev = Convert.ToInt32(row["Revision"]);
972 byte[] blob = (byte[])row["Heightfield"];
973 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
974 }
975 }
976 }
977 }
978 return terrData;
979 }
980
916 public void RemoveLandObject(UUID globalID) 981 public void RemoveLandObject(UUID globalID)
917 { 982 {
918 lock (ds) 983 lock (ds)
@@ -1151,6 +1216,7 @@ namespace OpenSim.Data.SQLite
1151 createCol(prims, "OwnerID", typeof(String)); 1216 createCol(prims, "OwnerID", typeof(String));
1152 createCol(prims, "GroupID", typeof(String)); 1217 createCol(prims, "GroupID", typeof(String));
1153 createCol(prims, "LastOwnerID", typeof(String)); 1218 createCol(prims, "LastOwnerID", typeof(String));
1219 createCol(prims, "RezzerID", typeof(String));
1154 createCol(prims, "OwnerMask", typeof(Int32)); 1220 createCol(prims, "OwnerMask", typeof(Int32));
1155 createCol(prims, "NextOwnerMask", typeof(Int32)); 1221 createCol(prims, "NextOwnerMask", typeof(Int32));
1156 createCol(prims, "GroupMask", typeof(Int32)); 1222 createCol(prims, "GroupMask", typeof(Int32));
@@ -1232,7 +1298,7 @@ namespace OpenSim.Data.SQLite
1232 createCol(prims, "VolumeDetect", typeof(Int16)); 1298 createCol(prims, "VolumeDetect", typeof(Int16));
1233 1299
1234 createCol(prims, "MediaURL", typeof(String)); 1300 createCol(prims, "MediaURL", typeof(String));
1235 1301
1236 createCol(prims, "AttachedPosX", typeof(Double)); 1302 createCol(prims, "AttachedPosX", typeof(Double));
1237 createCol(prims, "AttachedPosY", typeof(Double)); 1303 createCol(prims, "AttachedPosY", typeof(Double));
1238 createCol(prims, "AttachedPosZ", typeof(Double)); 1304 createCol(prims, "AttachedPosZ", typeof(Double));
@@ -1246,6 +1312,7 @@ namespace OpenSim.Data.SQLite
1246 createCol(prims, "Restitution", typeof(Double)); 1312 createCol(prims, "Restitution", typeof(Double));
1247 1313
1248 createCol(prims, "KeyframeMotion", typeof(Byte[])); 1314 createCol(prims, "KeyframeMotion", typeof(Byte[]));
1315
1249 // Add in contraints 1316 // Add in contraints
1250 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 1317 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
1251 1318
@@ -1353,7 +1420,7 @@ namespace OpenSim.Data.SQLite
1353 createCol(land, "Name", typeof(String)); 1420 createCol(land, "Name", typeof(String));
1354 createCol(land, "Desc", typeof(String)); 1421 createCol(land, "Desc", typeof(String));
1355 createCol(land, "OwnerUUID", typeof(String)); 1422 createCol(land, "OwnerUUID", typeof(String));
1356 createCol(land, "IsGroupOwned", typeof(Boolean)); 1423 createCol(land, "IsGroupOwned", typeof(string));
1357 createCol(land, "Area", typeof(Int32)); 1424 createCol(land, "Area", typeof(Int32));
1358 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented 1425 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented
1359 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory 1426 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
@@ -1386,6 +1453,9 @@ namespace OpenSim.Data.SQLite
1386 createCol(land, "MediaLoop", typeof(Boolean)); 1453 createCol(land, "MediaLoop", typeof(Boolean));
1387 createCol(land, "ObscureMedia", typeof(Boolean)); 1454 createCol(land, "ObscureMedia", typeof(Boolean));
1388 createCol(land, "ObscureMusic", typeof(Boolean)); 1455 createCol(land, "ObscureMusic", typeof(Boolean));
1456 createCol(land, "SeeAVs", typeof(Boolean));
1457 createCol(land, "AnyAVSounds", typeof(Boolean));
1458 createCol(land, "GroupAVSounds", typeof(Boolean));
1389 1459
1390 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; 1460 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
1391 1461
@@ -1610,6 +1680,7 @@ namespace OpenSim.Data.SQLite
1610 prim.OwnerID = new UUID((String)row["OwnerID"]); 1680 prim.OwnerID = new UUID((String)row["OwnerID"]);
1611 prim.GroupID = new UUID((String)row["GroupID"]); 1681 prim.GroupID = new UUID((String)row["GroupID"]);
1612 prim.LastOwnerID = new UUID((String)row["LastOwnerID"]); 1682 prim.LastOwnerID = new UUID((String)row["LastOwnerID"]);
1683 prim.RezzerID = row["RezzerID"] == DBNull.Value ? UUID.Zero : new UUID((String)row["RezzerID"]);
1613 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 1684 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
1614 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 1685 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
1615 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 1686 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -1724,7 +1795,7 @@ namespace OpenSim.Data.SQLite
1724// m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); 1795// m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
1725 prim.MediaUrl = (string)row["MediaURL"]; 1796 prim.MediaUrl = (string)row["MediaURL"];
1726 } 1797 }
1727 1798
1728 prim.AttachedPos = new Vector3( 1799 prim.AttachedPos = new Vector3(
1729 Convert.ToSingle(row["AttachedPosX"]), 1800 Convert.ToSingle(row["AttachedPosX"]),
1730 Convert.ToSingle(row["AttachedPosY"]), 1801 Convert.ToSingle(row["AttachedPosY"]),
@@ -1735,7 +1806,7 @@ namespace OpenSim.Data.SQLite
1735 { 1806 {
1736 //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType()); 1807 //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType());
1737 prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); 1808 prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]);
1738 } 1809 }
1739 else 1810 else
1740 { 1811 {
1741 prim.DynAttrs = new DAMap(); 1812 prim.DynAttrs = new DAMap();
@@ -1747,7 +1818,7 @@ namespace OpenSim.Data.SQLite
1747 prim.Friction = Convert.ToSingle(row["Friction"]); 1818 prim.Friction = Convert.ToSingle(row["Friction"]);
1748 prim.Restitution = Convert.ToSingle(row["Restitution"]); 1819 prim.Restitution = Convert.ToSingle(row["Restitution"]);
1749 1820
1750 1821
1751 if (!(row["KeyframeMotion"] is DBNull)) 1822 if (!(row["KeyframeMotion"] is DBNull))
1752 { 1823 {
1753 Byte[] data = (byte[])row["KeyframeMotion"]; 1824 Byte[] data = (byte[])row["KeyframeMotion"];
@@ -1760,7 +1831,24 @@ namespace OpenSim.Data.SQLite
1760 { 1831 {
1761 prim.KeyframeMotion = null; 1832 prim.KeyframeMotion = null;
1762 } 1833 }
1763 1834
1835 prim.PassCollisions = Convert.ToBoolean(row["PassCollisions"]);
1836 prim.PassTouches = Convert.ToBoolean(row["PassTouches"]);
1837 prim.RotationAxisLocks = Convert.ToByte(row["RotationAxisLocks"]);
1838
1839 SOPVehicle vehicle = null;
1840 if (!(row["Vehicle"] is DBNull) && row["Vehicle"].ToString() != String.Empty)
1841 {
1842 vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
1843 if (vehicle != null)
1844 prim.VehicleParams = vehicle;
1845 }
1846
1847 PhysicsInertiaData pdata = null;
1848 if (!(row["PhysInertia"] is DBNull) && row["PhysInertia"].ToString() != String.Empty)
1849 pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
1850 prim.PhysicsInertia = pdata;
1851
1764 return prim; 1852 return prim;
1765 } 1853 }
1766 1854
@@ -1817,7 +1905,7 @@ namespace OpenSim.Data.SQLite
1817 newData.Name = (String)row["Name"]; 1905 newData.Name = (String)row["Name"];
1818 newData.Description = (String)row["Desc"]; 1906 newData.Description = (String)row["Desc"];
1819 newData.OwnerID = (UUID)(String)row["OwnerUUID"]; 1907 newData.OwnerID = (UUID)(String)row["OwnerUUID"];
1820 newData.IsGroupOwned = (Boolean)row["IsGroupOwned"]; 1908 newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
1821 newData.Area = Convert.ToInt32(row["Area"]); 1909 newData.Area = Convert.ToInt32(row["Area"]);
1822 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 1910 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
1823 newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); 1911 newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
@@ -1845,6 +1933,10 @@ namespace OpenSim.Data.SQLite
1845 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); 1933 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
1846 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); 1934 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
1847 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); 1935 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
1936 newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]);
1937 newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
1938 newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
1939
1848 try 1940 try
1849 { 1941 {
1850 newData.UserLocation = 1942 newData.UserLocation =
@@ -1918,7 +2010,8 @@ namespace OpenSim.Data.SQLite
1918 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); 2010 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
1919 newSettings.TelehubObject = new UUID((String)row["TelehubObject"]); 2011 newSettings.TelehubObject = new UUID((String)row["TelehubObject"]);
1920 newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]); 2012 newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]);
1921 2013 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
2014 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1922 return newSettings; 2015 return newSettings;
1923 } 2016 }
1924 2017
@@ -2013,6 +2106,7 @@ namespace OpenSim.Data.SQLite
2013 return entry; 2106 return entry;
2014 } 2107 }
2015 2108
2109
2016 /// <summary> 2110 /// <summary>
2017 /// 2111 ///
2018 /// </summary> 2112 /// </summary>
@@ -2039,6 +2133,7 @@ namespace OpenSim.Data.SQLite
2039 row["OwnerID"] = prim.OwnerID.ToString(); 2133 row["OwnerID"] = prim.OwnerID.ToString();
2040 row["GroupID"] = prim.GroupID.ToString(); 2134 row["GroupID"] = prim.GroupID.ToString();
2041 row["LastOwnerID"] = prim.LastOwnerID.ToString(); 2135 row["LastOwnerID"] = prim.LastOwnerID.ToString();
2136 row["RezzerID"] = prim.RezzerID.ToString();
2042 row["OwnerMask"] = prim.OwnerMask; 2137 row["OwnerMask"] = prim.OwnerMask;
2043 row["NextOwnerMask"] = prim.NextOwnerMask; 2138 row["NextOwnerMask"] = prim.NextOwnerMask;
2044 row["GroupMask"] = prim.GroupMask; 2139 row["GroupMask"] = prim.GroupMask;
@@ -2137,7 +2232,6 @@ namespace OpenSim.Data.SQLite
2137 // click action 2232 // click action
2138 row["ClickAction"] = prim.ClickAction; 2233 row["ClickAction"] = prim.ClickAction;
2139 2234
2140 row["SalePrice"] = prim.SalePrice;
2141 row["Material"] = prim.Material; 2235 row["Material"] = prim.Material;
2142 2236
2143 row["CollisionSound"] = prim.CollisionSound.ToString(); 2237 row["CollisionSound"] = prim.CollisionSound.ToString();
@@ -2168,8 +2262,21 @@ namespace OpenSim.Data.SQLite
2168 row["KeyframeMotion"] = prim.KeyframeMotion.Serialize(); 2262 row["KeyframeMotion"] = prim.KeyframeMotion.Serialize();
2169 else 2263 else
2170 row["KeyframeMotion"] = new Byte[0]; 2264 row["KeyframeMotion"] = new Byte[0];
2171 2265
2172 2266 row["PassTouches"] = prim.PassTouches;
2267 row["PassCollisions"] = prim.PassCollisions;
2268 row["RotationAxisLocks"] = prim.RotationAxisLocks;
2269
2270 if (prim.VehicleParams != null)
2271 row["Vehicle"] = prim.VehicleParams.ToXml2();
2272 else
2273 row["Vehicle"] = String.Empty;
2274
2275 if (prim.PhysicsInertia != null)
2276 row["PhysInertia"] = prim.PhysicsInertia.ToXml2();
2277 else
2278 row["PhysInertia"] = String.Empty;
2279
2173 } 2280 }
2174 2281
2175 /// <summary> 2282 /// <summary>
@@ -2220,7 +2327,7 @@ namespace OpenSim.Data.SQLite
2220 row["Name"] = land.Name; 2327 row["Name"] = land.Name;
2221 row["Desc"] = land.Description; 2328 row["Desc"] = land.Description;
2222 row["OwnerUUID"] = land.OwnerID.ToString(); 2329 row["OwnerUUID"] = land.OwnerID.ToString();
2223 row["IsGroupOwned"] = land.IsGroupOwned; 2330 row["IsGroupOwned"] = land.IsGroupOwned.ToString();
2224 row["Area"] = land.Area; 2331 row["Area"] = land.Area;
2225 row["AuctionID"] = land.AuctionID; //Unemplemented 2332 row["AuctionID"] = land.AuctionID; //Unemplemented
2226 row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory 2333 row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
@@ -2253,6 +2360,10 @@ namespace OpenSim.Data.SQLite
2253 row["MediaLoop"] = land.MediaLoop; 2360 row["MediaLoop"] = land.MediaLoop;
2254 row["ObscureMusic"] = land.ObscureMusic; 2361 row["ObscureMusic"] = land.ObscureMusic;
2255 row["ObscureMedia"] = land.ObscureMedia; 2362 row["ObscureMedia"] = land.ObscureMedia;
2363 row["SeeAVs"] = land.SeeAVs;
2364 row["AnyAVSounds"] = land.AnyAVSounds;
2365 row["GroupAVSounds"] = land.GroupAVSounds;
2366
2256 } 2367 }
2257 2368
2258 /// <summary> 2369 /// <summary>
@@ -2311,6 +2422,8 @@ namespace OpenSim.Data.SQLite
2311 row["map_tile_ID"] = settings.TerrainImageID.ToString(); 2422 row["map_tile_ID"] = settings.TerrainImageID.ToString();
2312 row["TelehubObject"] = settings.TelehubObject.ToString(); 2423 row["TelehubObject"] = settings.TelehubObject.ToString();
2313 row["parcel_tile_ID"] = settings.ParcelImageID.ToString(); 2424 row["parcel_tile_ID"] = settings.ParcelImageID.ToString();
2425 row["block_search"] = settings.GodBlockSearch;
2426 row["casino"] = settings.Casino;
2314 } 2427 }
2315 2428
2316 /// <summary> 2429 /// <summary>
@@ -2430,7 +2543,7 @@ namespace OpenSim.Data.SQLite
2430 2543
2431 if (!(row["Media"] is System.DBNull)) 2544 if (!(row["Media"] is System.DBNull))
2432 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 2545 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
2433 2546
2434 return s; 2547 return s;
2435 } 2548 }
2436 2549
@@ -2908,6 +3021,10 @@ namespace OpenSim.Data.SQLite
2908 { 3021 {
2909 return DbType.Binary; 3022 return DbType.Binary;
2910 } 3023 }
3024 else if (type == typeof(Boolean))
3025 {
3026 return DbType.Boolean;
3027 }
2911 else 3028 else
2912 { 3029 {
2913 return DbType.String; 3030 return DbType.String;
@@ -2944,6 +3061,11 @@ namespace OpenSim.Data.SQLite
2944 } 3061 }
2945 } 3062 }
2946 3063
3064 public UUID[] GetObjectIDs(UUID regionID)
3065 {
3066 return new UUID[0];
3067 }
3068
2947 public void SaveExtra(UUID regionID, string name, string value) 3069 public void SaveExtra(UUID regionID, string name, string value)
2948 { 3070 {
2949 } 3071 }
diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
index f98d376..1b79185 100644
--- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
@@ -75,12 +75,17 @@ namespace OpenSim.Data.SQLite
75 } 75 }
76 else 76 else
77 { 77 {
78 cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')", 78 cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')",
79 m_Realm, scopeID.ToString(), words[0], words[1]); 79 m_Realm, scopeID.ToString(), words[0], words[1]);
80 } 80 }
81 81
82 return DoQuery(cmd); 82 return DoQuery(cmd);
83 } 83 }
84 } 84 }
85
86 public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
87 {
88 return null;
89 }
85 } 90 }
86} 91}
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
index cd3e8b6..13aac79 100644
--- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
@@ -46,43 +46,43 @@ namespace OpenSim.Data.SQLite
46 { 46 {
47 private static readonly ILog m_log = 47 private static readonly ILog m_log =
48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private SqliteConnection m_connection; 50 private SqliteConnection m_connection;
51 private string m_connectionString; 51 private string m_connectionString;
52 52
53 private Dictionary<string, FieldInfo> m_FieldMap = 53 private Dictionary<string, FieldInfo> m_FieldMap =
54 new Dictionary<string, FieldInfo>(); 54 new Dictionary<string, FieldInfo>();
55 55
56 protected virtual Assembly Assembly 56 protected virtual Assembly Assembly
57 { 57 {
58 get { return GetType().Assembly; } 58 get { return GetType().Assembly; }
59 } 59 }
60 60
61 public SQLiteUserProfilesData() 61 public SQLiteUserProfilesData()
62 { 62 {
63 } 63 }
64 64
65 public SQLiteUserProfilesData(string connectionString) 65 public SQLiteUserProfilesData(string connectionString)
66 { 66 {
67 Initialise(connectionString); 67 Initialise(connectionString);
68 } 68 }
69 69
70 public void Initialise(string connectionString) 70 public void Initialise(string connectionString)
71 { 71 {
72 if (Util.IsWindows()) 72 if (Util.IsWindows())
73 Util.LoadArchSpecificWindowsDll("sqlite3.dll"); 73 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
74 74
75 m_connectionString = connectionString; 75 m_connectionString = connectionString;
76 76
77 m_log.Info("[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString); 77 m_log.Info("[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString);
78 78
79 m_connection = new SqliteConnection(m_connectionString); 79 m_connection = new SqliteConnection(m_connectionString);
80 m_connection.Open(); 80 m_connection.Open();
81 81
82 Migration m = new Migration(m_connection, Assembly, "UserProfiles"); 82 Migration m = new Migration(m_connection, Assembly, "UserProfiles");
83 m.Update(); 83 m.Update();
84 } 84 }
85 85
86 private string[] FieldList 86 private string[] FieldList
87 { 87 {
88 get { return new List<string>(m_FieldMap.Keys).ToArray(); } 88 get { return new List<string>(m_FieldMap.Keys).ToArray(); }
@@ -123,7 +123,7 @@ namespace OpenSim.Data.SQLite
123 } 123 }
124 124
125 reader.Close(); 125 reader.Close();
126 126
127 return data; 127 return data;
128 } 128 }
129 public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) 129 public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
@@ -162,21 +162,21 @@ namespace OpenSim.Data.SQLite
162 query += ":ParcelName,"; 162 query += ":ParcelName,";
163 query += ":Flags,"; 163 query += ":Flags,";
164 query += ":ListingPrice ) "; 164 query += ":ListingPrice ) ";
165 165
166 if(string.IsNullOrEmpty(ad.ParcelName)) 166 if(string.IsNullOrEmpty(ad.ParcelName))
167 ad.ParcelName = "Unknown"; 167 ad.ParcelName = "Unknown";
168 if(ad.ParcelId == null) 168 if(ad.ParcelId == null)
169 ad.ParcelId = UUID.Zero; 169 ad.ParcelId = UUID.Zero;
170 if(string.IsNullOrEmpty(ad.Description)) 170 if(string.IsNullOrEmpty(ad.Description))
171 ad.Description = "No Description"; 171 ad.Description = "No Description";
172 172
173 DateTime epoch = new DateTime(1970, 1, 1); 173 DateTime epoch = new DateTime(1970, 1, 1);
174 DateTime now = DateTime.Now; 174 DateTime now = DateTime.Now;
175 TimeSpan epochnow = now - epoch; 175 TimeSpan epochnow = now - epoch;
176 TimeSpan duration; 176 TimeSpan duration;
177 DateTime expiration; 177 DateTime expiration;
178 TimeSpan epochexp; 178 TimeSpan epochexp;
179 179
180 if(ad.Flags == 2) 180 if(ad.Flags == 2)
181 { 181 {
182 duration = new TimeSpan(7,0,0,0); 182 duration = new TimeSpan(7,0,0,0);
@@ -211,7 +211,7 @@ namespace OpenSim.Data.SQLite
211 cmd.Parameters.AddWithValue(":ParcelName", ad.ParcelName.ToString()); 211 cmd.Parameters.AddWithValue(":ParcelName", ad.ParcelName.ToString());
212 cmd.Parameters.AddWithValue(":Flags", ad.Flags.ToString()); 212 cmd.Parameters.AddWithValue(":Flags", ad.Flags.ToString());
213 cmd.Parameters.AddWithValue(":ListingPrice", ad.Price.ToString ()); 213 cmd.Parameters.AddWithValue(":ListingPrice", ad.Price.ToString ());
214 214
215 cmd.ExecuteNonQuery(); 215 cmd.ExecuteNonQuery();
216 } 216 }
217 } 217 }
@@ -227,17 +227,17 @@ namespace OpenSim.Data.SQLite
227 public bool DeleteClassifiedRecord(UUID recordId) 227 public bool DeleteClassifiedRecord(UUID recordId)
228 { 228 {
229 string query = string.Empty; 229 string query = string.Empty;
230 230
231 query += "DELETE FROM classifieds WHERE "; 231 query += "DELETE FROM classifieds WHERE ";
232 query += "classifieduuid = :ClasifiedId"; 232 query += "classifieduuid = :ClasifiedId";
233 233
234 try 234 try
235 { 235 {
236 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 236 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
237 { 237 {
238 cmd.CommandText = query; 238 cmd.CommandText = query;
239 cmd.Parameters.AddWithValue(":ClassifiedId", recordId.ToString()); 239 cmd.Parameters.AddWithValue(":ClassifiedId", recordId.ToString());
240 240
241 cmd.ExecuteNonQuery(); 241 cmd.ExecuteNonQuery();
242 } 242 }
243 } 243 }
@@ -254,17 +254,17 @@ namespace OpenSim.Data.SQLite
254 { 254 {
255 IDataReader reader = null; 255 IDataReader reader = null;
256 string query = string.Empty; 256 string query = string.Empty;
257 257
258 query += "SELECT * FROM classifieds WHERE "; 258 query += "SELECT * FROM classifieds WHERE ";
259 query += "classifieduuid = :AdId"; 259 query += "classifieduuid = :AdId";
260 260
261 try 261 try
262 { 262 {
263 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 263 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
264 { 264 {
265 cmd.CommandText = query; 265 cmd.CommandText = query;
266 cmd.Parameters.AddWithValue(":AdId", ad.ClassifiedId.ToString()); 266 cmd.Parameters.AddWithValue(":AdId", ad.ClassifiedId.ToString());
267 267
268 using (reader = cmd.ExecuteReader()) 268 using (reader = cmd.ExecuteReader())
269 { 269 {
270 if(reader.Read ()) 270 if(reader.Read ())
@@ -299,24 +299,24 @@ namespace OpenSim.Data.SQLite
299 { 299 {
300 IDataReader reader = null; 300 IDataReader reader = null;
301 string query = string.Empty; 301 string query = string.Empty;
302 302
303 query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; 303 query += "SELECT `pickuuid`,`name` FROM userpicks WHERE ";
304 query += "creatoruuid = :Id"; 304 query += "creatoruuid = :Id";
305 OSDArray data = new OSDArray(); 305 OSDArray data = new OSDArray();
306 306
307 try 307 try
308 { 308 {
309 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 309 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
310 { 310 {
311 cmd.CommandText = query; 311 cmd.CommandText = query;
312 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 312 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
313 313
314 using (reader = cmd.ExecuteReader()) 314 using (reader = cmd.ExecuteReader())
315 { 315 {
316 while (reader.Read()) 316 while (reader.Read())
317 { 317 {
318 OSDMap record = new OSDMap(); 318 OSDMap record = new OSDMap();
319 319
320 record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); 320 record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"]));
321 record.Add("name",OSD.FromString((string)reader["name"])); 321 record.Add("name",OSD.FromString((string)reader["name"]));
322 data.Add(record); 322 data.Add(record);
@@ -336,11 +336,11 @@ namespace OpenSim.Data.SQLite
336 IDataReader reader = null; 336 IDataReader reader = null;
337 string query = string.Empty; 337 string query = string.Empty;
338 UserProfilePick pick = new UserProfilePick(); 338 UserProfilePick pick = new UserProfilePick();
339 339
340 query += "SELECT * FROM userpicks WHERE "; 340 query += "SELECT * FROM userpicks WHERE ";
341 query += "creatoruuid = :CreatorId AND "; 341 query += "creatoruuid = :CreatorId AND ";
342 query += "pickuuid = :PickId"; 342 query += "pickuuid = :PickId";
343 343
344 try 344 try
345 { 345 {
346 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 346 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -348,17 +348,17 @@ namespace OpenSim.Data.SQLite
348 cmd.CommandText = query; 348 cmd.CommandText = query;
349 cmd.Parameters.AddWithValue(":CreatorId", avatarId.ToString()); 349 cmd.Parameters.AddWithValue(":CreatorId", avatarId.ToString());
350 cmd.Parameters.AddWithValue(":PickId", pickId.ToString()); 350 cmd.Parameters.AddWithValue(":PickId", pickId.ToString());
351 351
352 using (reader = cmd.ExecuteReader()) 352 using (reader = cmd.ExecuteReader())
353 { 353 {
354 354
355 while (reader.Read()) 355 while (reader.Read())
356 { 356 {
357 string description = (string)reader["description"]; 357 string description = (string)reader["description"];
358 358
359 if (string.IsNullOrEmpty(description)) 359 if (string.IsNullOrEmpty(description))
360 description = "No description given."; 360 description = "No description given.";
361 361
362 UUID.TryParse((string)reader["pickuuid"], out pick.PickId); 362 UUID.TryParse((string)reader["pickuuid"], out pick.PickId);
363 UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); 363 UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId);
364 UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); 364 UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId);
@@ -385,7 +385,7 @@ namespace OpenSim.Data.SQLite
385 } 385 }
386 386
387 public bool UpdatePicksRecord(UserProfilePick pick) 387 public bool UpdatePicksRecord(UserProfilePick pick)
388 { 388 {
389 string query = string.Empty; 389 string query = string.Empty;
390 390
391 query += "INSERT OR REPLACE INTO userpicks ("; 391 query += "INSERT OR REPLACE INTO userpicks (";
@@ -416,7 +416,7 @@ namespace OpenSim.Data.SQLite
416 query += ":GlobalPos,"; 416 query += ":GlobalPos,";
417 query += ":SortOrder,"; 417 query += ":SortOrder,";
418 query += ":Enabled) "; 418 query += ":Enabled) ";
419 419
420 try 420 try
421 { 421 {
422 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 422 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -456,10 +456,10 @@ namespace OpenSim.Data.SQLite
456 public bool DeletePicksRecord(UUID pickId) 456 public bool DeletePicksRecord(UUID pickId)
457 { 457 {
458 string query = string.Empty; 458 string query = string.Empty;
459 459
460 query += "DELETE FROM userpicks WHERE "; 460 query += "DELETE FROM userpicks WHERE ";
461 query += "pickuuid = :PickId"; 461 query += "pickuuid = :PickId";
462 462
463 try 463 try
464 { 464 {
465 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 465 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -479,15 +479,15 @@ namespace OpenSim.Data.SQLite
479 } 479 }
480 480
481 public bool GetAvatarNotes(ref UserProfileNotes notes) 481 public bool GetAvatarNotes(ref UserProfileNotes notes)
482 { 482 {
483 IDataReader reader = null; 483 IDataReader reader = null;
484 string query = string.Empty; 484 string query = string.Empty;
485 485
486 query += "SELECT `notes` FROM usernotes WHERE "; 486 query += "SELECT `notes` FROM usernotes WHERE ";
487 query += "useruuid = :Id AND "; 487 query += "useruuid = :Id AND ";
488 query += "targetuuid = :TargetId"; 488 query += "targetuuid = :TargetId";
489 OSDArray data = new OSDArray(); 489 OSDArray data = new OSDArray();
490 490
491 try 491 try
492 { 492 {
493 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 493 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -495,7 +495,7 @@ namespace OpenSim.Data.SQLite
495 cmd.CommandText = query; 495 cmd.CommandText = query;
496 cmd.Parameters.AddWithValue(":Id", notes.UserId.ToString()); 496 cmd.Parameters.AddWithValue(":Id", notes.UserId.ToString());
497 cmd.Parameters.AddWithValue(":TargetId", notes.TargetId.ToString()); 497 cmd.Parameters.AddWithValue(":TargetId", notes.TargetId.ToString());
498 498
499 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 499 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
500 { 500 {
501 while (reader.Read()) 501 while (reader.Read())
@@ -514,10 +514,10 @@ namespace OpenSim.Data.SQLite
514 } 514 }
515 515
516 public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) 516 public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
517 { 517 {
518 string query = string.Empty; 518 string query = string.Empty;
519 bool remove; 519 bool remove;
520 520
521 if(string.IsNullOrEmpty(note.Notes)) 521 if(string.IsNullOrEmpty(note.Notes))
522 { 522 {
523 remove = true; 523 remove = true;
@@ -533,7 +533,7 @@ namespace OpenSim.Data.SQLite
533 query += ":TargetId,"; 533 query += ":TargetId,";
534 query += ":Notes )"; 534 query += ":Notes )";
535 } 535 }
536 536
537 try 537 try
538 { 538 {
539 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 539 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -544,7 +544,7 @@ namespace OpenSim.Data.SQLite
544 cmd.Parameters.AddWithValue(":Notes", note.Notes); 544 cmd.Parameters.AddWithValue(":Notes", note.Notes);
545 cmd.Parameters.AddWithValue(":TargetId", note.TargetId.ToString ()); 545 cmd.Parameters.AddWithValue(":TargetId", note.TargetId.ToString ());
546 cmd.Parameters.AddWithValue(":UserId", note.UserId.ToString()); 546 cmd.Parameters.AddWithValue(":UserId", note.UserId.ToString());
547 547
548 cmd.ExecuteNonQuery(); 548 cmd.ExecuteNonQuery();
549 } 549 }
550 } 550 }
@@ -561,7 +561,7 @@ namespace OpenSim.Data.SQLite
561 { 561 {
562 IDataReader reader = null; 562 IDataReader reader = null;
563 string query = string.Empty; 563 string query = string.Empty;
564 564
565 query += "SELECT * FROM userprofile WHERE "; 565 query += "SELECT * FROM userprofile WHERE ";
566 query += "useruuid = :Id"; 566 query += "useruuid = :Id";
567 567
@@ -569,7 +569,7 @@ namespace OpenSim.Data.SQLite
569 { 569 {
570 cmd.CommandText = query; 570 cmd.CommandText = query;
571 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); 571 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString());
572 572
573 573
574 try 574 try
575 { 575 {
@@ -611,7 +611,7 @@ namespace OpenSim.Data.SQLite
611 props.Language = string.Empty; 611 props.Language = string.Empty;
612 props.PublishProfile = false; 612 props.PublishProfile = false;
613 props.PublishMature = false; 613 props.PublishMature = false;
614 614
615 query = "INSERT INTO userprofile ("; 615 query = "INSERT INTO userprofile (";
616 query += "useruuid, "; 616 query += "useruuid, ";
617 query += "profilePartner, "; 617 query += "profilePartner, ";
@@ -659,7 +659,7 @@ namespace OpenSim.Data.SQLite
659 put.Parameters.AddWithValue(":profileAboutText", props.AboutText); 659 put.Parameters.AddWithValue(":profileAboutText", props.AboutText);
660 put.Parameters.AddWithValue(":profileFirstImage", props.FirstLifeImageId.ToString()); 660 put.Parameters.AddWithValue(":profileFirstImage", props.FirstLifeImageId.ToString());
661 put.Parameters.AddWithValue(":profileFirstText", props.FirstLifeText); 661 put.Parameters.AddWithValue(":profileFirstText", props.FirstLifeText);
662 662
663 put.ExecuteNonQuery(); 663 put.ExecuteNonQuery();
664 } 664 }
665 } 665 }
@@ -668,9 +668,9 @@ namespace OpenSim.Data.SQLite
668 } 668 }
669 669
670 public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) 670 public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
671 { 671 {
672 string query = string.Empty; 672 string query = string.Empty;
673 673
674 query += "UPDATE userprofile SET "; 674 query += "UPDATE userprofile SET ";
675 query += "profileURL=:profileURL, "; 675 query += "profileURL=:profileURL, ";
676 query += "profileImage=:image, "; 676 query += "profileImage=:image, ";
@@ -678,7 +678,7 @@ namespace OpenSim.Data.SQLite
678 query += "profileFirstImage=:firstlifeimage,"; 678 query += "profileFirstImage=:firstlifeimage,";
679 query += "profileFirstText=:firstlifetext "; 679 query += "profileFirstText=:firstlifetext ";
680 query += "WHERE useruuid=:uuid"; 680 query += "WHERE useruuid=:uuid";
681 681
682 try 682 try
683 { 683 {
684 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 684 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -690,7 +690,7 @@ namespace OpenSim.Data.SQLite
690 cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); 690 cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString());
691 cmd.Parameters.AddWithValue(":firstlifetext", props.FirstLifeText); 691 cmd.Parameters.AddWithValue(":firstlifetext", props.FirstLifeText);
692 cmd.Parameters.AddWithValue(":uuid", props.UserId.ToString()); 692 cmd.Parameters.AddWithValue(":uuid", props.UserId.ToString());
693 693
694 cmd.ExecuteNonQuery(); 694 cmd.ExecuteNonQuery();
695 } 695 }
696 } 696 }
@@ -698,16 +698,16 @@ namespace OpenSim.Data.SQLite
698 { 698 {
699 m_log.ErrorFormat("[PROFILES_DATA]" + 699 m_log.ErrorFormat("[PROFILES_DATA]" +
700 ": AgentPropertiesUpdate exception {0}", e.Message); 700 ": AgentPropertiesUpdate exception {0}", e.Message);
701 701
702 return false; 702 return false;
703 } 703 }
704 return true; 704 return true;
705 } 705 }
706 706
707 public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) 707 public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
708 { 708 {
709 string query = string.Empty; 709 string query = string.Empty;
710 710
711 query += "UPDATE userprofile SET "; 711 query += "UPDATE userprofile SET ";
712 query += "profileWantToMask=:WantMask, "; 712 query += "profileWantToMask=:WantMask, ";
713 query += "profileWantToText=:WantText,"; 713 query += "profileWantToText=:WantText,";
@@ -715,7 +715,7 @@ namespace OpenSim.Data.SQLite
715 query += "profileSkillsText=:SkillsText, "; 715 query += "profileSkillsText=:SkillsText, ";
716 query += "profileLanguages=:Languages "; 716 query += "profileLanguages=:Languages ";
717 query += "WHERE useruuid=:uuid"; 717 query += "WHERE useruuid=:uuid";
718 718
719 try 719 try
720 { 720 {
721 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 721 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -727,7 +727,7 @@ namespace OpenSim.Data.SQLite
727 cmd.Parameters.AddWithValue(":SkillsText", up.SkillsText); 727 cmd.Parameters.AddWithValue(":SkillsText", up.SkillsText);
728 cmd.Parameters.AddWithValue(":Languages", up.Language); 728 cmd.Parameters.AddWithValue(":Languages", up.Language);
729 cmd.Parameters.AddWithValue(":uuid", up.UserId.ToString()); 729 cmd.Parameters.AddWithValue(":uuid", up.UserId.ToString());
730 730
731 cmd.ExecuteNonQuery(); 731 cmd.ExecuteNonQuery();
732 } 732 }
733 } 733 }
@@ -741,16 +741,17 @@ namespace OpenSim.Data.SQLite
741 return true; 741 return true;
742 } 742 }
743 743
744
744 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) 745 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
745 { 746 {
746 string query = string.Empty; 747 string query = string.Empty;
747 748
748 query += "UPDATE usersettings SET "; 749 query += "UPDATE usersettings SET ";
749 query += "imviaemail=:ImViaEmail, "; 750 query += "imviaemail=:ImViaEmail, ";
750 query += "visible=:Visible, "; 751 query += "visible=:Visible, ";
751 query += "email=:EMail "; 752 query += "email=:EMail ";
752 query += "WHERE useruuid=:uuid"; 753 query += "WHERE useruuid=:uuid";
753 754
754 try 755 try
755 { 756 {
756 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 757 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -760,7 +761,7 @@ namespace OpenSim.Data.SQLite
760 cmd.Parameters.AddWithValue(":Visible", pref.Visible); 761 cmd.Parameters.AddWithValue(":Visible", pref.Visible);
761 cmd.Parameters.AddWithValue(":EMail", pref.EMail); 762 cmd.Parameters.AddWithValue(":EMail", pref.EMail);
762 cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); 763 cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString());
763 764
764 cmd.ExecuteNonQuery(); 765 cmd.ExecuteNonQuery();
765 } 766 }
766 } 767 }
@@ -778,20 +779,20 @@ namespace OpenSim.Data.SQLite
778 { 779 {
779 IDataReader reader = null; 780 IDataReader reader = null;
780 string query = string.Empty; 781 string query = string.Empty;
781 782
782 query += "SELECT imviaemail,visible,email FROM "; 783 query += "SELECT imviaemail,visible,email FROM ";
783 query += "usersettings WHERE "; 784 query += "usersettings WHERE ";
784 query += "useruuid = :Id"; 785 query += "useruuid = :Id";
785 786
786 OSDArray data = new OSDArray(); 787 OSDArray data = new OSDArray();
787 788
788 try 789 try
789 { 790 {
790 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 791 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
791 { 792 {
792 cmd.CommandText = query; 793 cmd.CommandText = query;
793 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); 794 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
794 795
795 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 796 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
796 { 797 {
797 if(reader.Read()) 798 if(reader.Read())
@@ -804,13 +805,13 @@ namespace OpenSim.Data.SQLite
804 { 805 {
805 query = "INSERT INTO usersettings VALUES "; 806 query = "INSERT INTO usersettings VALUES ";
806 query += "(:Id,'false','false', :Email)"; 807 query += "(:Id,'false','false', :Email)";
807 808
808 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) 809 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
809 { 810 {
810 put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); 811 put.Parameters.AddWithValue(":Id", pref.UserId.ToString());
811 put.Parameters.AddWithValue(":Email", pref.EMail); 812 put.Parameters.AddWithValue(":Email", pref.EMail);
812 put.ExecuteNonQuery(); 813 put.ExecuteNonQuery();
813 814
814 } 815 }
815 } 816 }
816 } 817 }
@@ -830,11 +831,11 @@ namespace OpenSim.Data.SQLite
830 { 831 {
831 IDataReader reader = null; 832 IDataReader reader = null;
832 string query = string.Empty; 833 string query = string.Empty;
833 834
834 query += "SELECT * FROM `userdata` WHERE "; 835 query += "SELECT * FROM `userdata` WHERE ";
835 query += "UserId = :Id AND "; 836 query += "UserId = :Id AND ";
836 query += "TagId = :TagId"; 837 query += "TagId = :TagId";
837 838
838 try 839 try
839 { 840 {
840 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 841 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -842,7 +843,7 @@ namespace OpenSim.Data.SQLite
842 cmd.CommandText = query; 843 cmd.CommandText = query;
843 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); 844 cmd.Parameters.AddWithValue(":Id", props.UserId.ToString());
844 cmd.Parameters.AddWithValue (":TagId", props.TagId.ToString()); 845 cmd.Parameters.AddWithValue (":TagId", props.TagId.ToString());
845 846
846 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 847 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
847 { 848 {
848 if(reader.Read()) 849 if(reader.Read())
@@ -857,7 +858,7 @@ namespace OpenSim.Data.SQLite
857 query += ":TagId,"; 858 query += ":TagId,";
858 query += ":DataKey,"; 859 query += ":DataKey,";
859 query += ":DataVal) "; 860 query += ":DataVal) ";
860 861
861 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) 862 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
862 { 863 {
863 put.Parameters.AddWithValue(":Id", props.UserId.ToString()); 864 put.Parameters.AddWithValue(":Id", props.UserId.ToString());
@@ -881,16 +882,16 @@ namespace OpenSim.Data.SQLite
881 return true; 882 return true;
882 } 883 }
883 public bool SetUserAppData(UserAppData props, ref string result) 884 public bool SetUserAppData(UserAppData props, ref string result)
884 { 885 {
885 string query = string.Empty; 886 string query = string.Empty;
886 887
887 query += "UPDATE userdata SET "; 888 query += "UPDATE userdata SET ";
888 query += "TagId = :TagId, "; 889 query += "TagId = :TagId, ";
889 query += "DataKey = :DataKey, "; 890 query += "DataKey = :DataKey, ";
890 query += "DataVal = :DataVal WHERE "; 891 query += "DataVal = :DataVal WHERE ";
891 query += "UserId = :UserId AND "; 892 query += "UserId = :UserId AND ";
892 query += "TagId = :TagId"; 893 query += "TagId = :TagId";
893 894
894 try 895 try
895 { 896 {
896 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 897 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
@@ -917,17 +918,17 @@ namespace OpenSim.Data.SQLite
917 IDataReader reader = null; 918 IDataReader reader = null;
918 OSDArray data = new OSDArray(); 919 OSDArray data = new OSDArray();
919 string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = :Id"; 920 string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = :Id";
920 921
921 // Get classified image assets 922 // Get classified image assets
922 923
923 924
924 try 925 try
925 { 926 {
926 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 927 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
927 { 928 {
928 cmd.CommandText = query; 929 cmd.CommandText = query;
929 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 930 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
930 931
931 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 932 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
932 { 933 {
933 while(reader.Read()) 934 while(reader.Read())
@@ -941,7 +942,7 @@ namespace OpenSim.Data.SQLite
941 { 942 {
942 cmd.CommandText = query; 943 cmd.CommandText = query;
943 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 944 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
944 945
945 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 946 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
946 { 947 {
947 if(reader.Read()) 948 if(reader.Read())
@@ -950,14 +951,14 @@ namespace OpenSim.Data.SQLite
950 } 951 }
951 } 952 }
952 } 953 }
953 954
954 query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = :Id"; 955 query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = :Id";
955 956
956 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) 957 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
957 { 958 {
958 cmd.CommandText = query; 959 cmd.CommandText = query;
959 cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); 960 cmd.Parameters.AddWithValue(":Id", avatarId.ToString());
960 961
961 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 962 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
962 { 963 {
963 if(reader.Read()) 964 if(reader.Read())
diff --git a/OpenSim/Data/SQLite/SQLiteUtils.cs b/OpenSim/Data/SQLite/SQLiteUtils.cs
index ca5861f..1218ebb 100644
--- a/OpenSim/Data/SQLite/SQLiteUtils.cs
+++ b/OpenSim/Data/SQLite/SQLiteUtils.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Data.SQLite
49 **********************************************************************/ 49 **********************************************************************/
50 50
51 /// <summary> 51 /// <summary>
52 /// 52 ///
53 /// </summary> 53 /// </summary>
54 /// <param name="dt"></param> 54 /// <param name="dt"></param>
55 /// <param name="name"></param> 55 /// <param name="name"></param>
@@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite
147 } 147 }
148 148
149 /// <summary> 149 /// <summary>
150 /// 150 ///
151 /// </summary> 151 /// </summary>
152 /// <param name="dt">Data Table</param> 152 /// <param name="dt">Data Table</param>
153 /// <returns></returns> 153 /// <returns></returns>
@@ -191,7 +191,7 @@ namespace OpenSim.Data.SQLite
191 /// lines for defining SqliteParameters to 2 parameters: 191 /// lines for defining SqliteParameters to 2 parameters:
192 /// column name and database type. 192 /// column name and database type.
193 /// </para> 193 /// </para>
194 /// 194 ///
195 /// <para> 195 /// <para>
196 /// It assumes certain conventions like :param as the param 196 /// It assumes certain conventions like :param as the param
197 /// name to replace in parametrized queries, and that source 197 /// name to replace in parametrized queries, and that source
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
index 2a0a8f6..4ef1f30 100644
--- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Data.SQLite
107 public bool DeleteItems(string[] fields, string[] vals) 107 public bool DeleteItems(string[] fields, string[] vals)
108 { 108 {
109 return m_Items.Delete(fields, vals); 109 return m_Items.Delete(fields, vals);
110 } 110 }
111 111
112 public bool MoveItem(string id, string newParent) 112 public bool MoveItem(string id, string newParent)
113 { 113 {
@@ -302,20 +302,14 @@ namespace OpenSim.Data.SQLite
302 { 302 {
303// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); 303// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
304// Util.PrintCallStack(); 304// Util.PrintCallStack();
305 305
306 using (SqliteCommand cmd = new SqliteCommand()) 306 using (SqliteCommand cmd = new SqliteCommand())
307 { 307 {
308 cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = ?folderID"; 308 cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = :folderID";
309 cmd.Parameters.Add(new SqliteParameter(":folderID", folderID)); 309 cmd.Parameters.Add(new SqliteParameter(":folderID", folderID));
310 310
311 try 311 if(ExecuteNonQuery(cmd, m_Connection) == 0)
312 {
313 cmd.ExecuteNonQuery();
314 }
315 catch (Exception)
316 {
317 return false; 312 return false;
318 }
319 } 313 }
320 314
321 return true; 315 return true;