By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,250 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,250 IT Pros & Developers. It's quick & easy.

Help with mysqlpp and a perl script

P: 4
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:
Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl
  2. use strict;
  3. use warnings;
  4. use DBI;
  5.  
  6. my $num=226;
  7.  
  8. my $dbh = DBI->connect("dbi:mysqlPP:database=iplocation:host=localhost","root","*********",{'RaiseError' =>1});
  9. my @ranges = $dbh -> tables;
  10. open(my $out, ">", "output.txt") or die "Can't open output.txt: $!";
  11. for(my $i=2; $i<(@ranges); $i++)
  12.     { 
  13.      my $sth = $dbh -> prepare (qq{select * from $ranges[$i] where country = $num});
  14.     $sth -> execute ();
  15.     print "checking table $ranges[$i]\n";
  16.     while (my $ref = $sth->fetchrow_arrayref())
  17.         {
  18.         print $out "IP address is $ranges[$i].$ref->[0].$ref->[1]\n";
  19.         $sth->finish();   
  20.         }
  21.     }
  22. close $out or die "$out: $!";
  23.  
  24. $dbh->disconnect ();
  25.  
_______________
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
Feb 18 '08 #1
Share this Question
Share on Google+
2 Replies


P: 4
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)
Feb 19 '08 #2

eWish
Expert 100+
P: 971
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
Feb 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.