[Dbi-interbase-devel] Question about select , update or insert...
Status: Beta
Brought to you by:
edpratomo
From: swade <sw...@di...> - 2001-07-01 22:16:59
|
Hello, I'm new here...I'm sure this question has been asked a million = times but I've recently switched over to DBI:Interbase from DBI:Oracle... reading over some of tims online docs, I saw something like this aka update...if not there, then insert.=20 $upd=3D$dbh->prepare("update test set COUNT=3DCOUNT+1 where = account_id=3D?"); $ins=3D$dbh->prepare("insert into test (account_id,COUNT) values = (?,?)"); $rows=3D$upd->execute($account_id); print "ROWS: $rows\n"; $ins->execute($account_id,1) if $rows < 0; $dbh->disconnect; Reading the dbi interbase docs, and running the above, I've surmised = that $rows will always return a -1. Is there another technique to accomplish something similiar, or do you = have to: select X from X where X=3D? yada....return to $myvar if ($myvar eq "") { insert.... } else { update.... } Thanks for any pointers.... shawn |