29#include <sptk5/Logger.h>
30#include <sptk5/Strings.h>
31#include <sptk5/Variant.h>
32#include <sptk5/db/DatabaseConnectionString.h>
47using DBHandle = uint8_t*;
48using StmtHandle = uint8_t*;
49using SStmtHandle = std::shared_ptr<uint8_t>;
220 std::map<Query*, SStmtHandle> m_queryList;
295 return m_driverDescription;
318 return m_inTransaction;
343 _bulkInsert(tableName, columnNames, data);
356 _executeBatchFile(batchFileName, errors);
369 _executeBatchSQL(batchSQL, errors);
373 bool getInTransaction()
const;
375 void setInTransaction(
bool inTransaction);
403 virtual
void _openDatabase(const
String& connectionString);
410 virtual
void closeDatabase();
417 virtual
void driverBeginTransaction();
425 virtual
void driverEndTransaction(
bool commit);
434 [[noreturn]] static
void logAndThrow(const
String& method, const
String& error);
446 virtual
void _bulkInsert(const
String& tableName, const
Strings& columnNames,
457 virtual
void _executeBatchFile(const
String& batchFileName,
Strings* errors);
474 m_connType = connType;
485 const std::vector<VariantVector>::const_iterator& begin,
486 const std::vector<VariantVector>::const_iterator& end);
494 return m_connectionTimeout;
500 String m_driverDescription;
501 bool m_inTransaction {
false};
502 std::chrono::seconds m_connectionTimeout;
505using SPoolDatabaseConnection = std::shared_ptr<PoolDatabaseConnection>;
Definition: DatabaseConnectionString.h:56
Definition: PoolDatabaseConnection.h:98
void disconnectAllQueries()
virtual String paramMark(unsigned paramIndex)
bool unlinkQuery(Query *q)
static void querySetEof(Query *q, bool eof)
virtual void queryFetch(Query *query)=0
virtual int queryColCount(Query *query)=0
static void querySetActive(Query *q, bool af)
virtual void queryPrepare(Query *query)=0
virtual void queryBindParameters(Query *query)=0
void notImplemented(const String &methodName) const
virtual void queryCloseStmt(Query *query)=0
virtual void queryExecute(Query *query)=0
virtual void queryOpen(Query *query)=0
virtual void queryFreeStmt(Query *query)=0
void querySetStmt(Query *q, SStmtHandle stmt)
virtual void queryAllocStmt(Query *query)=0
virtual void queryColAttributes(Query *query, int16_t column, int16_t descType, char *buff, int len)=0
virtual String queryError(const Query *query) const =0
virtual void queryColAttributes(Query *query, int16_t column, int16_t descType, int32_t &value)=0
static void querySetPrepared(Query *q, bool pf)
Definition: PoolDatabaseConnection.h:231
void bulkInsert(const String &tableName, const Strings &columnNames, const std::vector< VariantVector > &data)
Definition: PoolDatabaseConnection.h:341
void rollbackTransaction()
virtual String driverDescription() const
Definition: PoolDatabaseConnection.h:293
virtual String nativeConnectionString() const
Definition: PoolDatabaseConnection.h:277
void bulkInsertRecords(const String &tableName, const Strings &columnNames, const std::vector< VariantVector >::const_iterator &begin, const std::vector< VariantVector >::const_iterator &end)
const DatabaseConnectionString & connectionString() const
Definition: PoolDatabaseConnection.h:263
PoolDatabaseConnection(const String &connectionString, DatabaseConnectionType connectionType, std::chrono::seconds connectTimeout)
virtual DatabaseConnectionType connectionType() const
Definition: PoolDatabaseConnection.h:285
void executeBatchFile(const String &batchFileName, Strings *errors=nullptr)
Definition: PoolDatabaseConnection.h:354
virtual void objectList(DatabaseObjectType objectType, Strings &objects)=0
virtual DBHandle handle() const
virtual bool active() const
std::chrono::seconds connectTimout() const
Definition: PoolDatabaseConnection.h:492
void connectionString(const DatabaseConnectionString &connectionString)
void executeBatchSQL(const sptk::Strings &batchSQL, Strings *errors=nullptr)
Definition: PoolDatabaseConnection.h:367
void open(const String &connectionString="")
bool inTransaction() const
Definition: PoolDatabaseConnection.h:316
DatabaseObjectType
Definition: PoolDatabaseConnection.h:70
SP_EXPORT String escapeSQLString(const String &str, bool tsv=false)
DatabaseConnectionType
Definition: PoolDatabaseConnection.h:55
std::map< std::string, QueryColumnTypeSize, std::less<> > QueryColumnTypeSizeMap
Definition: PoolDatabaseConnection.h:95
std::vector< QueryColumnTypeSize > QueryColumnTypeSizeVector
Definition: PoolDatabaseConnection.h:90
@ FUNCTIONS
Stored functions.
@ DATABASES
Available databases.
@ PROCEDURES
Stored procedures.
@ GENERIC_ODBC
Generic ODBC.
VariantDataType
Definition: VariantData.h:44
std::vector< Variant > VariantVector
Definition: Variant.h:567
Definition: PoolDatabaseConnection.h:82
size_t length
Column data size.
Definition: PoolDatabaseConnection.h:84
VariantDataType type
Column type.
Definition: PoolDatabaseConnection.h:83