Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r19118: Check existing tables in user's clusters...

Committer: gariev
Check existing tables in user's clusters: minor bugfix in regexp
U   trunk/bin/upgrading/update-db.pl
Modified: trunk/bin/upgrading/update-db.pl
===================================================================
--- trunk/bin/upgrading/update-db.pl	2011-05-24 08:46:31 UTC (rev 19117)
+++ trunk/bin/upgrading/update-db.pl	2011-05-24 09:06:03 UTC (rev 19118)
@@ -1014,14 +1014,17 @@
 
 sub table_exists {
     my $table = shift;
+    
+    ## TODO: use $dbh->table_info() to retrieve this info
     my $data_source = $dbh->get_info( $GetInfoType{SQL_DATA_SOURCE_NAME} );
-    if ($data_source =~ /^dbi:mysql:(.+?)(?:;|$)/) {
+    if ($data_source =~ /^dbi:mysql:(\w+)/) {
+        my $schema = $1;
         my $result = $dbh->selectrow_array('
             SELECT count(*) 
             FROM information_schema.tables 
             WHERE table_schema = ?
               AND table_name = ?
-        ', undef, $1, $table);
+        ', undef, $schema, $table);
         return $result;
     }
 }

Tags: gariev, livejournal, pl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments