Code refactor
This commit is contained in:
parent
5d8c6555a4
commit
e550ef0b6d
|
@ -85,11 +85,10 @@ char * sql_printf(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long
|
|||
}
|
||||
|
||||
char *arg = args->args[i];
|
||||
unsigned long len = args->lengths[i];
|
||||
|
||||
if (arg) {
|
||||
if (arg != NULL) {
|
||||
buffer_append(buffer, delimiter);
|
||||
buffer_append_len(buffer, arg, len);
|
||||
buffer_append_len(buffer, arg, args->lengths[i]);
|
||||
buffer_append(buffer, delimiter);
|
||||
} else
|
||||
buffer_append(buffer, "NULL");
|
||||
|
|
|
@ -81,11 +81,10 @@ int value_compare(Value *a, Value *b) {
|
|||
case INT_RESULT:
|
||||
cmp = a->val.i - b->val.i;
|
||||
break;
|
||||
case REAL_RESULT: {
|
||||
case REAL_RESULT:
|
||||
real_cmp = a->val.d - b->val.d;
|
||||
cmp = real_cmp == 0.0 ? 0 : (real_cmp > 0.0 ? 1 : -1);
|
||||
break;
|
||||
}
|
||||
default: // STRING_RESULT & DECIMAL_RESULT
|
||||
cmp = strncmp(a->val.s, b->val.s, min(a->len, b->len));
|
||||
if (cmp == 0) cmp = a->len - b->len;
|
||||
|
|
Reference in New Issue