fastcgi++  3.1alpha
A C++ FastCGI/Web API
Fastcgipp::SQL::Parameters< Types > Class Template Reference

A tuple of parameters to tie to a SQL query. More...

#include <fastcgi++/sql/parameters.hpp>

Inheritance diagram for Fastcgipp::SQL::Parameters< Types >:
[legend]
Collaboration diagram for Fastcgipp::SQL::Parameters< Types >:
[legend]

Public Member Functions

void build ()
 Initialize the arrays needed by SQL. More...
 
const unsigned * oids () const
 Constant pointer to array of all parameter oids. More...
 
const char *const * raws () const
 Constant pointer to pointer array of all raw parameter data. More...
 
const int * sizes () const
 Constant pointer to array of all parameter sizes. More...
 
const int * formats () const
 Constant pointer to array of all formats. More...
 

Protected Attributes

const std::vector< unsigned > * m_oids
 Array of oids for each parameter. More...
 
std::vector< const char * > m_raws
 Array of raw data pointers for each parameter. More...
 
std::vector< int > m_sizes
 Array of sizes for each parameter. More...
 
const std::vector< int > * m_formats
 Array of formats for each parameter. More...
 

Private Member Functions

constexpr int size () const
 How many items in the tuple? More...
 
template<size_t column, size_t... columns>
void build_impl (std::index_sequence< column, columns... >)
 Recursive template SQL array building function. More...
 
template<size_t column>
void build_impl (std::index_sequence< column >)
 Terminating template SQL array building function. More...
 
void build_impl ()
 Template side virtual to populate the above arrays. More...
 

Static Private Attributes

static const std::vector< unsigned > s_oids
 
static const std::vector< int > s_formats
 

Detailed Description

template<typename... Types>
class Fastcgipp::SQL::Parameters< Types >

A tuple of parameters to tie to a SQL query.

This class allows you to pass separate parameters to a SQL query. From the interface perspective this should behave exactly like an std::tuple<Types...>. The differences from std::tuple lie in it's ability to format the tuple data in a way SQL wants to see it.

Template Parameters
TypesPack of types to contain in the tuple.
Date
October 7, 2018
Author
Eddie Carle <eddie.nosp@m.@isa.nosp@m.tec.c.nosp@m.a>

Definition at line 443 of file parameters.hpp.

Member Function Documentation

◆ build()

void Fastcgipp::SQL::Parameters_base::build ( )
inherited

Initialize the arrays needed by SQL.

Definition at line 36 of file parameters.cpp.

References Fastcgipp::SQL::Parameters_base::build_impl(), Fastcgipp::SQL::Parameters_base::m_raws, Fastcgipp::SQL::Parameters_base::m_sizes, and Fastcgipp::SQL::Parameters_base::size().

Here is the call graph for this function:

◆ build_impl() [1/3]

template<typename... Types>
void Fastcgipp::SQL::Parameters< Types >::build_impl ( )
privatevirtual

Template side virtual to populate the above arrays.

This just gets called by build().

Implements Fastcgipp::SQL::Parameters_base.

Definition at line 466 of file parameters.hpp.

◆ build_impl() [2/3]

template<typename... Types>
template<size_t column>
void Fastcgipp::SQL::Parameters< Types >::build_impl ( std::index_sequence< column >  )
inlineprivate

Terminating template SQL array building function.

Definition at line 468 of file parameters.hpp.

◆ build_impl() [3/3]

template<typename... Types>
template<size_t column, size_t... columns>
void Fastcgipp::SQL::Parameters< Types >::build_impl ( std::index_sequence< column, columns... >  )
inlineprivate

Recursive template SQL array building function.

Definition at line 459 of file parameters.hpp.

◆ formats()

const int* Fastcgipp::SQL::Parameters_base::formats ( ) const
inlineinherited

Constant pointer to array of all formats.

Definition at line 420 of file parameters.hpp.

◆ oids()

const unsigned* Fastcgipp::SQL::Parameters_base::oids ( ) const
inlineinherited

Constant pointer to array of all parameter oids.

This is not valid until build() is called

Definition at line 399 of file parameters.hpp.

◆ raws()

const char* const* Fastcgipp::SQL::Parameters_base::raws ( ) const
inlineinherited

Constant pointer to pointer array of all raw parameter data.

This is not valid until build() is called

Definition at line 408 of file parameters.hpp.

◆ size()

template<typename... Types>
constexpr int Fastcgipp::SQL::Parameters< Types >::size ( ) const
inlineconstexprprivatevirtual

How many items in the tuple?

Implements Fastcgipp::SQL::Parameters_base.

Definition at line 452 of file parameters.hpp.

◆ sizes()

const int* Fastcgipp::SQL::Parameters_base::sizes ( ) const
inlineinherited

Constant pointer to array of all parameter sizes.

Definition at line 414 of file parameters.hpp.

Member Data Documentation

◆ m_formats

const std::vector<int>* Fastcgipp::SQL::Parameters_base::m_formats
protectedinherited

Array of formats for each parameter.

This gets initialized by calling build(). It is really just an array of 1s.

Definition at line 383 of file parameters.hpp.

◆ m_oids

const std::vector<unsigned>* Fastcgipp::SQL::Parameters_base::m_oids
protectedinherited

Array of oids for each parameter.

This gets initialized by calling build().

Definition at line 364 of file parameters.hpp.

◆ m_raws

std::vector<const char*> Fastcgipp::SQL::Parameters_base::m_raws
protectedinherited

Array of raw data pointers for each parameter.

This gets initialized by calling build().

Definition at line 370 of file parameters.hpp.

Referenced by Fastcgipp::SQL::Parameters_base::build().

◆ m_sizes

std::vector<int> Fastcgipp::SQL::Parameters_base::m_sizes
protectedinherited

Array of sizes for each parameter.

This gets initialized by calling build().

Definition at line 376 of file parameters.hpp.

Referenced by Fastcgipp::SQL::Parameters_base::build().

◆ s_formats

template<typename... Types>
const std::vector< int > Fastcgipp::SQL::Parameters< Types >::s_formats
staticprivate

Definition at line 449 of file parameters.hpp.

◆ s_oids

template<typename... Types>
const std::vector< unsigned > Fastcgipp::SQL::Parameters< Types >::s_oids
staticprivate
Initial value:

Definition at line 448 of file parameters.hpp.


The documentation for this class was generated from the following file:
Fastcgipp::SQL::Parameter
A single parameter in an SQL query.
Definition: parameters.hpp:87