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