sync dependencies with upstream

This commit is contained in:
Albert S. 2019-09-30 20:20:41 +02:00
parent c7a8b733ed
commit 31991f7bb0
6 changed files with 2457 additions and 1121 deletions

View File

@ -309,68 +309,68 @@ namespace sqlite {
namespace sql_function_binder { namespace sql_function_binder {
template< template<
typename ContextType, typename ContextType,
std::size_t Count, std::size_t Count,
typename Functions typename Functions
> >
inline void step( inline void step(
sqlite3_context* db, sqlite3_context* db,
int count, int count,
sqlite3_value** vals sqlite3_value** vals
); );
template< template<
std::size_t Count, std::size_t Count,
typename Functions, typename Functions,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) && sizeof...(Values) < Count), void>::type step( inline typename std::enable_if<(sizeof...(Values) && sizeof...(Values) < Count), void>::type step(
sqlite3_context* db, sqlite3_context* db,
int count, int count,
sqlite3_value** vals, sqlite3_value** vals,
Values&&... values Values&&... values
); );
template< template<
std::size_t Count, std::size_t Count,
typename Functions, typename Functions,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) == Count), void>::type step( inline typename std::enable_if<(sizeof...(Values) == Count), void>::type step(
sqlite3_context* db, sqlite3_context* db,
int, int,
sqlite3_value**, sqlite3_value**,
Values&&... values Values&&... values
); );
template< template<
typename ContextType, typename ContextType,
typename Functions typename Functions
> >
inline void final(sqlite3_context* db); inline void final(sqlite3_context* db);
template< template<
std::size_t Count, std::size_t Count,
typename Function, typename Function,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) < Count), void>::type scalar( inline typename std::enable_if<(sizeof...(Values) < Count), void>::type scalar(
sqlite3_context* db, sqlite3_context* db,
int count, int count,
sqlite3_value** vals, sqlite3_value** vals,
Values&&... values Values&&... values
); );
template< template<
std::size_t Count, std::size_t Count,
typename Function, typename Function,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) == Count), void>::type scalar( inline typename std::enable_if<(sizeof...(Values) == Count), void>::type scalar(
sqlite3_context* db, sqlite3_context* db,
int, int,
sqlite3_value**, sqlite3_value**,
Values&&... values Values&&... values
); );
} }
@ -485,7 +485,7 @@ namespace sqlite {
class binder { class binder {
private: private:
template < template <
typename Function, typename Function,
std::size_t Index std::size_t Index
> >
using nth_argument_type = typename utility::function_traits< using nth_argument_type = typename utility::function_traits<
@ -500,14 +500,14 @@ namespace sqlite {
// on Github. // on Github.
template< template<
typename Function, typename Function,
typename... Values, typename... Values,
std::size_t Boundary = Count std::size_t Boundary = Count
> >
static typename std::enable_if<(sizeof...(Values) < Boundary), void>::type run( static typename std::enable_if<(sizeof...(Values) < Boundary), void>::type run(
database_binder& db, database_binder& db,
Function&& function, Function&& function,
Values&&... values Values&&... values
) { ) {
typename std::remove_cv<typename std::remove_reference<nth_argument_type<Function, sizeof...(Values)>>::type>::type value{}; typename std::remove_cv<typename std::remove_reference<nth_argument_type<Function, sizeof...(Values)>>::type>::type value{};
get_col_from_db(db, sizeof...(Values), value); get_col_from_db(db, sizeof...(Values), value);
@ -516,14 +516,14 @@ namespace sqlite {
} }
template< template<
typename Function, typename Function,
typename... Values, typename... Values,
std::size_t Boundary = Count std::size_t Boundary = Count
> >
static typename std::enable_if<(sizeof...(Values) == Boundary), void>::type run( static typename std::enable_if<(sizeof...(Values) == Boundary), void>::type run(
database_binder&, database_binder&,
Function&& function, Function&& function,
Values&&... values Values&&... values
) { ) {
function(std::move(values)...); function(std::move(values)...);
} }
@ -914,11 +914,11 @@ namespace sqlite {
template< template<
typename ContextType, typename ContextType,
std::size_t Count, std::size_t Count,
typename Functions typename Functions
> >
inline void step( inline void step(
sqlite3_context* db, sqlite3_context* db,
int count, int count,
sqlite3_value** vals sqlite3_value** vals
) { ) {
auto ctxt = static_cast<AggregateCtxt<ContextType>*>(sqlite3_aggregate_context(db, sizeof(AggregateCtxt<ContextType>))); auto ctxt = static_cast<AggregateCtxt<ContextType>*>(sqlite3_aggregate_context(db, sizeof(AggregateCtxt<ContextType>)));
@ -941,14 +941,14 @@ namespace sqlite {
template< template<
std::size_t Count, std::size_t Count,
typename Functions, typename Functions,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) && sizeof...(Values) < Count), void>::type step( inline typename std::enable_if<(sizeof...(Values) && sizeof...(Values) < Count), void>::type step(
sqlite3_context* db, sqlite3_context* db,
int count, int count,
sqlite3_value** vals, sqlite3_value** vals,
Values&&... values Values&&... values
) { ) {
typename std::remove_cv< typename std::remove_cv<
typename std::remove_reference< typename std::remove_reference<
@ -964,21 +964,21 @@ namespace sqlite {
template< template<
std::size_t Count, std::size_t Count,
typename Functions, typename Functions,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) == Count), void>::type step( inline typename std::enable_if<(sizeof...(Values) == Count), void>::type step(
sqlite3_context* db, sqlite3_context* db,
int, int,
sqlite3_value**, sqlite3_value**,
Values&&... values Values&&... values
) { ) {
static_cast<Functions*>(sqlite3_user_data(db))->first(std::forward<Values>(values)...); static_cast<Functions*>(sqlite3_user_data(db))->first(std::forward<Values>(values)...);
} }
template< template<
typename ContextType, typename ContextType,
typename Functions typename Functions
> >
inline void final(sqlite3_context* db) { inline void final(sqlite3_context* db) {
auto ctxt = static_cast<AggregateCtxt<ContextType>*>(sqlite3_aggregate_context(db, sizeof(AggregateCtxt<ContextType>))); auto ctxt = static_cast<AggregateCtxt<ContextType>*>(sqlite3_aggregate_context(db, sizeof(AggregateCtxt<ContextType>)));
@ -1001,14 +1001,14 @@ namespace sqlite {
template< template<
std::size_t Count, std::size_t Count,
typename Function, typename Function,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) < Count), void>::type scalar( inline typename std::enable_if<(sizeof...(Values) < Count), void>::type scalar(
sqlite3_context* db, sqlite3_context* db,
int count, int count,
sqlite3_value** vals, sqlite3_value** vals,
Values&&... values Values&&... values
) { ) {
typename std::remove_cv< typename std::remove_cv<
typename std::remove_reference< typename std::remove_reference<
@ -1022,14 +1022,14 @@ namespace sqlite {
template< template<
std::size_t Count, std::size_t Count,
typename Function, typename Function,
typename... Values typename... Values
> >
inline typename std::enable_if<(sizeof...(Values) == Count), void>::type scalar( inline typename std::enable_if<(sizeof...(Values) == Count), void>::type scalar(
sqlite3_context* db, sqlite3_context* db,
int, int,
sqlite3_value**, sqlite3_value**,
Values&&... values Values&&... values
) { ) {
try { try {
store_result_in_db(db, store_result_in_db(db,

View File

@ -42,9 +42,9 @@ namespace sqlite {
static void throw_sqlite_error(const int& error_code, const std::string &sql = "") { static void throw_sqlite_error(const int& error_code, const std::string &sql = "") {
switch(error_code & 0xFF) { switch(error_code & 0xFF) {
#define SQLITE_MODERN_CPP_ERROR_CODE(NAME,name,derived) \ #define SQLITE_MODERN_CPP_ERROR_CODE(NAME,name,derived) \
case SQLITE_ ## NAME: switch(error_code) { \ case SQLITE_ ## NAME: switch(error_code) { \
derived \ derived \
default: throw name(error_code, sql); \ default: throw name(error_code, sql); \
} }
#define SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED(BASE,SUB,base,sub) \ #define SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED(BASE,SUB,base,sub) \

View File

@ -77,15 +77,15 @@ namespace sqlite {
error_log(Handler &&handler) { error_log(Handler &&handler) {
auto ptr = detail::make_shared_inferred([handler = std::forward<Handler>(handler)](int error_code, const char *errstr) mutable { auto ptr = detail::make_shared_inferred([handler = std::forward<Handler>(handler)](int error_code, const char *errstr) mutable {
switch(error_code & 0xFF) { switch(error_code & 0xFF) {
#define SQLITE_MODERN_CPP_ERROR_CODE(NAME,name,derived) \ #define SQLITE_MODERN_CPP_ERROR_CODE(NAME,name,derived) \
case SQLITE_ ## NAME: switch(error_code) { \ case SQLITE_ ## NAME: switch(error_code) { \
derived \ derived \
default: handler(errors::name(errstr, "", error_code)); \ default: handler(errors::name(errstr, "", error_code)); \
};break; };break;
#define SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED(BASE,SUB,base,sub) \ #define SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED(BASE,SUB,base,sub) \
case SQLITE_ ## BASE ## _ ## SUB: \ case SQLITE_ ## BASE ## _ ## SUB: \
handler(errors::base ## _ ## sub(errstr, "", error_code)); \ handler(errors::base ## _ ## sub(errstr, "", error_code)); \
break; break;
#include "lists/error_codes.h" #include "lists/error_codes.h"
#undef SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED #undef SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED
#undef SQLITE_MODERN_CPP_ERROR_CODE #undef SQLITE_MODERN_CPP_ERROR_CODE

View File

@ -14,19 +14,19 @@ namespace sqlite {
> { }; > { };
template < template <
typename ClassType, typename ClassType,
typename ReturnType, typename ReturnType,
typename... Arguments typename... Arguments
> >
struct function_traits< struct function_traits<
ReturnType(ClassType::*)(Arguments...) const ReturnType(ClassType::*)(Arguments...) const
> : function_traits<ReturnType(*)(Arguments...)> { }; > : function_traits<ReturnType(*)(Arguments...)> { };
/* support the non-const operator () /* support the non-const operator ()
* this will work with user defined functors */ * this will work with user defined functors */
template < template <
typename ClassType, typename ClassType,
typename ReturnType, typename ReturnType,
typename... Arguments typename... Arguments
> >
struct function_traits< struct function_traits<
@ -34,7 +34,7 @@ namespace sqlite {
> : function_traits<ReturnType(*)(Arguments...)> { }; > : function_traits<ReturnType(*)(Arguments...)> { };
template < template <
typename ReturnType, typename ReturnType,
typename... Arguments typename... Arguments
> >
struct function_traits< struct function_traits<

View File

@ -18,8 +18,8 @@ namespace sqlite {
while(true) { while(true) {
char *used_output; char *used_output;
switch(codecvt.out(state, remaining_input, &input[input.size()], switch(codecvt.out(state, remaining_input, &input[input.size()],
remaining_input, &result[produced_output], remaining_input, &result[produced_output],
&result[result.size() - 1] + 1, used_output)) { &result[result.size() - 1] + 1, used_output)) {
case std::codecvt_base::ok: case std::codecvt_base::ok:
result.resize(used_output - result.data()); result.resize(used_output - result.data());
return result; return result;
@ -34,7 +34,7 @@ namespace sqlite {
result.resize( result.resize(
result.size() result.size()
+ (std::max)((&input[input.size()] - remaining_input) * 3 / 2, + (std::max)((&input[input.size()] - remaining_input) * 3 / 2,
std::ptrdiff_t(4))); std::ptrdiff_t(4)));
} }
} }
} }

File diff suppressed because it is too large Load Diff