thanks, i already have a perl script that splits based on
the backslash. guess i'll just stick with that. thanks for
you time and suggestions.
mikeo
At 06:06 PM 8/15/00 -0400, mjp@ornl.gov wrote:
>Oops! You have to write a function for it. Here is a
>sample quick C function:
>
>typedef struct
>{ int len;
> char data[1];
>} string;
>
>string *byteatostr(bytea *arg)
>{
> char buf[1024];
> int ln,i;
> string *res;
> ln = VARSIZE(arg) - VARHDRSZ;
> memmove(buf, VARDATA(arg), ln);
> for(i=0; i < ln; i++)
> if( buf[i] < 32 ) buf[i]='?';
>
> res = (string *) palloc(VARHDRSZ + ln);
> memset(res, 0, VARHDRSZ + ln);
> res->len = VARHDRSZ + ln;
> memmove(res->data, buf, (int) ln);
> return res;
>}
>
>where all non-printable chars are replaced with '?'. Optionally,
>the chars can be escaped (prefixed with '\') - adjusting ln as neccessry.
>
>
>now you get:
>
># select byteatostr(col) from test2;
>
> byteatostr
>------------------------------------------------------------
> fk_uste_wu_id?us_states?web_users?UNSPECIFIED?wu_id?wu_id?
>(1 rows)