From: arne@vajhoej.dk   
      
   On 8/15/2025 8:27 AM, Simon Clubley wrote:   
   > On 2025-08-12, Arne Vajhøj wrote:   
   >> Code:   
   >>   
   >> #include    
   >>   
   >> #include    
   >>   
   >> my_bool demo_init(UDF_INIT *initid, UDF_ARGS *args, char *message)   
   >> {   
   >> if(args->arg_count == 2 && args->arg_type[0] == STRING_RESULT &&   
   >> args->arg_type[1] == INT_RESULT)   
   >   
   > Is it guaranteed that arg_type[] will always have at least elements ?   
   > If not, that's dangerous unless the compiler you are using does   
   > expression short-circuiting.   
      
   Isn't C required to do short circuiting on && ?   
      
   >> {   
   >> return 0;   
   >> }   
   >> else   
   >> {   
   >> strcpy(message, "demo function requires two arguments: one   
   >> string and one integer");   
   >> return 1;   
   >   
   > YUCK!!! :-) Does MySQL provide a maximum error message size field or   
   > constant that you can use with strncpy() instead ?   
      
   Not that I am aware of.   
      
   No such used in the example provided by MySQL/Oracle.   
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|