in reply to DBI using wrong connection
Note that using $dbh->quote is not neccessary when you use placeholders. Also note that this is untested.my $insert_query = $cdbh->prepare("insert into keyword (zkey, value) v +alues (?, ?)"; while ($csth->fetch) { $query = "select $primarykey, $fieldname from $tablename"; # this sth uses the ODBC $dbh for the first three columns, but # tries to use the SQLite $cdbh for the 4th column my $sth = $::dbh->prepare($query); $sth->execute; my ($key, $value); $sth->bind_columns(\$key, \$value); while ($sth->fetch) { next if !$key; next if !$value; $value = lc($value); my @words = split(/\W/, $value); for (my $i = 0; $i < scalar(@words); $i++) { my $word = $words[$i - 1]; next if !$word; # trim $word =~ s|^ *(.+) *$|$1|; next if !$word; $insert_query->execute("$tablename.$key", $word)";); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DBI using wrong connection
by Stephen Toney (Sexton) on Sep 05, 2006 at 14:36 UTC |