retrieving multiple results?

From: Lonnie Cumberland <lonnie_cumberland(at)yahoo(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: retrieving multiple results?
Date: 2001-04-16 02:39:39
Message-ID: 20010416023939.96139.qmail@web12504.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hello All,

I am still trying to figure out the VARDATA stuff so that I can take two char
strings and do a character-by-character comparison. This type of questions is
really related to the previous email where I an trying to use my old function
that had character pointers to translate one character string into another, but
now I have to look at using the VARDATA() wrappers.

My other problem is that I have a structure in my C code that has two character
fields and I need to operate on them in C and then return the structure to
PL/pgSQL calling function with two results.

for example I might have something like:

typedef struct testmode
{
char val1[100];
char val2[100];
} testmode;

then maybe a function that could be like this:

testmode *work(char *name, int someval)
{
testmode *result;
char v1[100];
char v2[100];
char v3[100];

strcpy(v3,name);

val1[0]='x';
val2[0]='y';

if(val2[0]==val1[1])
{
val1[1]='s';
strcpy(result->val1,'good');
strcpy(result->val2,'good');
}
else
{
strcpy(result->val1,'good');
strcpy(result->val2,'good');
}

return result;
}

Although this little function does not do anything very useful, it does exhibit
everythin that I will need to try and implement in my extension "C" functions
so if there is anybody who could show me how to use the VARDATA() stuff and
also return a structure to my calling function in PL/pgSQL then I would REALLY
appreciate it.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/

Browse pgsql-interfaces by date

  From Date Subject
Next Message Avinash K.G 2001-04-16 08:26:48
Previous Message Sterin, Ilya 2001-04-16 02:04:24 RE: DBD and DBI::Pg