10 Einträge, 1 Seite |
1
2
3
4
5
6
my $date1 = '12.05.04';
my $date2 = '1.6.06';
if($date1 eq $date2){
print "gleich!\n!;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
!/usr/bin/perl -w
#Hauptscript
use strict;
use warnings;
use DBI;
my $dbh;
my $raw_data;
my $sqldata;
my $rc;
open(DAT, '<','../gate_common/MySQLAccount.txt') or die"Could not open SQL-Data-file!";
$raw_data=<DAT>;
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);
$dbh->disconnect;
sub Query{
my $query;
my $sth;
my $execu;
my $newdata;
my $NEID = 2923;
my $ds;
my @ergebnisse;
my @row;
my $Datum1;
my$Datum2;
my$query1;
my$query2;
################RC-CISCO LETZTEN STATUS ABFRAGEN ########################################################
$query = "SELECT * FROM RC_CISCO LEFT JOIN GATE_STATE ON RC_CISCO.NEID=GATE_STATE.NEID WHERE RC_CISCO.ID=? ORDER BY RC_CISCO.ID DESC LIMIT 1";
$sth = $dbh->prepare($query) or die "$DBI::errstr\n";
$sth->execute($NEID)or die "$DBI::errstr\n";
while($newdata = $sth->fetchrow_array()){
if(not defined $newdata){
$dbh->do("INSERT INTO RC_CISCO(ID) VALUES(?)",undef,$NEID) or die $dbh->errstr();
$dbh->do("INSERT INTO GATE_STATE(Data_RefID) VALUES(?)",undef,$NEID) or die $dbh->errstr();
}
$query1="SELECT RC_CISCO.Datum FROM RC_CISCO";
$query2="SELECT GATE_STATE.Datum_ref FROM GATE_STATE";
my $Datum1=$query1;
my $Datum2 = $query2;
if($Datum1 =$Datum2){
print "gleich!\n!;
}
}
while($newdata = $sth->fetchrow_hashref)
{
print " Name:$newdata->{NEID}}\n";
}
$sth->finish();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl -w
#DatenbankAbfragen
use strict;
use warnings;
use DBI;
my $dbh;
my $raw_data;
my $sqldata;
my $rc;
open(DAT, '<','../gate_common/MySQLAccount.txt') or die"Could not open SQL-Data-file!";
$raw_data=<DAT>;
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);
$dbh->disconnect;
sub Query{
my $query;
my $sth;
my $execu;
my $newdata;
my $NEID = 2923;
my $ds;
my @ergebnisse;
my @row;
################RC-CISCO LETZTEN STATUS ABFRAGEN ####################################
$query = "SELECT * FROM RC_CISCO LEFT JOIN GATE_STATE ON RC_CISCO.NEID=GATE_STATE.NEID WHERE RC_CISCO.NEID=? ORDER BY RC_CISCO.ID DESC LIMIT 1;";
$sth = $dbh->prepare($query) or die "$DBI::errstr\n";
$sth->execute($NEID)or die "$DBI::errstr\n";
while($newdata = $sth->fetchrow_array()){
if(not defined $newdata){
$dbh->do("INSERT INTO RC_CISCO(NEID) VALUES(?)",undef,$NEID) or die $dbh->errstr();
}
if(not defined $newdata){
$dbh->do("INSERT INTO GATE_STATE(NEID) VALUES(?)",undef,$NEID) or die $dbh->errstr();
}
while($newdata = $sth->fetchrow_hashref)
{
print " Name:$newdata->{NEID}}\n";
}
$sth->finish();
}
10 Einträge, 1 Seite |