Ingres Community Forums Login Register Ingres.com  

Ingres Community Forum


Go Back   Ingres Community Forums > Community > The Ingres Community
 

Reply
 
LinkBack Thread Tools Display Modes
Old 2009-12-23   #1 (permalink)
Junior Member
 
Join Date: Dec 2009
Posts: 9
Unhappy Problem use the function Ingres existed in UDF

Hi all,


I'm working on User Define Function.
When I want to create a new function, how can I call(use) the function which already existed in my define function.

For exemple:
.....
II_STATUS
my_function(
II_SCB *scb,
II_DATA_VALUE *p1,
II_DATA_VALUE *rdv
){
string field1;
....
/*call the function*/
replace(field1, ':', '$')
....
}
....
Please give me more detail explain.


Thx

Last edited by zhaoxu710; 2009-12-23 at 12:28 AM.
zhaoxu710 is offline   Reply With Quote
Old 2009-12-23   #2 (permalink)
Junior Member
 
Join Date: Dec 2009
Posts: 9
Default

Have some ideas? No one read? Or my question isn't clear? Plz.
zhaoxu710 is offline   Reply With Quote
Old 2009-12-23   #3 (permalink)
Ingres Community
 
kschendel's Avatar
 
Join Date: Mar 2007
Location: Pittsburgh, PA
Posts: 1,099
Send a message via Skype™ to kschendel
Default

You have to call the ADF function that implements the SQL function you want to call. So for example if you wanted to call an integer coercion int4(xxx), you would have to call the adu_1int_coerce ADF function from your UDF, and pass it the necessary DB_DATA_VALUE (II_DATA_VALUE) and ADF_SCB (II_SCB) pointers.
kschendel is offline   Reply With Quote
Old 2009-12-24   #4 (permalink)
Ingres Community
 
Join Date: Oct 2007
Posts: 54
Default

Quote:
Originally Posted by zhaoxu710 View Post
Have some ideas? No one read? Or my question isn't clear? Plz.
You'd better read OME.pdf first in install_dir/ingres/file/. This pdf explains how OME and UDF works.
Also you could find some examples in install_dir/ingres/demo/udadts/. You could write your own udts according to these samples...

Chen zhen
zhenchen17 is offline   Reply With Quote
Old 2009-12-24   #5 (permalink)
Junior Member
 
Join Date: Dec 2009
Posts: 9
Default

Thx for your answer.
How I could find the relationship between every ADF function and function ingres?
Is there some doc or table to describ?
zhaoxu710 is offline   Reply With Quote
Old 2009-12-24   #6 (permalink)
Junior Member
 
Join Date: Dec 2009
Posts: 9
Default

Quote:
Originally Posted by zhenchen17 View Post
You'd better read OME.pdf first in install_dir/ingres/file/. This pdf explains how OME and UDF works.
Also you could find some examples in install_dir/ingres/demo/udadts/. You could write your own udts according to these samples...

Chen zhen
Hi CHEN ZHEN,

Thanks for your advice!
zhaoxu710 is offline   Reply With Quote
Old 2009-12-24   #7 (permalink)
Ingres Community
 
Join Date: Oct 2007
Posts: 54
Default

Quote:
Originally Posted by zhaoxu710 View Post
Thx for your answer.
How I could find the relationship between every ADF function and function ingres?
Is there some doc or table to describ?
Do you mean a list of all SQL functions?
A pdf named sql .pdf (SQL reference ) in the same dir introduces all SQL functions.

Chen zhen
zhenchen17 is offline   Reply With Quote
Old 2009-12-24   #8 (permalink)
Junior Member
 
Join Date: Dec 2009
Posts: 9
Default

Quote:
Originally Posted by zhenchen17 View Post
Do you mean a list of all SQL functions?
A pdf named sql .pdf (SQL reference ) in the same dir introduces all SQL functions.

Chen zhen
I have send a message to you.
And I have find the document, not in the path you have proposed.
But the exemples still can't be finded.

Zhao Xu
zhaoxu710 is offline   Reply With Quote
Old 2009-12-25   #9 (permalink)
Ingres Community
 
kschendel's Avatar
 
Join Date: Mar 2007
Location: Pittsburgh, PA
Posts: 1,099
Send a message via Skype™ to kschendel
Default

$ING_SRC/common/adf/adg/fi_defn.txt

is the definitive mapping between function instances and ADF calls. adgoptab.roc in the same directory will tell you the mapping between function names and function operator codes used in fi_defn.txt.
kschendel is offline   Reply With Quote
Old 2009-12-25   #10 (permalink)
Ingres Community
 
schma01's Avatar
 
Join Date: Jun 2007
Location: Dallas Texas
Posts: 39
Default

I just updated the following wiki page w/ a complete example, in case it helps.

OME: User Defined Functions - Ingres Community Wiki
schma01 is offline   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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© 2009 Ingres Corporation. All Rights Reserved