|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
use DBI;
|
|
|
$db = DBI->connect('dbi:ODBC:PRICE', 'user', 'password',
|
|
|
{ RaiseError => 1 });
|
|
|
$upd = $db->prepare('UPDATE prices SET price=? WHERE prod=?');
|
|
|
$ins = $db->prepare('INSERT INTO prices(prod,price) VALUES
(?,?)');
|
|
while
($line = <COST>) {
|
|
|
. . .
|
|
|
$rows =
$upd->execute($price, $prod);
|
|
|
$ins->execute($prod,$price) if $rows == 0;
|
|
|
}
|
|
|
$db->commit;
|
|
|
|