in reply to Re^2: For each loop through mysql db to run Net::Telnet command
in thread For each loop through mysql db to run Net::Telnet command
First suggestion is to get rid of the "or die" statements, by specifying the raise error option during the dB connect. A little short of time this morning, but the below is some actual working code from a few days ago on an SQLite DB. I use $dbh for the data base handle. You can follow this pattern.
my %attr = ( RaiseError => 1); #auto die with error printout my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfilename","","",\%attr) or die "Couldn't connect to database $dbfilename: " . DBI->errstr; my $get_qsos = $dbh->prepare ("SELECT * FROM raw_qsos WHERE rcv_call = ?"); $get_qsos->execute($call); my $resultRef = $get_qsos->fetchall_arrayref; my $n_dbQso = scalar(@$resultRef); #number of rows with that call
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: For each loop through mysql db to run Net::Telnet command
by jay83 (Novice) on Nov 14, 2022 at 13:15 UTC |