missing project/build files
[client-tools.git] / src / game / server / database / packages / lazy_deleter.plsql
blobab4c87c8a046a93b2cb55dd6e01f012262d4f051
1 create or replace package body lazy_deleter as
3         procedure purge_one_object (object_in in number) as
4         BEGIN
5                 DELETE FROM armor WHERE object_id = object_in;
6                 DELETE FROM battlefield_marker_objects WHERE object_id = object_in;
7                 DELETE FROM battlefield_participants WHERE region_object_id = object_in;
8                 DELETE FROM battlefield_participants WHERE character_object_id = object_in;
9                 DELETE FROM biographies WHERE object_id = object_in;
10                 DELETE FROM building_objects WHERE object_id = object_in;
11                 DELETE FROM cell_objects WHERE object_id = object_in;
12                 DELETE FROM city_objects WHERE object_id = object_in;
13                 DELETE FROM creature_objects WHERE object_id = object_in;
14                 DELETE FROM experience_points WHERE object_id = object_in;
15                 DELETE FROM factory_objects WHERE object_id = object_in;
16                 DELETE FROM guild_objects WHERE object_id = object_in;
17                 DELETE FROM harvester_installation_objects WHERE object_id = object_in;
18                 DELETE FROM installation_objects WHERE object_id = object_in;
19                 DELETE FROM intangible_objects WHERE object_id = object_in;
20                 DELETE FROM location_lists WHERE object_id = object_in;
21                 DELETE FROM manf_schematic_attributes WHERE object_id = object_in;
22                 DELETE FROM manf_schematic_objects WHERE object_id = object_in;
23                 DELETE FROM manufacture_inst_objects WHERE object_id = object_in;
24                 DELETE FROM mission_objects WHERE object_id = object_in;
25                 DELETE FROM object_variables WHERE object_id = object_in;
26                 DELETE FROM planet_objects WHERE object_id = object_in;
27                 DELETE FROM player_objects WHERE object_id = object_in;
28                 DELETE FROM player_quest_objects WHERE object_id = object_in;
29                 DELETE FROM property_lists WHERE object_id = object_in;
30                 DELETE FROM resource_container_objects WHERE object_id = object_in;
31                 DELETE FROM scripts WHERE object_id = object_in;
32                 DELETE FROM ship_objects WHERE object_id = object_in;
33                 DELETE FROM static_objects WHERE object_id = object_in;
34                 DELETE FROM swg_characters WHERE object_id = object_in;
35                 DELETE FROM tangible_objects WHERE object_id = object_in; 
36                 DELETE FROM temp_characters WHERE object_id = object_in; 
37                 DELETE FROM token_objects WHERE object_id = object_in; 
38                 DELETE FROM universe_objects WHERE object_id = object_in;
39                 DELETE FROM vehicle_objects WHERE object_id = object_in; 
40                 DELETE FROM waypoints WHERE object_id = object_in; 
41                 DELETE FROM weapon_objects WHERE object_id = object_in;
42                 DELETE FROM messages WHERE target = object_in;
43                 DELETE FROM objects WHERE object_id = object_in;
44         END purge_one_object;
46         procedure purge_objects_bulk(p_object_id VAOFSTRING, p_chunk_size number, p_enable_db_logging number )
47         as
49         errors  NUMBER;
51         begin
52                 
53                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM armor WHERE object_id = p_object_id(i);
54                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM battlefield_marker_objects WHERE object_id = p_object_id(i);
55                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM battlefield_participants WHERE region_object_id = p_object_id(i);
56                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM battlefield_participants WHERE character_object_id = p_object_id(i);
57                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM biographies WHERE object_id = p_object_id(i);
58                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM building_objects WHERE object_id = p_object_id(i);
59                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM cell_objects WHERE object_id = p_object_id(i);
60                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM city_objects WHERE object_id = p_object_id(i);
61                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM creature_objects WHERE object_id = p_object_id(i);
62                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM experience_points WHERE object_id = p_object_id(i);
63                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM factory_objects WHERE object_id = p_object_id(i);
64                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM guild_objects WHERE object_id = p_object_id(i);
65                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM harvester_installation_objects WHERE object_id = p_object_id(i);
66                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM installation_objects WHERE object_id = p_object_id(i);
67                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM intangible_objects WHERE object_id = p_object_id(i);
68                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM location_lists WHERE object_id = p_object_id(i);
69                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM manf_schematic_attributes WHERE object_id = p_object_id(i);
70                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM manf_schematic_objects WHERE object_id = p_object_id(i);
71                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM manufacture_inst_objects WHERE object_id = p_object_id(i);
72                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM mission_objects WHERE object_id = p_object_id(i);
73                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM object_variables WHERE object_id = p_object_id(i);
74                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM planet_objects WHERE object_id = p_object_id(i);
75                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM player_objects WHERE object_id = p_object_id(i);
76                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM player_quest_objects WHERE object_id = p_object_id(i);
77                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM property_lists WHERE object_id = p_object_id(i);
78                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM resource_container_objects WHERE object_id = p_object_id(i);
79                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM scripts WHERE object_id = p_object_id(i);
80                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM static_objects WHERE object_id = p_object_id(i);
81                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM swg_characters WHERE object_id = p_object_id(i);
82                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM tangible_objects WHERE object_id = p_object_id(i);
83                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM temp_characters WHERE object_id = p_object_id(i);
84                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM token_objects WHERE object_id = p_object_id(i);
85                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM universe_objects WHERE object_id = p_object_id(i);
86                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM vehicle_objects WHERE object_id = p_object_id(i);
87                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM waypoints WHERE object_id = p_object_id(i);
88                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM weapon_objects WHERE object_id = p_object_id(i);
89                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM messages WHERE target = p_object_id(i);
90                 FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM objects WHERE object_id = p_object_id(i);
92                 exception when others then
93                         if ( p_enable_db_logging > 0 ) then
94                                 errors:=SQL%BULK_EXCEPTIONS.COUNT;
95                                 FOR x IN 1..errors LOOP
96                                         db_error_logger.dblogerror( -SQL%BULK_EXCEPTIONS(x).ERROR_CODE, 'procedure purge_objects_bulk: error occurred in FORALL DELETE during iteration: ' || SQL%BULK_EXCEPTIONS(x).ERROR_INDEX );
97                                                 if ( p_enable_db_logging > 1 ) then
98                                                                 db_error_logger.dblogerror_values( 'lazy deleter', 'object_id' , 'number', p_object_id(to_number(SQL%BULK_EXCEPTIONS(x).ERROR_INDEX)));
99                                                 end if;
100                                 END LOOP;
101                                 
102                         else
103                                 NULL;
104                         end if;
106         end;
108 end lazy_deleter;