Skip to content

Commit

Permalink
Add missing gate headers to Makefile.am. (jtv#658)
Browse files Browse the repository at this point in the history
Fix `configure`-based install: missing header files.
  • Loading branch information
jtv committed Mar 16, 2023
1 parent 1c19aae commit 1afb8cd
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 78 deletions.
2 changes: 1 addition & 1 deletion config/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ am__can_run_installinfo = \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in compile config.guess \
config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
config.sub install-sh ltmain.sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
Expand Down
4 changes: 3 additions & 1 deletion include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ nobase_include_HEADERS= pqxx/pqxx \
pqxx/internal/gates/connection-notification_receiver.hxx \
pqxx/internal/gates/connection-pipeline.hxx \
pqxx/internal/gates/connection-sql_cursor.hxx \
pqxx/internal/gates/connection-stream_from.hxx \
pqxx/internal/gates/connection-stream_to.hxx \
pqxx/internal/gates/connection-transaction.hxx \
pqxx/internal/gates/errorhandler-connection.hxx \
pqxx/internal/gates/icursorstream-icursor_iterator.hxx \
pqxx/internal/gates/icursor_iterator-icursorstream.hxx \
pqxx/internal/gates/icursorstream-icursor_iterator.hxx \
pqxx/internal/gates/result-connection.hxx \
pqxx/internal/gates/result-creation.hxx \
pqxx/internal/gates/result-pipeline.hxx \
Expand Down
4 changes: 3 additions & 1 deletion include/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,12 @@ nobase_include_HEADERS = pqxx/pqxx \
pqxx/internal/gates/connection-notification_receiver.hxx \
pqxx/internal/gates/connection-pipeline.hxx \
pqxx/internal/gates/connection-sql_cursor.hxx \
pqxx/internal/gates/connection-stream_from.hxx \
pqxx/internal/gates/connection-stream_to.hxx \
pqxx/internal/gates/connection-transaction.hxx \
pqxx/internal/gates/errorhandler-connection.hxx \
pqxx/internal/gates/icursorstream-icursor_iterator.hxx \
pqxx/internal/gates/icursor_iterator-icursorstream.hxx \
pqxx/internal/gates/icursorstream-icursor_iterator.hxx \
pqxx/internal/gates/result-connection.hxx \
pqxx/internal/gates/result-creation.hxx \
pqxx/internal/gates/result-pipeline.hxx \
Expand Down
3 changes: 2 additions & 1 deletion include/pqxx/internal/encodings.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,8 @@ get_s_char_finder(encoding_group enc)
case encoding_group::BIG5:
return pqxx::internal::find_s_ascii_char<encoding_group::BIG5, NEEDLE...>;
case encoding_group::GB18030:
return pqxx::internal::find_s_ascii_char<encoding_group::GB18030, NEEDLE...>;
return pqxx::internal::find_s_ascii_char<
encoding_group::GB18030, NEEDLE...>;
case encoding_group::GBK:
return pqxx::internal::find_s_ascii_char<encoding_group::GBK, NEEDLE...>;
case encoding_group::JOHAB:
Expand Down
12 changes: 5 additions & 7 deletions include/pqxx/internal/stream_query.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ private:
/** This is the only encoding-dependent code in the class. All we need to
* store after that is this function pointer.
*/
static inline char_finder_func *
get_finder(transaction_base const &tx);
static inline char_finder_func *get_finder(transaction_base const &tx);

/// Scan and unescape a field into the row buffer.
/** The row buffer is `m_row`.
Expand Down Expand Up @@ -259,8 +258,8 @@ private:
* function will update this value.
* @return Field value converted to TARGET type.
*/
template<typename TARGET> TARGET
parse_field(zview line, std::size_t &offset, char *&write)
template<typename TARGET>
TARGET parse_field(zview line, std::size_t &offset, char *&write)
{
using field_type = strip_t<TARGET>;
using nullity = nullness<field_type>;
Expand All @@ -274,9 +273,8 @@ private:
{
if (std::data(text) != nullptr)
throw conversion_error{concat(
"Streaming a non-null value into a ", type_name<field_type>,
", which must always be null."
)};
"Streaming a non-null value into a ", type_name<field_type>,
", which must always be null.")};
}
else if (std::data(text) == nullptr)
{
Expand Down
17 changes: 10 additions & 7 deletions include/pqxx/internal/stream_query_impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ inline stream_query<TYPE...>::stream_query(
auto const r{tx.exec0(internal::concat("COPY (", query, ") TO STDOUT"))};
if (r.columns() != sizeof...(TYPE))
throw usage_error{concat(
"Parsing query stream with wrong number of columns: "
"code expects ", sizeof...(TYPE), " but query returns ", r.columns(),
".")};
"Parsing query stream with wrong number of columns: "
"code expects ",
sizeof...(TYPE), " but query returns ", r.columns(), ".")};
register_me();
}

Expand All @@ -45,7 +45,9 @@ public:
using value_type = std::tuple<TYPE...>;

