Re: type text in c functions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: type text in c functions
Дата
Msg-id 8230.1103426467@sss.pgh.pa.us
обсуждение исходный текст
Ответ на type text in c functions  ("Robert Wimmer" <seppwimmer@hotmail.com>)
Список pgsql-interfaces
"Robert Wimmer" <seppwimmer@hotmail.com> writes:
>   text *t = PG_GETARG_TEXT_P(0);

>   l = VARSIZE(t) - VARHDRSZ;

>   for (i = 0; i < l; i++) { if ( (t->vl_dat[i] < '0') || (t->vl_dat[i] > 
> '9')) break; }

>   if (i==l) ret = 0;
>   else ret = i;

I think you need to rethink your return convention --- success and
failure at the first character both return 0.

Directly using the vl_dat field doesn't seem like good style (you won't
find it anywhere in the backend sources) but it works.
        regards, tom lane


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: "Robert Wimmer"
Дата:
Сообщение: type text in c functions
Следующее
От: atanu ghosh
Дата:
Сообщение: which front - end tools will support in PostgreSQL