Leser: 1
2 Einträge, 1 Seite |
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
##!/usr/bin/perl
##########################################################
# Configuration
my $host = '';
my $database='';
my $db_1='';
my $db_2='';
my $user='';
my $password='';
##########################################################
# Program
use FindBin;
use lib "$FindBin::Bin/..";
use strict;
use warnings;
use Socket;
%main::ua = ();
$main::db = undef;
@main::db_connect = (
"DBI:mysql:mysql:$main::host",
$main::user,
$main::password
);
use Mysql;
$db = Mysql->connect(host, database, user, password);
$db->selectdb($database);
$query = db->query(SELECT * FROM $db_1 );
while (%hash = $query->fetchhash) {
unlink ('/etc/bind/.'$hash{'name'}.'.db');
open(file, ">$query->ausgabe";
$querys = $db->query(SELECT * FROM $db_1');
close (file);
}
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
#!/Perl/bin/perl
use strict;
use warnings;
use DBI;
use Config::Auto;
use Data::Dumper qw/Dumper/;
my $config = Config::Auto::parse('test_mysql.config');
my $dsn = $config->{dsn};
my $username = $config->{username};
my $password = $config->{password};
my $options = { AutoCommit => 1, };
my $dbh = DBI->connect($dsn, $username, $password, $options) or die "cannot connect to db: " . DBI::errstr();
my $stmt = "SELECT * FROM testabelle";
my $sth = $dbh->prepare($stmt) or die "error prepare: " . $dbh->errstr();
my $rv = $sth->execute() or die "error execute: " . $dbh->errstr();;
if( $rv == "0E0" ) {
print "keine Werte";
}else{
while( my $href = $sth->fetchrow_hashref() ) {
print Dumper $href;
}
}
$sth->finish();
$dbh->disconnect();
1
2
3
4
5
6
7
8
9
10
11
#!/Perl/bin/perl
use strict;
my %CFG = ();
$CFG{dsn} = "DBI:mysql:test:localhost";
$CFG{username} = "benutzername";
$CFG{password} = "passwort";
\%CFG;
2 Einträge, 1 Seite |