explicit stream_query_input_iterator(stream_t &home) : m_home(home)
{ consume_line(); }
{
consume_line();
}
stream_query_input_iterator(stream_query_input_iterator const &) = default;
stream_query_input_iterator(stream_query_input_iterator &&) = default;

Expand Down Expand Up @@ -124,8 +126,8 @@ template<typename... TYPE> inline auto stream_query<TYPE...>::begin() &
}


template<typename... TYPE> inline
std::pair<typename stream_query<TYPE...>::line_handle, std::size_t>
template<typename... TYPE>
inline std::pair<typename stream_query<TYPE...>::line_handle, std::size_t>
stream_query<TYPE...>::read_line() &
{
assert(not done());
Expand All @@ -135,7 +137,8 @@ stream_query<TYPE...>::read_line() &
{
auto line{gate.read_copy_line()};
// Check for completion.
if (not line.first) PQXX_UNLIKELY close();
if (not line.first)
PQXX_UNLIKELY close();
return line;
}
catch (std::exception const &)
Expand Down
83 changes: 36 additions & 47 deletions include/pqxx/range.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public:

/// Would this bound, as a lower bound, include value?
[[nodiscard]] constexpr bool extends_down_to(TYPE const &value) const
noexcept(noexcept(value < m_value))
noexcept(noexcept(value < m_value))
{
return not(value < m_value);
}

/// Would this bound, as an upper bound, include value?
[[nodiscard]] constexpr bool extends_up_to(TYPE const &value) const
noexcept(noexcept(value < m_value))
noexcept(noexcept(value < m_value))
{
return not(m_value < value);
}
Expand Down Expand Up @@ -88,14 +88,14 @@ public:

/// Would this bound, as a lower bound, include value?
[[nodiscard]] constexpr bool extends_down_to(TYPE const &value) const
noexcept(noexcept(m_value < value))
noexcept(noexcept(m_value < value))
{
return m_value < value;
}

/// Would this bound, as an upper bound, include value?
[[nodiscard]] constexpr bool extends_up_to(TYPE const &value) const
noexcept(noexcept(value < m_value))
noexcept(noexcept(value < m_value))
{
return value < m_value;
}
Expand All @@ -115,24 +115,26 @@ public:
range_bound() = delete;
constexpr range_bound(no_bound) noexcept : m_bound{} {}

constexpr range_bound(inclusive_bound<TYPE> const &bound)
noexcept(noexcept(inclusive_bound<TYPE>{bound})) : m_bound{bound} {}
constexpr range_bound(inclusive_bound<TYPE> const &bound) noexcept(
noexcept(inclusive_bound<TYPE>{bound})) :
m_bound{bound}
{}

constexpr range_bound(exclusive_bound<TYPE> const &bound)
noexcept(noexcept(exclusive_bound{bound})) : m_bound{bound} {}
constexpr range_bound(exclusive_bound<TYPE> const &bound) noexcept(
noexcept(exclusive_bound{bound})) :
m_bound{bound}
{}

constexpr range_bound(range_bound const &)
noexcept(
noexcept(inclusive_bound<TYPE>{std::declval<inclusive_bound<TYPE> const &>()}) and
noexcept(exclusive_bound<TYPE>{std::declval<exclusive_bound<TYPE> const &>()})
)
= default;
constexpr range_bound(range_bound const &) noexcept(
noexcept(inclusive_bound<TYPE>{
std::declval<inclusive_bound<TYPE> const &>()})
and noexcept(exclusive_bound<TYPE>{
std::declval<exclusive_bound<TYPE> const &>()})) = default;

constexpr range_bound(range_bound &&)
= default;
constexpr range_bound(range_bound &&) = default;

constexpr bool operator==(range_bound const &rhs) const
noexcept(noexcept(*this->value() == *rhs.value()))
noexcept(noexcept(*this->value() == *rhs.value()))
{
if (this->is_limited())
return (
Expand All @@ -143,7 +145,7 @@ public:
}

constexpr bool operator!=(range_bound const &rhs) const
noexcept(noexcept(*this == rhs))
noexcept(noexcept(*this == rhs))
{
return not(*this == rhs);
}
Expand Down Expand Up @@ -172,19 +174,17 @@ public:
constexpr bool extends_down_to(TYPE const &value) const
{
return std::visit(
[&value](auto const &bound)
noexcept(noexcept(bound.extends_down_to(value)))
{ return bound.extends_down_to(value); },
[&value](auto const &bound) noexcept(noexcept(bound.extends_down_to(
value))) { return bound.extends_down_to(value); },
m_bound);
}

/// Would this bound, as an upper bound, include `value`?
constexpr bool extends_up_to(TYPE const &value) const
{
return std::visit(
[&value](auto const &bound)
noexcept(noexcept(bound.extends_up_to(value)))
{ return bound.extends_up_to(value); },
[&value](auto const &bound) noexcept(noexcept(
bound.extends_up_to(value))) { return bound.extends_up_to(value); },
m_bound);
}

Expand Down Expand Up @@ -250,28 +250,25 @@ public:
/** SQL has a separate literal to denote an empty range, but any range which
* encompasses no values is an empty range.
*/
constexpr range()
noexcept(noexcept(exclusive_bound<TYPE>{TYPE{}})) :
constexpr range() noexcept(noexcept(exclusive_bound<TYPE>{TYPE{}})) :
m_lower{exclusive_bound<TYPE>{TYPE{}}},
m_upper{exclusive_bound<TYPE>{TYPE{}}}
{}

constexpr bool operator==(range const &rhs) const
noexcept
(
noexcept(this->lower_bound() == rhs.lower_bound()) and
noexcept(this->upper_bound() == rhs.upper_bound()) and
noexcept(this->empty())
)
noexcept(noexcept(this->lower_bound() == rhs.lower_bound()) and noexcept(
this->upper_bound() == rhs.upper_bound()) and noexcept(this->empty()))
{
return (this->lower_bound() == rhs.lower_bound() and
this->upper_bound() == rhs.upper_bound()) or
(this->empty() and rhs.empty());
}

constexpr bool operator!=(range const &rhs) const
noexcept(noexcept(*this == rhs))
{ return not (*this == rhs); }
noexcept(noexcept(*this == rhs))
{
return not(*this == rhs);
}

range(range const &) = default;
range(range &&) = default;
Expand All @@ -288,25 +285,17 @@ public:
* floating-point types, but with more subtleties and edge cases.
*/
constexpr bool empty() const
noexcept
(
noexcept(m_lower.is_exclusive()) and
noexcept(m_lower.is_limited()) and
noexcept(*m_lower.value() < *m_upper.value())
)
noexcept(noexcept(m_lower.is_exclusive()) and noexcept(
m_lower.is_limited()) and noexcept(*m_lower.value() < *m_upper.value()))
{
return (m_lower.is_exclusive() or m_upper.is_exclusive()) and
m_lower.is_limited() and m_upper.is_limited() and
not(*m_lower.value() < *m_upper.value());
}

/// Does this range encompass `value`?
constexpr bool contains(TYPE value) const
noexcept
(
noexcept(m_lower.extends_down_to(value)) and
noexcept(m_upper.extends_up_to(value))
)
constexpr bool contains(TYPE value) const noexcept(noexcept(
m_lower.extends_down_to(value)) and noexcept(m_upper.extends_up_to(value)))
{
return m_lower.extends_down_to(value) and m_upper.extends_up_to(value);
}
Expand All @@ -316,7 +305,7 @@ public:
* that integer ranges `[0,9]` and `[0,10)` contain the same values.
*/
constexpr bool contains(range<TYPE> const &other) const
noexcept(noexcept((*this & other) == other))
noexcept(noexcept((*this & other) == other))
{
return (*this & other) == other;
}
Expand Down
6 changes: 3 additions & 3 deletions src/wait.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ void pqxx::internal::wait_fd(
(for_read ? POLLRDNORM : 0) | (for_write ? POLLWRNORM : 0))};
WSAPOLLFD fdarray{SOCKET(fd), events, 0};
int const code{
WSAPoll(&fdarray, 1u, to_milli<unsigned>(seconds, microseconds))
};
WSAPoll(&fdarray, 1u, to_milli<unsigned>(seconds, microseconds))};
#elif defined(PQXX_HAVE_POLL)
auto const events{static_cast<short>(
POLLERR | POLLHUP | POLLNVAL | (for_read ? POLLIN : 0) |
Expand Down Expand Up @@ -130,7 +129,8 @@ void pqxx::internal::wait_fd(
if (code == -1)
{
std::array<char, 200> errbuf;
int const err_code{
int const err_code
{
#if defined(_WIN32) && (_WIN32_WINNT >= 0x0600)
WSAGetLastError()
#else
Expand Down
17 changes: 7 additions & 10 deletions test/unit/test_stream_query.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ void test_stream_parses_awkward_strings()
PQXX_CHECK_EQUAL(
values[4].value(), "\x81\x5c", "Finicky SJIS character went badly.");
PQXX_CHECK_EQUAL(values[5].value(), "\t", "Tab unescaped wrong.");
PQXX_CHECK_EQUAL(values[6].value(), "\\\\\\\n\\\\", "Backslashes confused stream.");
PQXX_CHECK_EQUAL(
values[6].value(), "\\\\\\\n\\\\", "Backslashes confused stream.");
}


Expand All @@ -177,15 +178,11 @@ void test_stream_handles_nulls_in_all_places()
pqxx::connection conn;
pqxx::work tx{conn};
int counter{0};
for (auto [a, b, c, d, e] : tx.stream<
std::optional<std::string>,
std::optional<int>,
int,
std::optional<std::string>,
std::optional<std::string>
>(
"SELECT NULL::text, NULL::integer, 11, NULL::text, NULL::text"
))
for (auto [a, b, c, d, e] :
tx.stream<
std::optional<std::string>, std::optional<int>, int,
std::optional<std::string>, std::optional<std::string>>(
"SELECT NULL::text, NULL::integer, 11, NULL::text, NULL::text"))
{
++counter;
PQXX_CHECK(not a, "Starting null did not come through.");
Expand Down

0 comments on commit 1afb8cd

Please sign in to comment.