GatewayLog adjustments
[interchange.git] / code / UI_Tag / export_database.coretag
1 # Copyright 2002-2007 Interchange Development Group and others
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.  See the LICENSE file for details.
7
8 UserTag export-database Order    table file type
9 UserTag export-database addAttr
10 UserTag export-database Version  1.4
11 UserTag export-database Routine  <<EOR
12 sub {
13                 my($table, $file, $type, $opt) = @_;
14                 delete $::Values->{ui_export_database}
15                         or return undef;
16                 if($opt->{delete} and ! $opt->{verify}) {
17                         ::logError("attempt to delete field without verify, abort");
18                         return undef;
19                 }
20
21                 if(!$file and $type) {
22                         #::logError("exporting as default type, no file specified");
23                         undef $type;
24                 }
25
26                 $Vend::WriteDatabase{$table} = 1;
27
28                 if(! $opt->{field}) {
29                         #::logError("exporting:\ntable=$table\nfile=$file\ntype=$type\nsort=$opt->{sort}");
30                 }
31                 elsif($opt->{field} and $opt->{delete}) {
32                         ::logError("delete field:\ntable=$table\nfield=$opt->{field}\nsort=$opt->{sort}\n");
33                 }
34                 elsif($opt->{field}) {
35                         ::logError("add field:\ntable=$table\nfield=$opt->{field}\nsort=$opt->{sort}\n");
36                 }
37                 return Vend::Data::export_database(
38                                                                         $table,
39                                                                         $file,
40                                                                         $type,
41                                                                         $opt,
42                                                         );
43 }
44 EOR