6 @EXPORT = qw(conv_i conv_date conv_dateq do_query selectrow_query do_statement dump_query);
9 my ($value, $default) = @_;
10 return (defined($value) && "$value" ne "") ? $value * 1 : $default;
15 return (defined($value) && "$value" ne "") ? $value : undef;
20 if (defined($value) && "$value" ne "") {
21 $value =~ s/\'/\'\'/g;
28 my ($form, $dbh, $query) = splice(@_, 0, 3);
30 if (0 == scalar(@_)) {
31 $dbh->do($query) || $form->dberror($query);
33 $dbh->do($query, undef, @_) ||
34 $form->dberror($query . " (" . join(", ", @_) . ")");
39 my ($form, $dbh, $query) = splice(@_, 0, 3);
41 if (0 == scalar(@_)) {
42 my @results = $dbh->selectrow_array($query);
43 $form->dberror($query) if ($dbh->err);
46 my @results = $dbh->selectrow_array($query, undef, @_);
47 $form->dberror($query . " (" . join(", ", @_) . ")") if ($dbh->err);
53 my ($form, $sth, $query) = splice(@_, 0, 3);
55 if (0 == scalar(@_)) {
56 $sth->execute() || $form->dberror($query);
59 $form->dberror($query . " (" . join(", ", @_) . ")");
64 my ($level, $msg, $query) = splice(@_, 0, 3);
65 while ($query =~ /\?/) {
66 my $value = shift(@_);
67 $value =~ s/\'/\\\'/g;
68 $value = "'${value}'";
69 $query =~ s/\?/$value/;
72 $msg .= " " if ($msg);
74 $main::lxdebug->message($level, $msg . $query);