Help with mysqlpp and a perl script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gwigg
    New Member
    • Feb 2008
    • 4

    Help with mysqlpp and a perl script

    Hi, am am having a problem with extracting all the data I want using a perl script the data being in a mysql database. The script works fine until row 59101 is reached in the 1st table, anyone aware of any limitations? The database is an ip geo laction database to be found at www.hostip.info. I am using active perl, the db is on my local xp laptop

    thanks
    Guy

    Here is the script:
    [code=perl]
    #!/usr/local/bin/perl
    use strict;
    use warnings;
    use DBI;

    my $num=226;

    my $dbh = DBI->connect("dbi:m ysqlPP:database =iplocation:hos t=localhost","r oot","********* ",{'RaiseEr ror' =>1});
    my @ranges = $dbh -> tables;
    open(my $out, ">", "output.txt ") or die "Can't open output.txt: $!";
    for(my $i=2; $i<(@ranges); $i++)
    {
    my $sth = $dbh -> prepare (qq{select * from $ranges[$i] where country = $num});
    $sth -> execute ();
    print "checking table $ranges[$i]\n";
    while (my $ref = $sth->fetchrow_array ref())
    {
    print $out "IP address is $ranges[$i].$ref->[0].$ref->[1]\n";
    $sth->finish();
    }
    }
    close $out or die "$out: $!";

    $dbh->disconnect ();
    [/code]
    _______________
    Here is the last entry in output.txt where the code hangs:

    $ tail output.txt
    IP address is ip4_0.255.212
    IP address is ip4_0.255.213
    IP address is ip4_0.255.214
    IP address is ip4_0.255.215
    IP address is ip4_0.255.216
    IP address is ip4_0.255.217
    IP address is ip4_0.255.218
    IP address is ip4_0.255.219
    IP address is ip4_0.255.220
    IP ad


    What is strange is that it doesn't complete the print of IP address is

    thanks
    Guy
    Last edited by numberwhun; Feb 18 '08, 01:10 PM. Reason: add code tags
  • gwigg
    New Member
    • Feb 2008
    • 4

    #2
    The version of Active perl I am running is:

    This is perl, v5.10.0 built for MSWin32-x86-multi-thread
    (with 1 registered patch, see perl -V for more detail)

    and the version of mysql is Server version: 5.0.45-community-nt MySQL Community Edition (GPL)

    Comment

    • eWish
      Recognized Expert Contributor
      • Jul 2007
      • 973

      #3
      I don't know of any limitations and I don't think it is a Perl issue. I would suggest asking the MySQL forum and/or check the docs at Mysql to see if there are any limitations.

      --Kevin

      Comment

      Working...