X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/14c1b704816c9dcfebca1d0bf9fd0e2fc2d253e4..32147d43441f0a99e6e320f6aaeb6b68e766264f:/SL/DBUtils.pm diff --git a/SL/DBUtils.pm b/SL/DBUtils.pm index df4c5ac93..49e9aaeb5 100644 --- a/SL/DBUtils.pm +++ b/SL/DBUtils.pm @@ -9,7 +9,7 @@ require Exporter; selectall_hashref_query selectall_array_query selectall_as_map prepare_execute_query prepare_query - create_sort_spec); + create_sort_spec does_table_exist); sub conv_i { my ($value, $default) = @_; @@ -259,6 +259,28 @@ sub create_sort_spec { return %result; } +sub does_table_exist { + $main::lxdebug->enter_sub(2); + + my $dbh = shift; + my $table = shift; + + my $result = 0; + + if ($dbh) { + my $sth = $dbh->table_info('', '', $table, 'TABLE'); + if ($sth) { + $result = $sth->fetchrow_hashref(); + $sth->finish(); + } + } + + $main::lxdebug->leave_sub(2); + + return $result; +} + + 1;