Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the datetime (with up to nanoseconds) has been added #1093

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to this file doesn't seem related to the PR topic.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cmake_install.cmake
*.sdf
*.suo
/*.vs*
out/

# KDevelop
*.kate-swp
Expand All @@ -51,3 +52,4 @@ CMakeLists.txt.user

# Python
.venv/

4 changes: 4 additions & 0 deletions cmake/SociConfig.cmake
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to this file doesn't seem related to the PR topic.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /we4266")
endif()

if(NOT MSVC_VERSION LESS 1928 AND SOCI_ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address")
endif()

if (SOCI_ENABLE_WERROR)
set(SOCI_WERROR_OPTION "/WX")
endif (SOCI_ENABLE_WERROR)
Expand Down
2 changes: 1 addition & 1 deletion cmake/SociDependencies.cmake
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to this file doesn't seem related to the PR topic.

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ foreach(external ${SOCI_ALL_DEPENDENCIES})
unset(disabled_var)
endif()

if(NOT ${EXTERNAL}_FOUND)
if(NOT ${EXTERNAL}_FOUND AND NOT ${external}_FOUND)
set(SOCI_${EXTERNAL} OFF)
endif()
endforeach()
6 changes: 6 additions & 0 deletions include/private/soci-exchange-cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ struct exchange_type_traits<x_stdtm>
typedef std::tm value_type;
};

template <>
struct exchange_type_traits<x_datetime>
{
typedef soci::datetime value_type;
};

template <>
struct exchange_type_traits<x_longstring>
{
Expand Down
2 changes: 2 additions & 0 deletions include/private/soci-mktime.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// Not <ctime> because we also want to get timegm() if available.
#include <time.h>
#include "soci/type-wrappers.h"

#ifdef _WIN32
#define timegm _mkgmtime
Expand Down Expand Up @@ -61,6 +62,7 @@ mktime_from_ymdhms(tm& t,
//
// Throws if the string in buf couldn't be parsed as a date or a time string.
SOCI_DECL void parse_std_tm(char const *buf, std::tm &t);
SOCI_DECL void parse_soci_datetime ( char const *buf, soci::datetime & );

} // namespace details

Expand Down
6 changes: 6 additions & 0 deletions include/private/soci-vector-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ inline std::size_t get_vector_size(exchange_type e, void *data)
return exchange_vector_type_cast<x_double>(data).size();
case x_stdtm:
return exchange_vector_type_cast<x_stdtm>(data).size();
case x_datetime:
return exchange_vector_type_cast<x_datetime> ( data ).size ();
case x_xmltype:
return exchange_vector_type_cast<x_xmltype>(data).size();
case x_longstring:
Expand Down Expand Up @@ -86,6 +88,9 @@ inline void resize_vector(exchange_type e, void *data, std::size_t newSize)
case x_stdtm:
exchange_vector_type_cast<x_stdtm>(data).resize(newSize);
return;
case x_datetime:
exchange_vector_type_cast<x_datetime> ( data ).resize ( newSize );
return;
case x_xmltype:
exchange_vector_type_cast<x_xmltype>(data).resize(newSize);
return;
Expand All @@ -111,6 +116,7 @@ inline std::string& vector_string_value(exchange_type e, void *data, std::size_t
return exchange_vector_type_cast<x_xmltype>(data).at(ind).value;
case x_longstring:
return exchange_vector_type_cast<x_longstring>(data).at(ind).value;
case x_datetime:
case x_char:
case x_short:
case x_integer:
Expand Down
Loading