Unix Technical Forum

clone varlena function

This is a discussion on clone varlena function within the pgsql Hackers forums, part of the PostgreSQL category; --> Hello, I am cleaning orafce module and I would to eliminate duplicit code with core. Is in core similar ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 10:43 PM
Pavel Stehule
 
Posts: n/a
Default clone varlena function

Hello,

I am cleaning orafce module and I would to eliminate duplicit code
with core. Is in core similar macro or function?

text*
ora_clone_text(text *t)
{
text *result;

result = palloc(VARSIZE(t));
SET_VARSIZE(result, VARSIZE(t));
memcpy(VARDATA(result), VARDATA(t), VARSIZE(t) - VARHDRSZ);

return result;
}

It can be used for any varlena datatype.

Thank you
Pavel Stehule

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 10:43 PM
Tom Lane
 
Posts: n/a
Default Re: clone varlena function

"Pavel Stehule" <pavel.stehule@gmail.com> writes:
> I am cleaning orafce module and I would to eliminate duplicit code
> with core. Is in core similar macro or function?


datumCopy?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-15-2008, 10:43 PM
Pavel Stehule
 
Posts: n/a
Default Re: clone varlena function

On 02/02/2008, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Pavel Stehule" <pavel.stehule@gmail.com> writes:
> > I am cleaning orafce module and I would to eliminate duplicit code
> > with core. Is in core similar macro or function?

>
> datumCopy?
>


yes, it is it.

thank you

Pavel Stehule

> regards, tom lane
>


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:12 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com