6 ###################################################
8 $dbname = "phpgroupware";
9 $dbhost = "192.168.0.2"; # This can be an IP address or name
11 $dbuser = "phpgroupware"; # This may require an additional '\@localhost'
12 $dbpass = "phpgroupware";
13 ###################################################
15 ###################################################
16 # Connect to the database
17 $dbh=DBI->connect("dbi:mysql:dbname=$dbname:host=$dbhost:port=$dbport",$dbuser,$dbpass,{
19 PrintError=>0}) or print "Connect Failure:".$DBI::errstr."\n" and exit 2;
20 ###################################################
22 # Add a new 'aaronic' column to the eq_ppi table
23 $sth = $dbh->prepare("ALTER TABLE `eq_ppi` ADD `aaronic` INT( 16 ) NOT NULL DEFAULT '0' AFTER `elder`");
24 $sth->execute or die "-E- DB error: $DBI::errstr\n";
26 # Parse the data out of the eq_interview table and add them to the eq_ppi table
27 $sth = $dbh->prepare("select * from eq_interview");
28 $sth->execute or die "-E- DB error: $DBI::errstr\n";
29 while($row = $sth->fetchrow_hashref) {
30 $interviewer = $row->{interviewer};
31 $elder = $row->{elder};
32 $aaronic = $row->{aaronic};
34 $notes = $row->{notes};
35 $notes =~ s/\'/\\\'/g;
37 #print "$interviewer $elder $aaronic $date $eqpresppi $notes\n";
38 $sth2 = $dbh->prepare("insert into eq_ppi values (NULL,'$interviewer','$elder','$aaronic','$date','$notes','$eqpresppi')");
39 $sth2->execute or die "-E- DB error: $DBI::errstr\n";
42 print "\n-> Succesfully imported all eq_interview table entries into eq_ppi table...\n";
43 print "-> You may drop the eq_interview table once you know all your data was transferred to the eq_ppi table correctly..\n";
45 ###################################################
46 # Disconnect from the database
48 ###################################################