Thread: Re: [webmaster] Question

Re: [webmaster] Question

From
Fernando Fernández
Date:
Ok :))

I am developing a Windows application, under NT 4 version.
I am connecting to database throught ODBC (I had installed postgreSQL
drivers)
My database version... mmm... I am not sure, but I think 7.4.2 version
I am programing in Visual FoxPro 8.0, but this information is not important
I think.

In sql i can do something like this::
    begin transaction
        Update .... where clave= @clave
        IF @@error= 0  and @@rowcount= 0
            Insert ... ( @clave, .... )
    commit transaction

I don't know wether "@@rowcount" exists in postgreSQL
Thanks you in general and in special to this "someone" that will be happy to
give me some help.

From Palma de Mallorca
Fernando



----- Original Message -----
From: "Robert Treat" <xzilla@users.sourceforge.net>
To: "Fernando Fernández" <ffernandez@aircomp.aero>
Cc: <webmaster@postgresql.org>
Sent: Friday, November 12, 2004 4:11 PM
Subject: Re: [webmaster] Question


On Fri, 2004-11-12 at 07:34, Fernando Fernández wrote:
> Hi :))
> I am Fernando, from Mallorca - Spain
>
> I am using PostgreSQL for my databases. Everything is going all right,
> but now i need in my application to know how many records has updated an
> update command.
>
> I know I can do something like:
> SELECT COUNT(*) AS xCount FROM ...
> IF xCount = 0
>     INSERT ...
> ELSE
>     UPDATE ...
> ENDIF
>
> but I would like do something like:
> UPDATE ...
> IF records_updated = 0
>     INSERT
> ENDIF
>
> is it possible?

Yes, this is certainly possible, but there's no way we can explain it to
you without knowing some details of your work environment. Please send
an email to either pgsql-novice@postgresql.org or
pgsql-general@postgresql.org that includes some details of your
programming environment (pl language, php, C, whatever; database
version; any driver layers involved) and someone will be happy to give
you some more detailed help.

Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL