MXS-2354: Extend datatype test case

Added proper test cases for fractional temporal types.
This commit is contained in:
Markus Mäkelä 2019-09-26 10:56:00 +03:00
parent 27675ed41d
commit f6b2a7f3d5
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -93,12 +93,6 @@ static const char* binary_values[] =
static const char* datetime_types[] =
{
"DATETIME",
"DATETIME(1)",
"DATETIME(2)",
"DATETIME(3)",
"DATETIME(4)",
"DATETIME(5)",
"DATETIME(6)",
NULL
};
@ -110,6 +104,25 @@ static const char* datetime_values[] =
NULL
};
static const char* datetime2_types[] =
{
"DATETIME(6)",
NULL
};
static const char* datetime2_values[] =
{
"'2018-01-01 11:11:11.000001'",
"'2018-01-01 11:11:11.000010'",
"'2018-01-01 11:11:11.000100'",
"'2018-01-01 11:11:11.001000'",
"'2018-01-01 11:11:11.010000'",
"'2018-01-01 11:11:11.100000'",
"'0-00-00 00:00:00.000000'",
"NULL",
NULL
};
static const char* timestamp_types[] =
{
"TIMESTAMP",
@ -123,6 +136,24 @@ static const char* timestamp_values[] =
NULL
};
static const char* timestamp2_types[] =
{
"TIMESTAMP(6)",
NULL
};
static const char* timestamp2_values[] =
{
"'2018-01-01 11:11:11.000001'",
"'2018-01-01 11:11:11.000010'",
"'2018-01-01 11:11:11.000100'",
"'2018-01-01 11:11:11.001000'",
"'2018-01-01 11:11:11.010000'",
"'2018-01-01 11:11:11.100000'",
"'0-00-00 00:00:00.000000'",
NULL
};
static const char* date_types[] =
{
"DATE",
@ -140,12 +171,6 @@ static const char* date_values[] =
static const char* time_types[] =
{
"TIME",
"TIME(1)",
"TIME(2)",
"TIME(3)",
"TIME(4)",
"TIME(5)",
"TIME(6)",
NULL
};
@ -156,6 +181,24 @@ static const char* time_values[] =
NULL
};
static const char* time2_types[] =
{
"TIME(6)",
NULL
};
static const char* time2_values[] =
{
"'12:00:00.000001'",
"'12:00:00.000010'",
"'12:00:00.000100'",
"'12:00:00.001000'",
"'12:00:00.010000'",
"'12:00:00.100000'",
"NULL",
NULL
};
struct
{
const char** types;
@ -170,6 +213,9 @@ struct
{timestamp_types, timestamp_values},
{date_types, date_values},
{time_types, time_values},
{datetime2_types, datetime2_values},
{timestamp2_types, timestamp2_values},
{time2_types, time2_values},
{0, 0}
};
@ -197,7 +243,21 @@ std::string type_to_table_name(const char* type)
if (offset != std::string::npos)
{
name = name.substr(0, offset);
name[offset] = '_';
offset = name.find(')');
if (offset != std::string::npos)
{
name = name.substr(0, offset);
}
offset = name.find(',');
if (offset != std::string::npos)
{
name = name.substr(0, offset);
}
}
offset = name.find(' ');