Yes, you was right about VARDATA (working code below, maybe it will help
others), the problem was that I could not find documentation for VARDATA,
maybe you can point to it?
Also, about the
ats = pclose (sendmail);
PG_RETURN_TEXT_P( ats );
Yes, ats is integer, so what is wrong here? actually it is working
normally, or I should know something more?
Code is here:
text *To, *Subject, *Body;
To = PG_GETARG_TEXT_P(0);
char *cTo = (char *) calloc(VARSIZE(To) - VARHDRSZ, sizeof(char));
strncpy(cTo, VARDATA(To), VARSIZE(To)-VARHDRSZ);
fprintf (sendmail, "To: %s\n", cTo);
Lukas at nsoft.lt
+370 655 10 655
> "Lukas" <lukas(at)fmf(dot)vtu(dot)lt> writes:
>> I am trying to write simple PG Lib on C (on Linux), it is working, bus
>> have some problem with data types, maybe someone can explain me a little
> You're assuming that VARDATA() produces a null-terminated string.
> It doesn't. You either need to call textout to get a null-terminated
> string, or fix the fprintf calls to pay attention to the actual
> string length.
>> ats = pclose (sendmail);
>> PG_RETURN_TEXT_P( ats );
> ... and this part is even less likely to work. pclose returns an
> regards, tom lane
> Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
> To make changes to your subscription:
> This message has been scanned for viruses and
> dangerous content by OpenProtect(http://www.openprotect.com), and is
> believed to be clean.
This message has been scanned for viruses and
dangerous content by OpenProtect(http://www.openprotect.com), and is
believed to be clean.
In response to
- IN vs = at 2009-01-26 20:48:08 from Lukas
pgsql-novice by date
|Next:||From: Wright, George||Date: 2009-01-12 14:18:28|
|Subject: debugging plpgsql functions|
|Previous:||From: Peter Jackson||Date: 2009-01-11 22:51:59|
|Subject: Re: Foreign Keys|