From e960e424ae4b8e5a9387760c2d2e5475167b18d8 Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 17 Feb 2011 20:42:53 +0000 Subject: Add check function for when a connection is finished with, but you don't want to close it Use prepared statements only for modifications, use fetch instead for selects (doesn't load an entire record set) Support varchar oid --- libodbcpp/connection.cpp | 9 +++++++++ libodbcpp/connection.h | 1 + 2 files changed, 10 insertions(+) (limited to 'libodbcpp') diff --git a/libodbcpp/connection.cpp b/libodbcpp/connection.cpp index 087fc69..8619201 100644 --- a/libodbcpp/connection.cpp +++ b/libodbcpp/connection.cpp @@ -100,6 +100,15 @@ ODBC::Connection::~Connection() } } +void +ODBC::Connection::finish() const +{ + if (txDepth != 0) { + rollbackTx(); + throw Error("Transaction still open"); + } +} + int ODBC::Connection::beginTx() const { diff --git a/libodbcpp/connection.h b/libodbcpp/connection.h index 4fc52ca..0e507bd 100644 --- a/libodbcpp/connection.h +++ b/libodbcpp/connection.h @@ -16,6 +16,7 @@ namespace ODBC { SQLHENV env; SQLHDBC conn; + void finish() const; int beginTx() const; int commitTx() const; int rollbackTx() const; -- cgit v1.2.3