From 809cf935baa339ed27f0fbf587216dca6b0011cf Mon Sep 17 00:00:00 2001 From: elserj Date: Fri, 6 Feb 2015 17:32:21 +0000 Subject: [PATCH] Add error checking for db creation statement svn path=/; revision=600 --- interactome_scripts/inparanoid_output_parse.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/interactome_scripts/inparanoid_output_parse.pl b/interactome_scripts/inparanoid_output_parse.pl index 92d3a7a..0e0983f 100755 --- a/interactome_scripts/inparanoid_output_parse.pl +++ b/interactome_scripts/inparanoid_output_parse.pl @@ -33,11 +33,11 @@ use DbiFloret; my $dbh = DbiFloret::dbconnect; -if($new) { - $database = $dbh->selectrow_array("select DATABASE()"); - $dbh->do("drop database if exists $database"); - $dbh->do("create database $database"); -} +#if($new) { +# my $database = $dbh->selectrow_array("select DATABASE()"); +# $dbh->do("drop database if exists $database"); +# $dbh->do("create database $database"); +#} if(-e "$ENV{HOME}/scripts/jaiswallab/interactome_scripts/find_species.pl") { @@ -58,6 +58,7 @@ my $safe_clust_table = $dbh->quote_identifier($clust_table); my %id_hash; if($new) { + $dbh->do("drop table if exists $safe_clust_table"); $dbh->do("create table $safe_clust_table ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT, `clust_id` VARCHAR( 255 ) NOT NULL , @@ -108,7 +109,7 @@ foreach my $input_file (@files) { `score` FLOAT( 11 ) NOT NULL , `gene` VARCHAR( 255 ) NOT NULL , INDEX ( `id` ) - ) TYPE = MYISAM"); + ) TYPE = MYISAM") or die $dbh->errstr;; my $sth = $dbh->prepare("insert into $safe_species_table (id, bit_score, species, score, gene) values (?,?,?,?,?)"); -- 2.34.1