8 #ifndef SOCI_POSTGRESQL_COMMON_H_INCLUDED 9 #define SOCI_POSTGRESQL_COMMON_H_INCLUDED 33 int const converted = std::sscanf(buf,
"%" LL_FMT_FLAGS "d%n", &t, &n);
34 if (converted == 1 && static_cast<std::size_t>(n) == std::strlen(buf))
39 const T max = (std::numeric_limits<T>::max)();
40 const T min = (std::numeric_limits<T>::min)();
41 if (t <= static_cast<long long>(max) &&
42 t >=
static_cast<long long>(min))
44 return static_cast<T
>(t);
57 if (buf[0] ==
't' && buf[1] ==
'\0')
59 return static_cast<T
>(1);
61 else if (buf[0] ==
'f' && buf[1] ==
'\0')
63 return static_cast<T
>(0);
76 unsigned long long t(0);
78 int const converted = std::sscanf(buf,
"%" LL_FMT_FLAGS "u%n", &t, &n);
79 if (converted == 1 && static_cast<std::size_t>(n) == std::strlen(buf))
84 const T max = (std::numeric_limits<T>::max)();
85 if (t <= static_cast<unsigned long long>(max))
87 return static_cast<T
>(t);
100 if (buf[0] ==
't' && buf[1] ==
'\0')
102 return static_cast<T
>(1);
104 else if (buf[0] ==
'f' && buf[1] ==
'\0')
106 return static_cast<T
>(0);
122 template <
typename T>
125 std::vector<T> * v =
static_cast<std::vector<T> *
>(p);
135 #endif // SOCI_POSTGRESQL_COMMON_H_INCLUDED std::size_t get_vector_size(void *p)
T string_to_integer(char const *buf)
T string_to_unsigned_integer(char const *buf)
void parse_std_tm(char const *buf, std::tm &t)
double string_to_double(char const *buf)
SOCI_POSTGRESQL_DECL postgresql_backend_factory const postgresql