Re: facing problem in outparameters in c

From: Mahesh Bodepati <mahesh(dot)bodepati(at)Xius(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: facing problem in outparameters in c
Date: 2020-10-28 10:05:44
Message-ID: MAXPR01MB3647EA409E3A2B5C23AE0CB096170@MAXPR01MB3647.INDPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

whatever you said is correct but actually what i want is whenever iam calling the postgres function by passing input and output parameters in c ,after execution of postgres function in database side they will return output paramers .after that when i print the output variable name i need that output parameter value diretcly without differenciating with column names.

Thanks & Regards,
Mahesh Bodepati
Software Engineer- Engineering
XIUS
INNOVATE . LEAD.
mahesh(dot)bodepati(at)xius(dot)com<mailto:battini(dot)subrahmanyam(at)xius(dot)com>
http://www.xius.com<http://www.xius.com/>

________________________________
From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Sent: Wednesday, October 28, 2020 12:29 PM
To: Mahesh Bodepati <mahesh(dot)bodepati(at)Xius(dot)com>; pgsql-general(at)lists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: facing problem in outparameters in c

On Wed, 2020-10-28 at 04:57 +0000, Mahesh Bodepati wrote:
> Actually i am calling a postgres function by using c language which description
> is defined in database side .when iam calling a postgres function by passing input
> and output parameters after excution of function in database side i need output
> data in correcsponding output parameters but iam not getting output like that.

Right; output parameters in a function are columns in the result set.

> i am getting total output data in response pointer.if iam getting total data
> in response pointer it is hard to figure out which data is for which output parameter.

No, that is very simple. You can call PQfnumber on the result set to find which
position in the result set belongs to a certain parameter name.

See https://www.postgresql.org/docs/current/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO

> can you please check once attached two text files.

I looked, and the C code is unreadable.
You seem to be mixing embedded SQL and libpq calls, which you shouldn't.
There is great value in a consistent indentation style.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2020-10-28 10:39:14 Re: facing problem in outparameters in c
Previous Message Dirk Krautschick 2020-10-28 09:22:47 Backup Restore from other node after switchover/failover