phpbar.de logo

Mailinglisten-Archive

mysql und Perl

mysql und Perl

Uwe Driessen driessen at fblan.de
Die Apr 21 22:28:51 CEST 2009


Hallo Leute 

Spricht hier jemand Perl?
Gibt es einen bekannten Bug in Mysql im zusammenhang mit Perl?

Nachfolgendes Statement wird an SQL übergeben, es taucht auch im mysql.log mit den
richtigen variablen auf.
Aus dem Logfile die ganzen Statements on Block kopiert und in mysql einfach reingeworfen
und alle Einträge werden gemacht.

Über Perl übergeben nada nix keine Einträge und ich fresse jetzt langsam an der
Tischkante...
 
        use DBI;
        my $dbh = DBI->connect('DBI:mysql:database=pdns;host=10.1.0.3;port=3306', 'root' ,
'password') || die;

        my $mySQL = undef;
        $mySQL = qq{BEGIN;
                INSERT INTO pdns.domains(name,type,notified_serial) values (\"$dmn_name\",
\"NATIVE\", DATE_FORMAT(now(), \"%Y%m%d00\"))
                        ON DUPLICATE KEY UPDATE type = \"NATIVE\", notified_serial =
DATE_FORMAT(now(),\"%Y%m%d00\");
                COMMIT;
                BEGIN;
                SELECT IF((SELECT id FROM pdns.records WHERE name = \"$dmn_name\" AND TYPE
= \"SOA\" LIMIT 1)>0,
                        (SELECT \@data := id FROM pdns.records WHERE name = \"$dmn_name\"
AND TYPE = \"SOA\" LIMIT 1),
                        (SELECT \@data := NULL));
                SELECT \@doid:= id from pdns.domains where name = \"$dmn_name\";
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT \@data, \@doid,  \"$dmn_name\", \"SOA\",
                                concat( \"ns1.deltaweb.de. hostmaster.deltaweb.de.\",
CURDATE( ) +0, \"00 86400 7200 604800 1800\") ,
                                21600, 0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE domain_id = \@doid, type = \"SOA\",
                                content = concat(\"ns1.deltaweb.de.
hostmaster.deltaweb.de.\",CURDATE() + 0,\"00 86400 7200 604800 1800\"),
                                ttl= 21600, prio=0, change_date = Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = \"$dmn_name\" AND type
= \"NS\" AND content = \"ns1.deltaweb.de\" LIMIT 1)>0,
                        (SELECT \@data := id FROM pdns.records WHERE name = \"$dmn_name\"
AND type = \"NS\" AND content = \"ns1.deltaweb.de\" LIMIT 1),
                        (SELECT \@data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT \@data, \@doid, \"$dmn_name\", \"NS\", \"ns1.deltaweb.de\",
21600, 0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE  domain_id = \@doid, type = \"NS\",
                                content = \"ns1.deltaweb.de\", ttl= 21600, prio=0,
change_date = Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = \"$dmn_name\" AND type
= \"NS\" AND content = \"ns2.deltaweb.de\" LIMIT 1)>0,
                        (SELECT  \@data := id FROM pdns.records WHERE name = \"$dmn_name\"
AND type = \"NS\" AND content = \"ns2.deltaweb.de\" LIMIT 1),
                        (SELECT \@data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT \@data, \@doid, \"$dmn_name\", \"NS\", \"ns2.deltaweb.de\",
21600, 0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE name =  \"$dmn_name\", domain_id = \@doid,
type = \"NS\",
                        content = \"ns2.deltaweb.de\", ttl= 21600, prio=0, change_date =
Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = \"$dmn_name\" AND type
= \"MX\" AND content = \"mx.deltaweb.de\" LIMIT 1)>0,
                         (SELECT \@data := id FROM pdns.records WHERE name = \"$dmn_name\"
AND type = \"MX\" AND content = \"mx.deltaweb.de\" LIMIT 1),
                         (SELECT \@data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT \@data, \@doid, \"$dmn_name\", \"MX\", \"mx.deltaweb.de\",
21600, 10, Unix_timestamp( )
                        FROM pdns.domains t1 where t1.name = \"$dmn_name\"
                        ON DUPLICATE KEY UPDATE domain_id = \@doid, type = \"MX\", content
= \"mx.deltaweb.de\", ttl= 21600, prio=10,
                                change_date = Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = \"$dmn_name\" AND type
= \"A\" LIMIT 1)>0,
                        (SELECT \@data := id FROM pdns.records WHERE name = \"$dmn_name\"
AND type = \"A\" LIMIT 1),
                        (SELECT \@data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT \@data, \@doid, \"$dmn_name\", \"A\", \"$dmn_ip\", 21600,
0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE name =  \"$dmn_name\", domain_id = \@doid,
type = \"A\",
                                content = \"$dmn_ip\", ttl= 21600, prio=0,  change_date =
Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = \"www.$dmn_name\" AND
type = \"A\" LIMIT 1)>0,
                        (SELECT \@data := id FROM pdns.records WHERE name =
\"www.$dmn_name\" AND type = \"A\" LIMIT 1),
                        (SELECT \@data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT \@data, \@doid, \"www.$dmn_name\", \"A\", \"$dmn_ip\",
21600, 0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE domain_id = \@doid, type = \"A\", content
= \"$dmn_ip\",ttl= 21600, prio=0, change_date = Unix_timestamp();
                COMMIT;
             };

        my $sth = $dbh->prepare($mySQL);
        $sth->execute();
        $sth->finish();
        $dbh->disconnect();


-----

Mysql.log das einfach so in PHPMyAdmin oder in MySQL über root rein und alle sind
glücklich ich komme einfach nicht drauf wo der Fehler liegt 

                SELECT IF((SELECT id FROM pdns.records WHERE name = "absd.com" AND TYPE =
"SOA" LIMIT 1)>0,
                        (SELECT @data := id FROM pdns.records WHERE name = "absd.com" AND
TYPE = "SOA" LIMIT 1),
                        (SELECT @data := NULL));
                SELECT @doid:= id from pdns.domains where name = "absd.com";
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT @data, @doid,  "absd.com", "SOA",
                                concat( "ns1.deltaweb.de. hostmaster.deltaweb.de.",
CURDATE( ) +0, "00 86400 7200 604800 1800") ,
                                21600, 0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE domain_id = @doid, type = "SOA",
                                content = concat("ns1.deltaweb.de.
hostmaster.deltaweb.de.",CURDATE() + 0,"00 86400 7200 604800 1800"),
                                ttl= 21600, prio=0, change_date = Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = "absd.com" AND type =
"NS" AND content = "ns1.deltaweb.de" LIMIT 1)>0,
                        (SELECT @data := id FROM pdns.records WHERE name = "absd.com" AND
type = "NS" AND content = "ns1.deltaweb.de" LIMIT 1),
                        (SELECT @data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT @data, @doid, "absd.com", "NS", "ns1.deltaweb.de", 21600,
0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE  domain_id = @doid, type = "NS",
                                content = "ns1.deltaweb.de", ttl= 21600, prio=0,
change_date = Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = "absd.com" AND type =
"NS" AND content = "ns2.deltaweb.de" LIMIT 1)>0,
                        (SELECT  @data := id FROM pdns.records WHERE name = "absd.com" AND
type = "NS" AND content = "ns2.deltaweb.de" LIMIT 1),
                        (SELECT @data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT @data, @doid, "absd.com", "NS", "ns2.deltaweb.de", 21600,
0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE name =  "absd.com", domain_id = @doid,
type = "NS",
                        content = "ns2.deltaweb.de", ttl= 21600, prio=0, change_date =
Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = "absd.com" AND type =
"MX" AND content = "mx.deltaweb.de" LIMIT 1)>0,
                         (SELECT @data := id FROM pdns.records WHERE name = "absd.com" AND
type = "MX" AND content = "mx.deltaweb.de" LIMIT 1),
                         (SELECT @data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT @data, @doid, "absd.com", "MX", "mx.deltaweb.de", 21600,
10, Unix_timestamp( )
                        FROM pdns.domains t1 where t1.name = "absd.com"
                        ON DUPLICATE KEY UPDATE domain_id = @doid, type = "MX", content =
"mx.deltaweb.de", ttl= 21600, prio=10,
                                change_date = Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = "absd.com" AND type =
"A" LIMIT 1)>0,
                        (SELECT @data := id FROM pdns.records WHERE name = "absd.com" AND
type = "A" LIMIT 1),
                        (SELECT @data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT @data, @doid, "absd.com", "A", "193.239.107.18", 21600, 0,
Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE name =  "absd.com", domain_id = @doid,
type = "A",
                                content = "193.239.107.18", ttl= 21600, prio=0,
change_date = Unix_timestamp();
                SELECT IF((SELECT id FROM pdns.records WHERE name = "www.absd.com" AND
type = "A" LIMIT 1)>0,
                        (SELECT @data := id FROM pdns.records WHERE name = "www.absd.com"
AND type = "A" LIMIT 1),
                        (SELECT @data := NULL));
                INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio,
change_date)
                        SELECT @data, @doid, "www.absd.com", "A", "193.239.107.18", 21600,
0, Unix_timestamp( )
                        ON DUPLICATE KEY UPDATE domain_id = @doid, type = "A", content =
"193.239.107.18",ttl= 21600, prio=0, change_date = Unix_timestamp();
                COMMIT


Mit freundlichen Grüßen

Drießen

-- 
Software & Computer
Uwe Drießen
Lembergstraße 33
67824 Feilbingert
Tel.: +49 06708 / 660045   Fax: +49 06708 / 661397


_______________________________________________
Allgemeine Infos zur Liste: http://www.4t2.com/mysql/
Verwaltung: https://lists.4t2.com/cgi-bin/mailman/listinfo/mysql-de

php::bar PHP Wiki   -   Listenarchive