Postgesql lib
От | Lukas |
---|---|
Тема | Postgesql lib |
Дата | |
Msg-id | 15364.217.117.29.29.1231492092.squirrel@fmf.vgtu.lt обсуждение исходный текст |
Ответы |
Re: Postgesql lib
|
Список | pgsql-novice |
Hello, 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: 1. What is wrong with my assignments (first To = PG_GETARG_TEXT_P(0), later VARDATA(To)? Because send mail gets something like this "lukas@xxxxx.ltB?" when I am giving "lukas@xxxxx.lt" as a function parameter in sql query. 2. Can anyone explain use and return values of VARDATA? 3. Any more comments on code below? it works, but data passes to sendmail is with "garbage"..? Datum hello( PG_FUNCTION_ARGS ); PG_FUNCTION_INFO_V1( hello ); Datum hello( PG_FUNCTION_ARGS ) text *To, *Subject, *Body; To = PG_GETARG_TEXT_P(0); Subject = PG_GETARG_TEXT_P(1); Body = PG_GETARG_TEXT_P(2); FILE *sendmail; sendmail = popen (SENDMAILPATH, "w"); fprintf (sendmail, "To: %s\n", VARDATA(To)); fprintf (sendmail, "Subject: %s\n", VARDATA(Subject)); fprintf (sendmail, "%s\n", VARDATA(Body)); ats = pclose (sendmail); PG_RETURN_TEXT_P( ats ); Thank you Lukas UAB nSoft +370 655 10 655 http://www.nsoft.lt -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.
В списке pgsql-novice по дате отправления: