Correct [log type=error|debug] final newline behavior
[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 # $Id: export_database.coretag,v 1.4 2007-03-30 23:40:54 pajamian Exp $
9
10 UserTag export-database Order    table file type
11 UserTag export-database addAttr
12 UserTag export-database Version  $Revision: 1.4 $
13 UserTag export-database Routine  <<EOR
14 sub {
15                 my($table, $file, $type, $opt) = @_;
16                 delete $::Values->{ui_export_database}
17                         or return undef;
18                 if($opt->{delete} and ! $opt->{verify}) {
19                         ::logError("attempt to delete field without verify, abort");
20                         return undef;
21                 }
22
23                 if(!$file and $type) {
24                         #::logError("exporting as default type, no file specified");
25                         undef $type;
26                 }
27
28                 $Vend::WriteDatabase{$table} = 1;
29
30                 if(! $opt->{field}) {
31                         #::logError("exporting:\ntable=$table\nfile=$file\ntype=$type\nsort=$opt->{sort}");
32                 }
33                 elsif($opt->{field} and $opt->{delete}) {
34                         ::logError("delete field:\ntable=$table\nfield=$opt->{field}\nsort=$opt->{sort}\n");
35                 }
36                 elsif($opt->{field}) {
37                         ::logError("add field:\ntable=$table\nfield=$opt->{field}\nsort=$opt->{sort}\n");
38                 }
39                 return Vend::Data::export_database(
40                                                                         $table,
41                                                                         $file,
42                                                                         $type,
43                                                                         $opt,
44                                                         );
45 }
46 EOR