You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
No repeating code in client_udfs + better test
This commit is contained in:
@ -66,6 +66,49 @@ extern "C"
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_bool setparms_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
|
{
|
||||||
|
if (args->arg_count != 2 || args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT)
|
||||||
|
{
|
||||||
|
sprintf(message, "%s() requires two string arguments", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
initid->max_length = MAXSTRINGLENGTH;
|
||||||
|
|
||||||
|
char valuestr[MAXSTRINGLENGTH];
|
||||||
|
size_t vlen = args->lengths[1];
|
||||||
|
|
||||||
|
memcpy(valuestr, args->args[1], vlen--);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < vlen; ++i)
|
||||||
|
if (!isdigit(valuestr[i]))
|
||||||
|
{
|
||||||
|
sprintf(message, "%s() second argument must be numeric or end in G, M or K", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isdigit(valuestr[vlen]))
|
||||||
|
{
|
||||||
|
switch (valuestr[vlen])
|
||||||
|
{
|
||||||
|
case 'G':
|
||||||
|
case 'g':
|
||||||
|
case 'M':
|
||||||
|
case 'm':
|
||||||
|
case 'K':
|
||||||
|
case 'k':
|
||||||
|
case '\0': break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
sprintf(message, "%s() second argument must be numeric or end in G, M or K", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -135,50 +178,13 @@ extern "C"
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
my_bool mcssetparms_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool mcssetparms_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 2 || args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT)
|
return setparms_init(initid, args, message, "MCSSETPARMS");
|
||||||
{
|
|
||||||
strcpy(message, "MCSSETPARMS() requires two string arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
initid->max_length = MAXSTRINGLENGTH;
|
|
||||||
|
|
||||||
char valuestr[MAXSTRINGLENGTH];
|
|
||||||
size_t vlen = args->lengths[1];
|
|
||||||
|
|
||||||
memcpy(valuestr, args->args[1], vlen--);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < vlen; ++i)
|
|
||||||
if (!isdigit(valuestr[i]))
|
|
||||||
{
|
|
||||||
strcpy(message, "MCSSETPARMS() second argument must be numeric or end in G, M or K");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isdigit(valuestr[vlen]))
|
|
||||||
{
|
|
||||||
switch (valuestr[vlen])
|
|
||||||
{
|
|
||||||
case 'G':
|
|
||||||
case 'g':
|
|
||||||
case 'M':
|
|
||||||
case 'm':
|
|
||||||
case 'K':
|
|
||||||
case 'k':
|
|
||||||
case '\0': break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
strcpy(message, "MCSSETPARMS() second argument must be numeric or end in G, M or K");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -188,6 +194,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -202,45 +209,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calsetparms_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calsetparms_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 2 || args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT)
|
return setparms_init(initid, args, message, "CALSETPARMS");
|
||||||
{
|
|
||||||
strcpy(message, "CALSETPARMS() requires two string arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
initid->max_length = MAXSTRINGLENGTH;
|
|
||||||
|
|
||||||
char valuestr[MAXSTRINGLENGTH];
|
|
||||||
size_t vlen = args->lengths[1];
|
|
||||||
|
|
||||||
memcpy(valuestr, args->args[1], vlen--);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < vlen; ++i)
|
|
||||||
if (!isdigit(valuestr[i]))
|
|
||||||
{
|
|
||||||
strcpy(message, "CALSETPARMS() second argument must be numeric or end in G, M or K");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isdigit(valuestr[vlen]))
|
|
||||||
{
|
|
||||||
switch (valuestr[vlen])
|
|
||||||
{
|
|
||||||
case 'G':
|
|
||||||
case 'g':
|
|
||||||
case 'M':
|
|
||||||
case 'm':
|
|
||||||
case 'K':
|
|
||||||
case 'k':
|
|
||||||
case '\0': break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
strcpy(message, "CALSETPARMS() second argument must be numeric or end in G, M or K");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -250,6 +219,20 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_bool getstats_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
|
{
|
||||||
|
if (args->arg_count != 0)
|
||||||
|
{
|
||||||
|
sprintf(message, "%s() takes no arguments", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
initid->maybe_null = 1;
|
||||||
|
initid->max_length = 255;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -277,21 +260,13 @@ extern "C"
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
my_bool mcsgetstats_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool mcsgetstats_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return getstats_init(initid, args, message, "MCSGETSTATS");
|
||||||
{
|
|
||||||
strcpy(message, "MCSGETSTATS() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
initid->maybe_null = 1;
|
|
||||||
initid->max_length = 255;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -315,16 +290,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calgetstats_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calgetstats_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return getstats_init(initid, args, message, "CALGETSTATS");
|
||||||
{
|
|
||||||
strcpy(message, "CALGETSTATS() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
initid->maybe_null = 1;
|
|
||||||
initid->max_length = 255;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -334,6 +300,17 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_bool settrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
|
{
|
||||||
|
if (args->arg_count != 1 || args->arg_type[0] != INT_RESULT)
|
||||||
|
{
|
||||||
|
sprintf(message, "%s() requires one INTEGER argument", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -357,13 +334,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool mcssettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool mcssettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 1 || args->arg_type[0] != INT_RESULT)
|
return settrace_init(initid, args, message, "MCSSETTRACE");
|
||||||
{
|
|
||||||
strcpy(message, "MCSSETTRACE() requires one INTEGER argument");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -386,13 +357,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calsettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calsettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 1 || args->arg_type[0] != INT_RESULT)
|
return settrace_init(initid, args, message, "CALSETTRACE");
|
||||||
{
|
|
||||||
strcpy(message, "CALSETTRACE() requires one INTEGER argument");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -538,29 +503,26 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
my_bool viewtablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
__declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
my_bool mcsviewtablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
|
||||||
{
|
{
|
||||||
if (args->arg_count == 2 && (args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT))
|
if (args->arg_count == 2 && (args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT))
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSVIEWTABLELOCK() requires two string arguments");
|
sprintf(message, "%s() requires two string arguments", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if ((args->arg_count == 1) && (args->arg_type[0] != STRING_RESULT))
|
else if ((args->arg_count == 1) && (args->arg_type[0] != STRING_RESULT))
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSVIEWTABLELOCK() requires one string argument");
|
sprintf(message, "%s() requires one string argument", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (args->arg_count > 2)
|
else if (args->arg_count > 2)
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSVIEWTABLELOCK() takes one or two arguments only");
|
sprintf(message, "%s() takes one or two arguments only", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (args->arg_count == 0)
|
else if (args->arg_count == 0)
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSVIEWTABLELOCK() requires at least one argument");
|
sprintf(message, "%s() requires at least one argument", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,6 +532,14 @@ extern "C"
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
my_bool mcsviewtablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
|
{
|
||||||
|
return viewtablelock_init(initid, args, message, "MCSVIEWTABLELOCK");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -637,31 +607,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calviewtablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calviewtablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count == 2 && (args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT))
|
return viewtablelock_init(initid, args, message, "CALVIEWTABLELOCK");
|
||||||
{
|
|
||||||
strcpy(message, "CALVIEWTABLELOCK() requires two string arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if ((args->arg_count == 1) && (args->arg_type[0] != STRING_RESULT))
|
|
||||||
{
|
|
||||||
strcpy(message, "CALVIEWTABLELOCK() requires one string argument");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (args->arg_count > 2)
|
|
||||||
{
|
|
||||||
strcpy(message, "CALVIEWTABLELOCK() takes one or two arguments only");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (args->arg_count == 0)
|
|
||||||
{
|
|
||||||
strcpy(message, "CALVIEWTABLELOCK() requires at least one argument");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
initid->maybe_null = 1;
|
|
||||||
initid->max_length = 255;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -680,14 +626,11 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
my_bool cleartablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
__declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
my_bool mcscleartablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
|
||||||
{
|
{
|
||||||
if ((args->arg_count != 1) || (args->arg_type[0] != INT_RESULT))
|
if ((args->arg_count != 1) || (args->arg_type[0] != INT_RESULT))
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSCLEARTABLELOCK() requires one integer argument (the lockID)");
|
sprintf(message, "%s() requires one integer argument (the lockID)", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,6 +640,15 @@ extern "C"
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
my_bool mcscleartablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
|
{
|
||||||
|
return cleartablelock_init(initid, args, message, "MCSCLEARTABLELOCK");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -736,16 +688,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calcleartablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calcleartablelock_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if ((args->arg_count != 1) || (args->arg_type[0] != INT_RESULT))
|
return cleartablelock_init(initid, args, message, "CALCLEARTABLELOCK");
|
||||||
{
|
|
||||||
strcpy(message, "CALCLEARTABLELOCK() requires one integer argument (the lockID)");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
initid->maybe_null = 1;
|
|
||||||
initid->max_length = 255;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -764,29 +707,26 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
my_bool lastinsertid_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
__declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
my_bool mcslastinsertid_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
|
||||||
{
|
{
|
||||||
if (args->arg_count == 2 && (args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT))
|
if (args->arg_count == 2 && (args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT))
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSLASTINSRTID() requires two string arguments");
|
sprintf(message, "%s() requires two string arguments", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if ((args->arg_count == 1) && (args->arg_type[0] != STRING_RESULT))
|
else if ((args->arg_count == 1) && (args->arg_type[0] != STRING_RESULT))
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSLASTINSERTID() requires one string argument");
|
sprintf(message, "%s() requires one string argument", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (args->arg_count > 2)
|
else if (args->arg_count > 2)
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSLASTINSERTID() takes one or two arguments only");
|
sprintf(message, "%s() takes one or two arguments only", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (args->arg_count == 0)
|
else if (args->arg_count == 0)
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSLASTINSERTID() requires at least one argument");
|
sprintf(message, "%s() requires at least one argument", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,6 +736,15 @@ extern "C"
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
my_bool mcslastinsertid_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
|
{
|
||||||
|
return lastinsertid_init(initid, args, message, "MCSLASTINSERTID");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -873,31 +822,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool callastinsertid_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool callastinsertid_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count == 2 && (args->arg_type[0] != STRING_RESULT || args->arg_type[1] != STRING_RESULT))
|
return lastinsertid_init(initid, args, message, "CALLASTINSERTID");
|
||||||
{
|
|
||||||
strcpy(message, "CALLASTINSRTID() requires two string arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if ((args->arg_count == 1) && (args->arg_type[0] != STRING_RESULT))
|
|
||||||
{
|
|
||||||
strcpy(message, "CALLASTINSERTID() requires one string argument");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (args->arg_count > 2)
|
|
||||||
{
|
|
||||||
strcpy(message, "CALLASTINSERTID() takes one or two arguments only");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (args->arg_count == 0)
|
|
||||||
{
|
|
||||||
strcpy(message, "CALLASTINSERTID() requires at least one argument");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
initid->maybe_null = 1;
|
|
||||||
initid->max_length = 255;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -915,6 +840,17 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_bool flushcache_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
|
{
|
||||||
|
if (args->arg_count != 0)
|
||||||
|
{
|
||||||
|
sprintf(message, "%s() takes no arguments", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -935,13 +871,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool mcsflushcache_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool mcsflushcache_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return flushcache_init(initid, args, message, "MCSFLUSHCACHE");
|
||||||
{
|
|
||||||
strcpy(message, "MCSFLUSHCACHE() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -964,13 +894,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calflushcache_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calflushcache_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return flushcache_init(initid, args, message, "CALFLUSHCACHE");
|
||||||
{
|
|
||||||
strcpy(message, "CALFLUSHCACHE() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned long TraceSize = 16 * 1024;
|
static const unsigned long TraceSize = 16 * 1024;
|
||||||
@ -1022,16 +946,13 @@ extern "C"
|
|||||||
return msgp->c_str();
|
return msgp->c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
my_bool gettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
__declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
my_bool mcsgettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
if (args->arg_count != 0)
|
if (args->arg_count != 0)
|
||||||
{
|
{
|
||||||
strcpy(message, "MCSGETTRACE() takes no arguments");
|
sprintf(message, "%s() takes no arguments", funcname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1042,6 +963,14 @@ extern "C"
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
my_bool mcsgettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
|
{
|
||||||
|
return gettrace_init(initid, args, message, "MCSGETTRACE");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -1063,19 +992,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calgettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calgettrace_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
#if 0
|
return gettrace_init(initid, args, message, "CALGETTRACE");
|
||||||
|
|
||||||
if (args->arg_count != 0)
|
|
||||||
{
|
|
||||||
strcpy(message, "CALGETTRACE() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
initid->maybe_null = 1;
|
|
||||||
initid->max_length = TraceSize;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -1085,6 +1002,17 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_bool getversion_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
|
{
|
||||||
|
if (args->arg_count != 0)
|
||||||
|
{
|
||||||
|
sprintf(message, "%s() takes no arguments", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -1102,13 +1030,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool mcsgetversion_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool mcsgetversion_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return getversion_init(initid, args, message, "MCSGETVERSION");
|
||||||
{
|
|
||||||
strcpy(message, "MCSGETVERSION() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -1132,13 +1054,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calgetversion_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calgetversion_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return getversion_init(initid, args, message, "CALGETVERSION");
|
||||||
{
|
|
||||||
strcpy(message, "CALGETVERSION() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -1148,6 +1064,17 @@ extern "C"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_bool getsqlcount_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
|
||||||
|
{
|
||||||
|
if (args->arg_count != 0)
|
||||||
|
{
|
||||||
|
sprintf(message, "%s() takes no arguments", funcname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
@ -1195,13 +1122,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool mcsgetsqlcount_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool mcsgetsqlcount_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return getstats_init(initid, args, message, "MCSGETSQLCOUNT");
|
||||||
{
|
|
||||||
strcpy(message, "MCSGETSQLCOUNT() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -1225,13 +1146,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
my_bool calgetsqlcount_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
my_bool calgetsqlcount_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
|
||||||
{
|
{
|
||||||
if (args->arg_count != 0)
|
return getstats_init(initid, args, message, "CALGETSQLCOUNT");
|
||||||
{
|
|
||||||
strcpy(message, "CALGETSQLCOUNT() takes no arguments");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -14,9 +14,9 @@ Updated pmmaxmemorysmallside 2048000000
|
|||||||
select calgettrace();
|
select calgettrace();
|
||||||
calgettrace()
|
calgettrace()
|
||||||
NULL
|
NULL
|
||||||
select calgetversion();
|
select calgetversion()=mcsgetversion();
|
||||||
calgetversion()
|
calgetversion()=mcsgetversion()
|
||||||
8.1.1
|
1
|
||||||
select calviewtablelock("t1");
|
select calviewtablelock("t1");
|
||||||
calviewtablelock("t1")
|
calviewtablelock("t1")
|
||||||
Table cal_test_db.t1 is not locked by any process.
|
Table cal_test_db.t1 is not locked by any process.
|
||||||
|
@ -14,9 +14,9 @@ Updated pmmaxmemorysmallside 2048000000
|
|||||||
select mcsgettrace();
|
select mcsgettrace();
|
||||||
mcsgettrace()
|
mcsgettrace()
|
||||||
NULL
|
NULL
|
||||||
select mcsgetversion();
|
select mcsgetversion()=calgetversion();
|
||||||
mcsgetversion()
|
mcsgetversion()=calgetversion()
|
||||||
8.1.1
|
1
|
||||||
select mcsviewtablelock("t1");
|
select mcsviewtablelock("t1");
|
||||||
mcsviewtablelock("t1")
|
mcsviewtablelock("t1")
|
||||||
Table cal_test_db.t1 is not locked by any process.
|
Table cal_test_db.t1 is not locked by any process.
|
||||||
|
@ -13,7 +13,7 @@ select calflushcache();
|
|||||||
select calsettrace(0);
|
select calsettrace(0);
|
||||||
select calsetparms("pmmaxmemorysmallside","2048000000");
|
select calsetparms("pmmaxmemorysmallside","2048000000");
|
||||||
select calgettrace();
|
select calgettrace();
|
||||||
select calgetversion();
|
select calgetversion()=mcsgetversion();
|
||||||
|
|
||||||
|
|
||||||
select calviewtablelock("t1");
|
select calviewtablelock("t1");
|
||||||
|
@ -13,8 +13,7 @@ select mcsflushcache();
|
|||||||
select mcssettrace(0);
|
select mcssettrace(0);
|
||||||
select mcssetparms("pmmaxmemorysmallside","2048000000");
|
select mcssetparms("pmmaxmemorysmallside","2048000000");
|
||||||
select mcsgettrace();
|
select mcsgettrace();
|
||||||
select mcsgetversion();
|
select mcsgetversion()=calgetversion();
|
||||||
|
|
||||||
|
|
||||||
select mcsviewtablelock("t1");
|
select mcsviewtablelock("t1");
|
||||||
select mcscleartablelock(0);
|
select mcscleartablelock(0);
|
||||||
|
Reference in New Issue
Block a user