Skip to content

Commit 269a6f3

Browse files
committed
Split method into overload set
1 parent bcd030e commit 269a6f3

File tree

1 file changed

+32
-15
lines changed

1 file changed

+32
-15
lines changed

include/tao/pq/transaction.hpp

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,41 @@ namespace tao::pq
121121

122122
[[nodiscard]] auto subtransaction() -> std::shared_ptr< transaction >;
123123

124+
void send( const internal::zsv statement )
125+
{
126+
send_params( statement, 0, nullptr, nullptr, nullptr, nullptr );
127+
}
128+
129+
template< parameter_type_direct... As >
130+
void send( const internal::zsv statement, As&&... as )
131+
{
132+
send_traits( statement, parameter_traits< std::decay_t< As > >( std::forward< As >( as ) )... );
133+
}
134+
135+
template< std::size_t Max >
136+
void send( const internal::zsv statement, const parameter< Max >& p )
137+
{
138+
send_params( statement, p.m_size, p.m_types, p.m_values, p.m_lengths, p.m_formats );
139+
}
140+
141+
template< std::size_t Max >
142+
void send( const internal::zsv statement, parameter< Max >& p )
143+
{
144+
send_params( statement, p.m_size, p.m_types, p.m_values, p.m_lengths, p.m_formats );
145+
}
146+
147+
template< std::size_t Max >
148+
void send( const internal::zsv statement, parameter< Max >&& p )
149+
{
150+
send_params( statement, p.m_size, p.m_types, p.m_values, p.m_lengths, p.m_formats );
151+
}
152+
124153
template< parameter_type... As >
154+
requires internal::contains_parameter< As... >
125155
void send( const internal::zsv statement, As&&... as )
126156
{
127-
if constexpr( sizeof...( As ) == 0 ) {
128-
send_params( statement, 0, nullptr, nullptr, nullptr, nullptr );
129-
}
130-
else if constexpr( internal::contains_parameter< As... > ) {
131-
if constexpr( sizeof...( As ) == 1 ) {
132-
( send_params( statement, as.m_size, as.m_types, as.m_values, as.m_lengths, as.m_formats ), ... );
133-
}
134-
else {
135-
const parameter< internal::parameter_size< As... > > p( std::forward< As >( as )... );
136-
send_params( statement, p.m_size, p.m_types, p.m_values, p.m_lengths, p.m_formats );
137-
}
138-
}
139-
else {
140-
send_traits( statement, parameter_traits< std::decay_t< As > >( std::forward< As >( as ) )... );
141-
}
157+
const parameter< internal::parameter_size< As... > > p( std::forward< As >( as )... );
158+
send_params( statement, p.m_size, p.m_types, p.m_values, p.m_lengths, p.m_formats );
142159
}
143160

144161
void set_single_row_mode();

0 commit comments

Comments
 (0)