2
0
mirror of https://github.com/boostorg/mysql.git synced 2026-02-20 14:52:25 +00:00

Changes to build/run in Windows 64

This commit is contained in:
anarthal
2020-03-01 15:28:30 +00:00
parent bd5dafcbbf
commit d784e65a8b
5 changed files with 26 additions and 23 deletions

View File

@@ -1,6 +1,3 @@
Prepared statements
Build in Windows
Build in CI
Multiresultset
Text protocol
Binary protocol (stored procedures)
@@ -9,6 +6,7 @@ Handshake
SSL
compression
Usability
Connection quit
Incomplete query reads: how does this affect further queries?
Metadata in rows: being able to index by name
Iterators for sync resultset iteration
@@ -46,4 +44,6 @@ Technical debt
Test prepared statement binding to procedure out params
More thorough testing for several NULLs in integration testing
Query and statement tests for DELETEs
prepared_statement::execute(): static_assert(), handle value&, const value&, anything convertible
prepared_statement::execute(): static_assert(), handle value&, const value&, anything convertible
Test for too many connections: do we have a buffer overrun there? (error msg shows incomplete)
Add a connection quit in integ tests: they may fail under Windows otherwise

View File

@@ -188,14 +188,15 @@ inline void mysql::detail::serialize(
{
serialize_fields(
ctx,
int1(brokendt.tod.hours().count()),
int1(brokendt.tod.minutes().count()),
int1(brokendt.tod.seconds().count())
int1(static_cast<std::uint8_t>(brokendt.tod.hours().count())),
int1(static_cast<std::uint8_t>(brokendt.tod.minutes().count())),
int1(static_cast<std::uint8_t>(brokendt.tod.seconds().count()))
);
}
if (length >= 11)
{
serialize(int4(brokendt.tod.subseconds().count()), ctx);
auto micros = static_cast<std::uint32_t>(brokendt.tod.subseconds().count());
serialize(int4(micros), ctx);
}
}
@@ -229,9 +230,10 @@ inline mysql::Error mysql::detail::deserialize(
if (err != Error::ok) return err;
}
// Compose the final datetime
output = date_part + std::chrono::hours(hours.value) + std::chrono::minutes(minutes.value) +
std::chrono::seconds(seconds.value) + std::chrono::microseconds(micros.value);
// Compose the final datetime. Doing time of day and date separately to avoid overflow
auto time_of_day_part = std::chrono::hours(hours.value) + std::chrono::minutes(minutes.value) +
std::chrono::seconds(seconds.value) + std::chrono::microseconds(micros.value);
output = date_part + time_of_day_part;
return Error::ok;
}
@@ -258,15 +260,16 @@ inline void mysql::detail::serialize(
serialize_fields(
ctx,
is_negative,
int4(std::abs(broken.days.count())),
int1(std::abs(broken.hours.count())),
int1(std::abs(broken.minutes.count())),
int1(std::abs(broken.seconds.count()))
int4(static_cast<std::uint32_t>(std::abs(broken.days.count()))),
int1(static_cast<std::uint8_t>(std::abs(broken.hours.count()))),
int1(static_cast<std::uint8_t>(std::abs(broken.minutes.count()))),
int1(static_cast<std::uint8_t>(std::abs(broken.seconds.count())))
);
}
if (length >= 12)
{
serialize(int4(std::abs(broken.microseconds.count())), ctx);
auto micros = static_cast<std::uint32_t>(std::abs(broken.microseconds.count()));
serialize(int4(micros), ctx);
}
}

View File

@@ -199,7 +199,7 @@ INSTANTIATE_TEST_SUITE_P(MEDIUMINT, DatabaseTypesTest, Values(
INSTANTIATE_TEST_SUITE_P(INT, DatabaseTypesTest, Values(
database_types_testcase("types_int", "field_signed", "regular", std::int32_t(20), field_type::int_),
database_types_testcase("types_int", "field_signed", "negative", std::int32_t(-20), field_type::int_),
database_types_testcase("types_int", "field_signed", "min", std::int32_t(-0x80000000), field_type::int_),
database_types_testcase("types_int", "field_signed", "min", -std::int32_t(0x80000000), field_type::int_),
database_types_testcase("types_int", "field_signed", "max", std::int32_t(0x7fffffff), field_type::int_),
database_types_testcase("types_int", "field_unsigned", "regular", std::uint32_t(20), field_type::int_, flags_unsigned),
@@ -216,7 +216,7 @@ INSTANTIATE_TEST_SUITE_P(INT, DatabaseTypesTest, Values(
INSTANTIATE_TEST_SUITE_P(BIGINT, DatabaseTypesTest, Values(
database_types_testcase("types_bigint", "field_signed", "regular", std::int64_t(20), field_type::bigint),
database_types_testcase("types_bigint", "field_signed", "negative", std::int64_t(-20), field_type::bigint),
database_types_testcase("types_bigint", "field_signed", "min", std::int64_t(-0x8000000000000000), field_type::bigint),
database_types_testcase("types_bigint", "field_signed", "min", -std::int64_t(0x8000000000000000), field_type::bigint),
database_types_testcase("types_bigint", "field_signed", "max", std::int64_t(0x7fffffffffffffff), field_type::bigint),
database_types_testcase("types_bigint", "field_unsigned", "regular", std::uint64_t(20), field_type::bigint, flags_unsigned),
@@ -296,13 +296,13 @@ int round_micros(int input, int decimals)
{
assert(decimals >= 0 && decimals <= 6);
if (decimals == 0) return 0;
int modulus = std::pow(10, 6 - decimals);
auto modulus = static_cast<int>(std::pow(10, 6 - decimals));
return (input / modulus) * modulus;
}
std::chrono::microseconds round_micros(std::chrono::microseconds input, int decimals)
{
return std::chrono::microseconds(round_micros(input.count(), decimals));
return std::chrono::microseconds(round_micros(static_cast<int>(input.count()), decimals));
}
std::pair<std::string, mysql::datetime> datetime_from_id(std::bitset<4> id, int decimals)

View File

@@ -39,7 +39,7 @@ void meta_validator::validate(
EXPECT_EQ(value.original_table(), org_table_);
EXPECT_EQ(value.field_name(), field_);
EXPECT_EQ(value.original_field_name(), org_field_);
EXPECT_GT(value.column_length(), 0);
EXPECT_GT(value.column_length(), 0u);
EXPECT_EQ(value.type(), type_);
EXPECT_EQ(value.decimals(), decimals_);

View File

@@ -27,7 +27,7 @@ TEST_P(PrepareStatementTest, OkNoParams)
auto stmt = GetParam()->prepare_statement(conn, "SELECT * FROM empty_table");
stmt.validate_no_error();
ASSERT_TRUE(stmt.value.valid());
EXPECT_GT(stmt.value.id(), 0);
EXPECT_GT(stmt.value.id(), 0u);
EXPECT_EQ(stmt.value.num_params(), 0);
}
@@ -36,7 +36,7 @@ TEST_P(PrepareStatementTest, OkWithParams)
auto stmt = GetParam()->prepare_statement(conn, "SELECT * FROM empty_table WHERE id IN (?, ?)");
stmt.validate_no_error();
ASSERT_TRUE(stmt.value.valid());
EXPECT_GT(stmt.value.id(), 0);
EXPECT_GT(stmt.value.id(), 0u);
EXPECT_EQ(stmt.value.num_params(), 2);
}