re-introduce $sth->rows > 0 check which PostgreSQL needs
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 12 Feb 2009 10:56:03 +0000 (10:56 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 12 Feb 2009 10:56:03 +0000 (10:56 +0000)
to detect queries which doesn't return results
(like create temporary table)

git-svn-id: svn://svn.rot13.org/SQL2XLS@25 2e857b76-582b-47e5-ad5c-b3ba0f0ee29b

sql2xls.cgi

index 706cf92..0de8e00 100755 (executable)
@@ -200,7 +200,7 @@ foreach my $sql_file (@sql_files) {
                my $sth = $dbh->prepare($sql);
                $sth->execute();
 
-               next unless $sth->{NAME}; # $sth->rows doesn't work for insert into with MySQL
+               next unless $sth->{NAME} && $sth->rows > 0; # $sth->rows alone doesn't work for insert into with MySQL
 
                my @types = eval {
                        map { $dbh->type_info($_) ? $dbh->type_info($_)->{TYPE_NAME} : '?' } @{ $sth->{TYPE} };