473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

C Functions, datatypes

I'm writing a function in C, and am trying to return a row, containing Numeric and array types. I'm building the row with heap_formtuple. I'm havingtrouble creating the numeric and array Datums. If anyone has some examplecode illustrating this, that'd be great.
-Adam
Nov 23 '05 #1
3 1428
On Mon, May 03, 2004 at 12:48:19PM -0700, A Palmblad wrote:
I'm writing a function in C, and am trying to return a row, containing
Numeric and array types. I'm building the row with heap_formtuple.
I'm having trouble creating the numeric and array Datums. If anyone
has some example code illustrating this, that'd be great. -Adam


I think best examples you can found in the pgsql/src/backend/utils/adt
directory where is almost all PostgreSQL code with datatypes.

Karel

--
Karel Zak <za***@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

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

Nov 23 '05 #2
On Mon, May 03, 2004 at 12:48:19PM -0700, A Palmblad wrote:
I'm writing a function in C, and am trying to return a row, containing
Numeric and array types. I'm building the row with heap_formtuple.
I'm having trouble creating the numeric and array Datums. If anyone
has some example code illustrating this, that'd be great. -Adam


I think best examples you can found in the pgsql/src/backend/utils/adt
directory where is almost all PostgreSQL code with datatypes.

Karel

--
Karel Zak <za***@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

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

Nov 23 '05 #3
A Palmblad wrote:
I'm writing a function in C, and am trying to return a row,
containing Numeric and array types. I'm building the row with
heap_formtuple. I'm having trouble creating the numeric and array
Datums. If anyone has some example code illustrating this, that'd be
great.


See PL/R for examples:
http://www.joeconway.com/plr/

Specifically:

plr.c:do_compile()
gathering required information for input conversion of return values

pg_conversion.c:get_scalar_datum()
conversion from (char *value) to Datum using the gathered info for
scalar return datums

pg_conversion.c:get_generic_array_datum()
conversion from multiple (char *values) to Datum using the gathered
info for array return datums

HTH,

Joe

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: vrillusions | last post by:
I've been using functions since I first started using php, but I've been hearing more and more about classes, which I never really looked at that much. I understand the whole OO programming...
37
by: Kay Schluehr | last post by:
Since George Sakkis proposed a new way of doing list comprehensions http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/ac5023ad18b2835f/d3ff1b81fa70c8a7#d3ff1b81fa70c8a7 ...
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
20
by: Ivar | last post by:
Hi, For my supprise I found that functions have 32 parameter limit. Where to find more info about this limitation or similar limitations ? I need at least 50, 100 would be ok. Real life...
2
by: Michael Glaesemann | last post by:
Just finding out about the tinterval type (thanks again, Alvaro!), I've been looking to see what operators and functions are already built-in to PostgreSQL that involve this type. I thought I'd...
2
by: Florian G. Pflug | last post by:
Hi I faintly remember that I once stumbled upon a way to declare variadic functions (functions that take a variable number of arguments) in plpgsql - but I just searched the docs and can't find...
2
by: Gellert, Andre | last post by:
Hello, I have following problem: A user "xy" shouldn't have any rights to a table, but needs data from the content of the table. My idea was to setup a PL/PGSQL procedure to fetch the data...
1
by: Mike Mascari | last post by:
Hello. I'm writing SQL functions that take an action code and determine the rows visible by accessing application-maintained privilege tables. Here's an example: CREATE FUNCTION...
4
by: Tk421 | last post by:
I've made some functions, an i want these functions to be used by a specified user, but i don't want this user can see the code of the functions. Does somebody knows how can i do this? Sorry about...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.