Re: existance of a select statement

2002-09-27 Thread Tim Bunce
On Thu, Sep 26, 2002 at 11:30:28PM +0200, Bart Lateur wrote: > On Thu, 26 Sep 2002 21:46:16 +0100, Tim Bunce wrote: > > >If that may happen then it's safer to try the insert first and if that > >fails due to a duplicate key then do the update. > > At least MS Access has the problem that an autoi

Re: existance of a select statement

2002-09-26 Thread Vladimir Pozek
Hardy Merrill wrote: > > Be careful about using the "rows" method - here's a section > from 'perldoc DBI': > >"rows" > $rv = $sthâ??>rows; > >Returns the number of rows affected by the last row affecting comâ?? >mand, or â^?1 if the number of rows is

Re: existance of a select statement

2002-09-26 Thread Bart Lateur
On Thu, 26 Sep 2002 21:46:16 +0100, Tim Bunce wrote: >If that may happen then it's safer to try the insert first and if that >fails due to a duplicate key then do the update. At least MS Access has the problem that an autoincrement field (or whatever it is called in Access) IS incremented even i

Re: existance of a select statement

2002-09-26 Thread Tim Bunce
On Thu, Sep 26, 2002 at 02:10:00PM -0600, Tkil wrote: > > "Chad" == chad kellerman <[EMAIL PROTECTED]> writes: > > Chad> I want to check to see if the hosts exists. IF it does update > Chad> if not insert. > > Note that some databases have this functionality built-in; MySQL has a > REPLACE

Re: existance of a select statement

2002-09-26 Thread Hardy Merrill
Be careful about using the "rows" method - here's a section from 'perldoc DBI': "rows" $rv = $sth‐>rows; Returns the number of rows affected by the last row affecting com‐ mand, or −1 if the number of rows is not known or not available. Gener

Re: existance of a select statement

2002-09-26 Thread Tkil
> "Chad" == chad kellerman <[EMAIL PROTECTED]> writes: Chad> I want to check to see if the hosts exists. IF it does update Chad> if not insert. Note that some databases have this functionality built-in; MySQL has a REPLACE primitive that does exactly this. In other databases, I typically t

Re: existance of a select statement

2002-09-26 Thread Vladimir Pozek
chad kellerman wrote: > > Hello everyone, > >I was wondering, what would be the easiest way to check for the > results of a select statement? > >For example, if I connect and say select host from host where > host="domain.com"; > >I want to check to see if the hosts exists. > >

existance of a select statement

2002-09-26 Thread chad kellerman
Hello everyone, I was wondering, what would be the easiest way to check for the results of a select statement? For example, if I connect and say select host from host where host="domain.com"; I want to check to see if the hosts exists. IF it does update if not insert. I have: my $