473,378 Members | 1,309 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,378 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 1427
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.