Skip site navigation (1) Skip section navigation (2)

Re: type text in c functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Robert Wimmer" <seppwimmer(at)hotmail(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: type text in c functions
Date: 2004-12-19 03:21:07
Message-ID: 8230.1103426467@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-interfaces
"Robert Wimmer" <seppwimmer(at)hotmail(dot)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

In response to

pgsql-interfaces by date

Next:From: atanu ghoshDate: 2004-12-21 04:41:04
Subject: which front - end tools will support in PostgreSQL
Previous:From: Robert WimmerDate: 2004-12-19 01:16:44
Subject: type text in c functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group