[Bio] / FigKernelPackages / FIG.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.282, Wed May 25 18:58:27 2005 UTC revision 1.283, Sun May 29 13:33:56 2005 UTC
# Line 1787  Line 1787 
1787    
1788  =pod  =pod
1789    
1790    =head1 table_exists
1791    
1792    usage: if ($fig->table_exists($table)) { }
1793    
1794    Test for existence of table in the relational DB. This returns 0 if the table
1795    does not exist; 1 if it does
1796    
1797    =cut
1798    
1799    # If there is a better way to do this, please fix it.  It seems clutzy to
1800    # me to have to invoke psql, but I do not see how else to do it.
1801    # NOTE: THIS ONLY WORKS UNDER POSTGRES
1802    
1803    sub table_exists {
1804        my($self,$table) = @_;
1805    
1806        my @tmp = `echo '\\dt $table' | psql $FIG_Config::db`;
1807        if ((@tmp == 1) && ($tmp[0] =~ /No matching relations/)) { return 0 }
1808        return 1;
1809    }
1810    
1811    
1812    =pod
1813    
1814  =head1 run  =head1 run
1815    
1816  usage: &FIG::run($cmd)  usage: &FIG::run($cmd)

Legend:
Removed from v.1.282  
changed lines
  Added in v.1.283

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3