Обсуждение: retrieving multiple results?

Поиск
Список
Период
Сортировка

retrieving multiple results?

От
Lonnie Cumberland
Дата:
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/