#!/usr/bin/perl #* #* GnuDialer - Complete, free predictive dialer #* #* Complete, free predictive dialer for contact centers. #* #* Copyright (C) 2006, GnuDialer Project #* #* Richard Lyman #* #* This program is free software, distributed under the terms of #* the GNU General Public License. #* use DBI; $drh = DBI->install_driver('mysql') or die("Unable to install driver"); $dbh = DBI->connect("DBI:mysql:dialer",'dialer','1234') or die("Unable to connect"); &what_dbs; $dbh->disconnect; #################################################################################################### sub what_dbs { my $ret = 0; my $sth = $dbh->prepare("SHOW TABLES"); $sth->execute or print "query: what_dbs failed"; while(@table = $sth->fetchrow_array) { if ($table[0] ne 'cdr' && $table[0] ne 'CDR' &&$table[0] ne 'dnc' && $table[0] ne 'DNC') { update_tables($table[0]); #this adds the new columns } } $sth->finish; return $ret; } #################################################################################################### sub update_tables { local($thetable) = @_; $mystring = "ALTER IGNORE TABLE " . $thetable . " ADD INDEX ( `lastupdated` )"; $sth = $dbh->prepare("$mystring"); $sth->execute or die("Unable to excute query"); $sth->finish; } #*************************