Informix

 View Only
  • 1.  Informix HEXTORAW function

    Posted 21 days ago
    I don't see a builtin but should be a trivial UDR. I've written a few UDRs to mimic Oracle builtins

    Cheers
    Paul


    On 10/30/2024 10:26 AM, Vicente Salvador Cubedo via IBM TechXchange Community wrote:
    01000192de090f69-df6bff4e-441f-4571-bc9f-f884f493fe09-000000@email.amazonses.com">
    Somebody know if there is some method to mimic the HEXTORAW function available already in DB2 and ORACLE? www.ibm.com/docs/es/db2/11.1... -posted to the "Informix" group


  • 2.  RE: Informix HEXTORAW function

    Posted 14 days ago

    That is the reason I don't understand why IBM/HCL don't dedicate some "days" to create a lot of easy functions embeded. It's easy for a eSQL/C programmer to create this functions, so for an HCL programmer, it should be also very easy to integrate into the product.

    Informix is a very extensible product and this is one of it's best features, but tainting the server with tons of customized functions made by non-expert programmers I think it's a mistake.

    Just my two cents.



    ------------------------------
    Vicente Salvador Cubedo
    Software Architect
    DEISTER, S.A.
    Barcelona
    +34 932063298
    ------------------------------



  • 3.  RE: Informix HEXTORAW function

    Posted 14 days ago
    Something I wrote back in the dark ages, should get hextoraw started

    #include <stdlib.h>
    #include "mi.h"

    #define UNI3_DMASK1     0x0000ffc0
    #define UNI3_DMASK2     0x03ff0000
    #define ONI_BUFFSIZE    8

    mi_lvarchar * oni_hex1( mi_integer n )
    {
        char         buf[ONI_BUFFSIZE + 1];
        mi_lvarchar *ret_string = 0;

        n &= UNI3_DMASK1;

        snprintf( buf, sizeof buf, "%8.8x", n );

        ret_string = mi_new_var(ONI_BUFFSIZE);
        mi_set_vardata(ret_string, &buf[0]);

        return (ret_string);
    }

    mi_lvarchar * oni_hex2( mi_integer n )
    {
        char         buf[ONI_BUFFSIZE + 1];
        mi_lvarchar *ret_string = 0;

        n &= UNI3_DMASK2;


        snprintf( buf, sizeof buf, "%8.8x", n );

        ret_string = mi_new_var(ONI_BUFFSIZE);
        mi_set_vardata(ret_string, buf);

        return (ret_string);
    }



    On 11/6/2024 6:02 AM, Vicente Salvador Cubedo via IBM TechXchange Community wrote:
    01000193015ae6f2-b7879fab-aacf-4d77-938c-ebbc4b7038eb-000000@email.amazonses.com">
    That is the reason I don't understand why IBM/HCL don't dedicate some "days" to create a lot of easy functions embeded. It's easy for a eSQL/C...