Restructured locations of source.
This commit is contained in:
parent
78a4c6d730
commit
7c4e8e95e8
151 changed files with 1 additions and 0 deletions
58
src/pgsql/Pgsql_Params.h
Normal file
58
src/pgsql/Pgsql_Params.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef PGSQL_PARAMS_H
|
||||
#define PGSQL_PARAMS_H
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
#include <libpq-fe.h>
|
||||
#include "Pgsql_declare.h"
|
||||
|
||||
namespace Pgsql {
|
||||
|
||||
class Params {
|
||||
public:
|
||||
Params();
|
||||
Params(const Params& rhs);
|
||||
Params& operator=(const Params& rhs);
|
||||
Params(Params&& rhs);
|
||||
Params& operator=(Params&& rhs);
|
||||
~Params();
|
||||
|
||||
|
||||
/** \brief Add a parameter to the list.
|
||||
*
|
||||
* The class takes ownership of data and will try to delete[] it.
|
||||
*/
|
||||
void addText(const char *data, Oid oid=oid_varchar);
|
||||
void add(const QString &s, Oid oid=oid_varchar);
|
||||
void addBinary(const char *data, int length, Oid oid);
|
||||
void clear();
|
||||
|
||||
bool empty() const { return m_paramTypes.empty(); }
|
||||
int size() const { return m_paramTypes.size(); }
|
||||
|
||||
const Oid* types() const { return m_paramTypes.data(); }
|
||||
const char* const* values() const { return m_paramValues.data(); }
|
||||
const int* lengths() const { return m_paramLengths.data(); }
|
||||
const int* formats() const { return m_paramFormats.data(); }
|
||||
|
||||
private:
|
||||
using t_paramValues = std::vector<const char *>;
|
||||
|
||||
void deleteValues()
|
||||
{
|
||||
for (auto e : m_paramValues)
|
||||
delete[] e;
|
||||
}
|
||||
|
||||
/* Assumes other lists already have been copied */
|
||||
void copyValues(const t_paramValues &r);
|
||||
|
||||
std::vector<Oid> m_paramTypes;
|
||||
t_paramValues m_paramValues;
|
||||
std::vector<int> m_paramLengths; ///< postgresql ignores lengths for text parameters but we will it anyway for efficient copying
|
||||
std::vector<int> m_paramFormats;
|
||||
};
|
||||
|
||||
} // end namespace Pgsql
|
||||
|
||||
#endif // PGSQL_PARAMS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue