sqlIfError.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 
00008 
00009 #pragma once
00010 
00011 #include "vlDatabase.h"
00012 
00013 #ifdef _WIN32
00014 #include <windows.h>
00015 #include <sqltypes.h>
00016 #include <odbcinst.h>
00017 #else
00018 #include <sqltypes.h>
00019 #include <iodbcinst.h>
00020 #endif
00021 #if !defined(_INC_STDIO) && !defined(_STDIO_H)
00022 #include <stdio.h>
00023 #endif
00024 
00025 
00026 //
00027 // class DtSqlIfErrorHandler:
00028 //
00029 // Since the process for getting error information from the ODBC driver is 
00030 // somewhat circuitous, this class encapsulates the necessary calls, and writes 
00031 // any error messages to the log file provided. It checks the return code 
00032 // provided, so processReturnCode may be called immediately after any ODBC 
00033 // interface call without checking the returned error code first.
00034 //
00035 class DT_DLL_VLDB DtSqlIfErrorHandler
00036 {
00037 public:
00038    // Default constructor
00039    DtSqlIfErrorHandler();
00040 
00041    // Destructor
00042    virtual ~DtSqlIfErrorHandler();
00043 
00044    // process the return code from an ODBC interface call
00045    virtual void processRetCode(
00046       SQLRETURN retCode, SQLSMALLINT handle_type, SQLHANDLE handle );
00047 
00048    static bool SqlSuccess(SQLRETURN rc);
00049 };
00050 
00051 inline bool DtSqlIfErrorHandler::SqlSuccess(SQLRETURN rc)
00052 {
00053    return ( (rc == SQL_SUCCESS) || (rc == SQL_SUCCESS_WITH_INFO) );
00054 }

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)