Thread: Udf: dpower

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    9
    Rep Power
    0

    Udf: dpower


    I nedd to use the udf dpower.
    I declare (with success) the udf with thi code:

    DECLARE EXTERNAL FUNCTION DPOWERDouble precision, Double precision
    RETURNS Double precision
    ENTRY_POINT 'power'
    MODULE_NAME 'fbudf';

    but if I use this function in my sql code I obtain alwais a null value. I think that, probably, the C code of this function is not into the library fbudf.dll, but I don't know how to do!!!!!!

    Someone could help me???

    #vbaRstat#
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    19
    i don't think the function doesn't exist in the library because it would have given you an exception like:

    function DPOWER is not defined.
    module name or entrypoint could not be found.

    at creation of UDS's there's no validity check, only the i/o parameter types are checked.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    9
    Rep Power
    0
    The problem could be in the library fbudf.dll.
    If I use a function available in ib_udf.dll it's always ok......


    #vbaRstat#
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    19
    idunno man, i imported the UDF from the fbudf.sql file as it was and this SQL works fine:

    SELECT DPOWER(3,2) FROM RDB$DATABASE;
    =========================
    9.000


    SELECT FIRST 3 DPOWER(clientid,2) FROM gen_clients;
    =========================
    2890000.000
    1.000
    4.000

    but in change the next sql gives NULLs

    SELECT FIRST 3 DPOWER(comtypeid,2) FROM gen_comtypes;
    =========================
    <NULL>
    <NULL>
    <NULL>

    and it was because comtypeid is a CHAR(6)


    maybe you should check your input parameter types
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    9
    Rep Power
    0
    Originally Posted by nagysz
    idunno man, i imported the UDF from the fbudf.sql file as it was and this SQL works fine:

    SELECT DPOWER(3,2) FROM RDB$DATABASE;
    =========================
    9.000
    :-( the result of this sql statement is a null value.
    I'm sure that the problem is not the type of data (char or varchar). I'm using the function with numeric values, but the result is always null...........please help me......... :-(
    What is your operating system? linux? I'm working with Windows.

    #vbaRstat#
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    19
    hmm, then maybe you should try with one (or all) of these:

    1) reinstalling firebird
    2) checking whther your client is not connecting to FB 2.0 and your server is another version (FC 1.5.3 f.e.) (i happened to have a similar issue due to ODS difference)
    3. check if you imported correctly the routine:


    declare external function dPower
    double precision by descriptor, double precision by descriptor,
    double precision by descriptor
    returns parameter 3
    entry_point 'power' module_name 'fbudf';

    Comments on this post

    • pabloj agrees
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    9
    Rep Power
    0
    Originally Posted by nagysz
    hmm, then maybe you should try with one (or all) of these:

    1) reinstalling firebird
    2) checking whther your client is not connecting to FB 2.0 and your server is another version (FC 1.5.3 f.e.) (i happened to have a similar issue due to ODS difference)
    3. check if you imported correctly the routine:


    declare external function dPower
    double precision by descriptor, double precision by descriptor,
    double precision by descriptor
    returns parameter 3
    entry_point 'power' module_name 'fbudf';

    The problem it was in the code:

    this is the correct code:

    declare external function dPower
    double precision by descriptor, double precision by descriptor,
    double precision by descriptor
    returns parameter 3
    entry_point 'power' module_name 'fbudf'


    and this is what you see in the DDL of the function (after the declaration) ...and what you can't use to declare it.... :-)

    DECLARE EXTERNAL FUNCTION DPOWERDouble precision, Double precision
    RETURNS Double precision
    ENTRY_POINT 'power'
    MODULE_NAME 'fbudf';


    thanks

    # vbaRstat #

IMN logo majestic logo threadwatch logo seochat tools logo