ServerWindow shows list of databases.
This commit is contained in:
parent
e71ef2e6df
commit
612b524151
15 changed files with 307 additions and 172 deletions
49
src/Pgsql_Params.h
Normal file
49
src/Pgsql_Params.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef PGSQL_PARAMS_H
|
||||
#define PGSQL_PARAMS_H
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
#include <pgsql/libpq-fe.h>
|
||||
#include "Pgsql_declare.h"
|
||||
|
||||
namespace Pgsql {
|
||||
|
||||
class Params {
|
||||
public:
|
||||
Params();
|
||||
Params(const Params& rhs);
|
||||
Params& operator=(const Params& rhs);
|
||||
Params(const 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();
|
||||
|
||||
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