Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: Using a com...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 9 Topic 15486 of 16953
Post > Topic >>

Re: Using a composite SQL type in C

by odnamr@[EMAIL PROTECTED] ("Toby Chavez") May 8, 2008 at 11:11 AM

------=_Part_2577_18885070.1210266688103
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Check the do***entation about using composite-type arguments in C
http://www.postgresql.org/docs/8.2/static/xfunc-c.html#AEN37402

You can use GetAttributeByNum() or GetAttributeByName() to get each value
from your custom type. You will need to get the HeapTupleHeader first by
calling PG_GETARG_HEAPTUPLEHEADER(). A quick google search brought up this
tutorial that might help http://linuxgazette.net/142/peterson.html

Cheers

>
> My problem is, how do I access this type in my function (in C), and how
do
> I create a new object of this type to return from the function?  I need
to
> store both a text and an int, to avoid doing an extra query around the
> result of this aggregate (to get the corresponding text value), which is
> what I'm currently doing.  Any ideas?
>
>

------=_Part_2577_18885070.1210266688103
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div class="gmail_quote">
<p>Check the do***entation about using composite-type arguments in C <a
href="http://www.postgresql.org/docs/8.2/static/xfunc-c.html#AEN37402">http://www.postgresql.org/docs/8.2/static/xfunc-c.html#AEN37402</a></p>
<p>You can use GetAttributeByNum() or GetAttributeByName() to get each
value from your custom type. You will need to get the HeapTupleHeader
first by calling PG_GETARG_HEAPTUPLEHEADER(). A quick google search
brought up this tutorial that might help <a
href="http://linuxgazette.net/142/peterson.html">http://linuxgazette.net/142/peterson.html</a></p>

<p>Cheers</p>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px
0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>My problem is, how do I access
this type in my function (in C), and how do I create a new object of this
type to return from the function? &nbsp;I need to store both a text and an
int, to avoid doing an extra query around the result of this aggregate (to
get the corresponding text value), which is what I&#39;m currently doing.
&nbsp;Any ideas?<br>
<br></blockquote></div>
<p><br>&nbsp;</p>

------=_Part_2577_18885070.1210266688103--
 




 9 Posts in Topic:
Custom Base Type in C
odnamr@[EMAIL PROTECTED]   2008-05-07 17:06:40 
Re: Custom Base Type in C
david.t.wilson@[EMAIL PRO  2008-05-07 19:12:56 
Re: Custom Base Type in C
alvherre@[EMAIL PROTECTED  2008-05-07 19:15:10 
Using a composite SQL type in C
heron@[EMAIL PROTECTED]   2008-05-07 17:29:32 
Re: Custom Base Type in C
odnamr@[EMAIL PROTECTED]   2008-05-07 18:02:29 
Re: Custom Base Type in C
odnamr@[EMAIL PROTECTED]   2008-05-07 18:14:46 
Re: Custom Base Type in C
dim@[EMAIL PROTECTED] (D  2008-05-08 14:03:39 
Re: Using a composite SQL type in C
odnamr@[EMAIL PROTECTED]   2008-05-08 11:11:26 
Re: Using a composite SQL type in C
heron@[EMAIL PROTECTED]   2008-05-08 11:20:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 9:59:08 CDT 2008.