Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use DBI;
- use warnings;
- use Data::Dumper;
- read_tables();
- #syslog_database_settings();
- #read_syslog_database();
- #break_apart_results();
- #customer_firewall_database_settings();
- #read_syslog_database();
- ##
- # This sub will query the database to get a list of the tables
- ##
- sub read_tables {
- $host = "localhost";
- $user = "root";
- $pass = "password";
- $database = "faz";
- $db = "faz";
- $query = "show tables";
- $dbh = DBI->connect("DBI:mysql:$db:$host", $user, $pass);
- $sqlQuery = $dbh->prepare($query) or die "Can't prepare $query: $dbh->errstr\n";
- $rv = $sqlQuery->execute or die "can't execute the query: $sqlQuery->errstr";
- while (@row= $sqlQuery->fetchrow_array()) {
- my $tables = $row[0];
- print "$row[0]\n";
- $myquery = $dbh->prepare("SELECT * FROM $tables") or die "Can't prepare $query: $dbh->errstr\n";
- $myquery->execute or die "can't execute the query: $sqlQuery->errstr";
- }
- }
- The exact error is
- sydnms003:/home/ckilian/scripts# ./log.pl
- FG100A3907507179-alog-20110323124340 <-------- THIS IS THE TABLE NAME
- DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-alog-20110323124340' at line 1 at ./log.pl line 49.
- can't execute the query: DBI::st=HASH(0x92710a0)->errstr at ./log.pl line 49.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement