#!/usr/bin/perl -w use strict; use warnings; use DBI; use Digest::MD5; my $dbh; my $raw_data; my $sqldata; open(DAT, '<','../gate_common/MySQLAccount.txt') or die"Could not open SQL-Data-file!"; $raw_data=; close(DAT); chomp $raw_data; my ($host,$user,$pass,$db) = split(/:/, $raw_data); print "host ".$host."\n"."user ".$user."\n"."pass ".$pass."\n"."db ".$db."\n"; $dbh = DBI->connect("DBI:mysql:".$db.":".$host,$user,$pass) or die "Connect Error: $DBI::errstr()\n"; Query($dbh); sub Query{ my $query; my $sth; my $execu; my $newdata; my $file; my $ds; my @ergebnisse; my @row; $query = "SELECT RefID FROM ´Rechnen ,Daten WHERE Rechnen .ID=DatenRefID ORDER BY TS_LastChange "; $sth = $dbh->prepare($query) or die "$DBI::errstr\n"; $sth->execute or die "$DBI::errstr\n"; while($newdata = $sth->fetchrow_array()){ if(not defined $newdata){ $dbh->do("INSERT INTO Rechnen(ID) VALUES(?)",undef) or die $dbh->errstr(); } print"$newdata\n"; } $sth->finish(); }