0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

MSVC update 2 already has std::chrono::floor

This commit is contained in:
rbock 2016-04-17 10:45:31 +02:00
parent 914ecae7c2
commit 91defe2450
2 changed files with 13 additions and 9 deletions

View File

@ -15,9 +15,6 @@ build_script:
- cd ..
- CD
- git clone https://github.com/HowardHinnant/date
- cd date
- git checkout tags/v1.0.0
- cd ..
- cd sqlpp11
- CD
- echo %configuration%

View File

@ -30,6 +30,13 @@
SQLPP_ALIAS_PROVIDER(now)
#if _MSC_FULL_VER >= 190023918
// MSVC Update 2 provides floor, ceil, round, abs in chrono (which is C++17 only...)
using ::std::chrono::floor;
#else
using ::date::floor;
#endif
int DateTime(int, char* [])
{
MockDb db = {};
@ -48,23 +55,23 @@ int DateTime(int, char* [])
printer.reset();
std::cerr << serialize(::sqlpp::value(std::chrono::system_clock::now()), printer).str() << std::endl;
db(insert_into(t).set(t.colDayPoint = ::date::floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(insert_into(t).set(t.colTimePoint = ::date::floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(insert_into(t).set(t.colDayPoint = floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(insert_into(t).set(t.colTimePoint = floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(insert_into(t).set(t.colTimePoint = std::chrono::system_clock::now()));
db(update(t)
.set(t.colDayPoint = ::date::floor<::sqlpp::chrono::days>(std::chrono::system_clock::now()))
.set(t.colDayPoint = floor<::sqlpp::chrono::days>(std::chrono::system_clock::now()))
.where(t.colDayPoint < std::chrono::system_clock::now()));
db(update(t)
.set(t.colTimePoint = ::date::floor<::sqlpp::chrono::days>(std::chrono::system_clock::now()))
.set(t.colTimePoint = floor<::sqlpp::chrono::days>(std::chrono::system_clock::now()))
.where(t.colDayPoint < std::chrono::system_clock::now()));
db(update(t)
.set(t.colTimePoint = std::chrono::system_clock::now())
.where(t.colDayPoint < std::chrono::system_clock::now()));
db(remove_from(t).where(t.colDayPoint == ::date::floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(remove_from(t).where(t.colDayPoint == floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(remove_from(t).where(t.colDayPoint == std::chrono::system_clock::now()));
db(remove_from(t).where(t.colTimePoint == ::date::floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(remove_from(t).where(t.colTimePoint == floor<::sqlpp::chrono::days>(std::chrono::system_clock::now())));
db(remove_from(t).where(t.colTimePoint == std::chrono::system_clock::now()));
return 0;