Informix HEXTORAW function
Posted in 2024
Topics: General Discussion
I don't see a builtin but should be a trivial UDR. I've written a few UDRs to mimic Oracle builtins Cheers Paul
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 ------------------------------
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); }