#include <Connection.h>
Public Member Functions | |
ODBCConnection () | |
virtual | ~ODBCConnection () |
void | Initialize () |
initialize the ODBC environment at ODBC version 3.0, fails if previously initialized | |
void | Terminate () |
terminate the ODBC environment, succeeds if Initialize has not been called | |
void | Connect (const ODBCConnectionInfo &connection_info) |
connect to a host, fails if already connected | |
void | Disconnect () |
disconnect from a host, fails if not connected | |
std::wstring | GetError () const |
get the text representation of the errors on an ODBC connection handle | |
std::vector< ODBCError > | GetErrors () const |
get an array of errors on the current ODBC connection | |
operator SQLHDBC () const | |
returns the connection handle | |
BOOL | IsConnected () const |
returns true if connected | |
SQLHENV | GetEnvironmentHandle () const |
returns the environment handle | |
long | GetScalar (const std::wstring &query) const |
Return a scalar result from a query (eg. a count) | |
long | GetScalar (const std::wstring &query, ODBCHandle &stmt) const |
std::wstring | GetXml (const std::wstring &query) const |
Return the data set from a query in xml format. | |
MSXML2::IXMLDOMNodePtr | GetXml (const std::wstring &query, AppSecInc::Xml::XmlDocument &xmldoc, MSXML2::IXMLDOMNodePtr parent_node=NULL) const |
Return the data set from a query in xml format. | |
void | InsertXml (const AppSecInc::Xml::XmlDocument &xmldatadoc) |
Insert data from xml. | |
void | InsertXml (const AppSecInc::Xml::XmlDocument &xmldatadoc, AppSecInc::Xml::XmlDocument &xmldoc, MSXML2::IXMLDOMNodePtr parent_node) |
Insert data from xml. | |
void | InsertXml (const AppSecInc::Xml::XmlDocument &xmldatadoc, MSXML2::IXMLDOMNodePtr result_node, AppSecInc::Xml::XmlDocument &xmldoc, MSXML2::IXMLDOMNodePtr parent_node) |
Insert a single result set from xml. | |
std::string | GetString (const std::wstring &query, WORD flags=0) const |
Return a string result from a query. | |
std::string | GetString (const std::wstring &query, ODBCHandle &stmt, WORD flags=0) const |
Return a string result and a statement handle from a query with flags. | |
std::wstring | GetWString (const std::wstring &query, WORD flags=0) const |
Return a string result from a query. | |
std::wstring | GetWString (const std::wstring &query, ODBCHandle &stmt, WORD flags=0) const |
Return a string result and a statement handle from a query with flags. | |
void | Execute (const std::wstring &query) const |
Execute a statement. | |
void | Execute (const std::wstring &query, ODBCHandle &) const |
void | Execute (const std::wstring &query, ODBCRowSet &) const |
Return a row set from a query (eg. SELECT *) | |
void | Execute (const std::wstring &query, ODBCParameters &) const |
Execute with parameters. | |
void | Execute (const std::wstring &query, ODBCParameters &, ODBCRowSet &) const |
Execute with parameters and return data. | |
Protected Attributes | |
SQLHDBC | _hconnection |
ODBC connection handle. | |
SQLHENV | _henvironment |
ODBC environment. | |
BOOL | _connected |
successful initialization and connection flag |
An ODBC connection.
ODBCConnection::ODBCConnection | ( | ) |
ODBCConnection::~ODBCConnection | ( | ) | [virtual] |
void ODBCConnection::Connect | ( | const ODBCConnectionInfo & | connection_info | ) |
connect to a host, fails if already connected
void ODBCConnection::Disconnect | ( | ) |
disconnect from a host, fails if not connected
void ODBCConnection::Execute | ( | const std::wstring & | query | ) | const |
Execute a statement.
void ODBCConnection::Execute | ( | const std::wstring & | query, |
ODBCHandle & | stmt | ||
) | const |
void ODBCConnection::Execute | ( | const std::wstring & | query, |
ODBCRowSet & | result | ||
) | const |
Return a row set from a query (eg. SELECT *)
void ODBCConnection::Execute | ( | const std::wstring & | query, |
ODBCParameters & | params | ||
) | const |
Execute with parameters.
void ODBCConnection::Execute | ( | const std::wstring & | query, |
ODBCParameters & | params, | ||
ODBCRowSet & | result | ||
) | const |
Execute with parameters and return data.
SQLHENV AppSecInc::Databases::ODBC::ODBCConnection::GetEnvironmentHandle | ( | ) | const [inline] |
returns the environment handle
std::wstring AppSecInc::Databases::ODBC::ODBCConnection::GetError | ( | ) | const [inline] |
get the text representation of the errors on an ODBC connection handle
std::vector<ODBCError> AppSecInc::Databases::ODBC::ODBCConnection::GetErrors | ( | ) | const [inline] |
get an array of errors on the current ODBC connection
long ODBCConnection::GetScalar | ( | const std::wstring & | query | ) | const |
Return a scalar result from a query (eg. a count)
long ODBCConnection::GetScalar | ( | const std::wstring & | query, |
ODBCHandle & | stmt | ||
) | const |
std::string ODBCConnection::GetString | ( | const std::wstring & | query, |
WORD | flags = 0 |
||
) | const |
Return a string result from a query.
std::string ODBCConnection::GetString | ( | const std::wstring & | query, |
ODBCHandle & | stmt, | ||
WORD | flags = 0 |
||
) | const |
Return a string result and a statement handle from a query with flags.
std::wstring ODBCConnection::GetWString | ( | const std::wstring & | query, |
WORD | flags = 0 |
||
) | const |
Return a string result from a query.
std::wstring ODBCConnection::GetWString | ( | const std::wstring & | query, |
ODBCHandle & | stmt, | ||
WORD | flags = 0 |
||
) | const |
Return a string result and a statement handle from a query with flags.
MSXML2::IXMLDOMNodePtr ODBCConnection::GetXml | ( | const std::wstring & | query, |
AppSecInc::Xml::XmlDocument & | xmldoc, | ||
MSXML2::IXMLDOMNodePtr | parent_node = NULL |
||
) | const |
Return the data set from a query in xml format.
std::wstring ODBCConnection::GetXml | ( | const std::wstring & | query | ) | const |
Return the data set from a query in xml format.
void ODBCConnection::Initialize | ( | ) |
void ODBCConnection::InsertXml | ( | const AppSecInc::Xml::XmlDocument & | xmldatadoc, |
AppSecInc::Xml::XmlDocument & | xmldoc, | ||
MSXML2::IXMLDOMNodePtr | parent_node | ||
) |
Insert data from xml.
void ODBCConnection::InsertXml | ( | const AppSecInc::Xml::XmlDocument & | xmldatadoc, |
MSXML2::IXMLDOMNodePtr | result_node, | ||
AppSecInc::Xml::XmlDocument & | xmldoc, | ||
MSXML2::IXMLDOMNodePtr | parent_node | ||
) |
Insert a single result set from xml.
void ODBCConnection::InsertXml | ( | const AppSecInc::Xml::XmlDocument & | xmldatadoc | ) |
Insert data from xml.
BOOL AppSecInc::Databases::ODBC::ODBCConnection::IsConnected | ( | ) | const [inline] |
returns true if connected
AppSecInc::Databases::ODBC::ODBCConnection::operator SQLHDBC | ( | ) | const [inline] |
returns the connection handle
void ODBCConnection::Terminate | ( | ) |
terminate the ODBC environment, succeeds if Initialize has not been called
BOOL AppSecInc::Databases::ODBC::ODBCConnection::_connected [protected] |
successful initialization and connection flag
SQLHDBC AppSecInc::Databases::ODBC::ODBCConnection::_hconnection [protected] |
ODBC connection handle.
SQLHENV AppSecInc::Databases::ODBC::ODBCConnection::_henvironment [protected] |
ODBC environment.
© Application Security Inc. - All Rights Reserved | http://msiext.codeplex.com |