Go to the documentation of this file.00001 #pragma once
00002
00003 namespace AppSecInc
00004 {
00005 namespace Databases
00006 {
00007 namespace ODBC
00008 {
00010 typedef struct
00011 {
00012 std::wstring state;
00013 std::wstring message;
00014 int native_error;
00015 } ODBCError;
00016
00018 typedef struct
00019 {
00021 std::wstring vendor;
00023 std::wstring component;
00025 std::wstring datasource;
00027 std::wstring text;
00028 } ODBCDiagnosticsMessage;
00029
00031 class ODBCHandle
00032 {
00033 protected:
00035 SQLSMALLINT _type;
00037 SQLHANDLE _handle;
00039 SQLHANDLE _hconn;
00040 private:
00041 void operator=(const ODBCHandle&);
00042 public:
00044 inline SQLHANDLE Peek() const { return _handle; }
00046 inline SQLHANDLE PeekConnection() const { return _hconn; }
00047 ODBCHandle();
00048 virtual ~ODBCHandle();
00050 void Allocate(SQLSMALLINT type, SQLHANDLE hconn);
00052 void Release();
00054 static std::wstring GetError(SQLHANDLE handle, int type);
00056 static std::vector<ODBCError> GetErrors(SQLHANDLE handle, int type);
00059 static std::vector<std::wstring> GetDiagFields(SQLHANDLE handle, int type, int diagidentifier);
00061 static std::vector<ODBCDiagnosticsMessage> GetDiagMessages(SQLHANDLE handle, int type);
00063 std::wstring GetError() const { return GetError(_handle, _type); }
00065 std::vector<ODBCError> GetErrors() const { return GetErrors(_handle, _type); }
00067 std::vector<std::wstring> GetDiagFields(int diagidentifier) const { return GetDiagFields(_handle, _type, diagidentifier); }
00069 std::vector<ODBCDiagnosticsMessage> GetDiagMessages() const { return GetDiagMessages(_handle, _type); }
00070 };
00071 }
00072 }
00073 }
00074
00075
00076
00077
00078