Re: Postgesql lib
От | Lukas |
---|---|
Тема | Re: Postgesql lib |
Дата | |
Msg-id | 15970.217.117.29.29.1231763895.squirrel@fmf.vgtu.lt обсуждение исходный текст |
Ответ на | Re: Postgesql lib (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
IN vs =
|
Список | pgsql-novice |
Hello, 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); and latter: fprintf (sendmail, "To: %s\n", cTo); -- Lukas UAB nSoft http://www.nsoft.lt Lukas at nsoft.lt +370 655 10 655 > "Lukas" <lukas@fmf.vtu.lt> writes: >> I am trying to write simple PG Lib on C (on Linux), it is working, bus >> I >> have some problem with data types, maybe someone can explain me a little >> bit: > > 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 > integer. > > regards, tom lane > > -- > Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-novice > > -- > 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.
В списке pgsql-novice по дате отправления: