pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lonnie Cumberland <lonnie_cumberland@yahoo.com>
To: pgsql-interfaces@postgresql.org
Subject: retrieving multiple results?
Date: Sun, 15 Apr 2001 19:39:39 -0700 (PDT)
Message-ID: <20010416023939.96139.qmail@web12504.mail.yahoo.com> (raw)

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/



Message-ID: <20010416023939.96139.qmail@web12504.mail.yahoo.com>
Permalink:  ../20010416023939.96139.qmail@web12504.mail.yahoo.com/
Also on:    postgresql.org/message-id/20010416023939.96139.qmail@web12504.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: lonnie_cumberland@yahoo.com
  Subject: Re: retrieving multiple results?
  In-Reply-To: <20010416023939.96139.qmail@web12504.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox