missing project/build files
[client-tools.git] / src / game / server / database / packages / make_purge_script.pl
blobfbe800f72d11b9cfd5d1cd6a61e42d42b00ca7e8
1 #!/usr/bin/perl
3 while (<>)
5 if (/\-\- BEGIN GENERATED CODE \(make_purge_script.pl\)/)
7 print;
8 &generateCode;
9 do
11 last unless ($_=<>);
12 } until (/\-\- END GENERATED CODE/)
14 print;
17 sub generateCode
19 open (TABLIST,"ls -b ../schema/*.tab|");
21 $tabs="\t\t";
23 while (<TABLIST>)
25 chop;
26 s/\.tab//;
27 s/\.\.\/schema\///;
28 if (/objects/ && ($_ ne "objects"))
30 &makeCommand($_);
34 close (TABLIST);
37 sub makeCommand
39 my ($tablename)=@_;
41 print $tabs."delete from ${tablename} where not exists (select * from objects where ${tablename}.object_id = objects.object_id);\n";