sqlIfConnection.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 #ifdef _WIN32
00012 #include <windows.h>
00013 #include <sqltypes.h>
00014 #else
00015 #include <sqltypes.h>
00016 #endif
00017 
00018 #include "sqlIfError.h"
00019 #include "databaseConnection.h"
00020 
00021 class DtDatabaseParameters;
00022 class DtSqlEnvironment;
00023 
00024 
00025 //
00026 // class DtSqlIfConnection:
00027 //
00028 // To talk to a database, you need to create a connection to it. 
00029 // DtSqlIfConnection is provided with an SQL environment handle, and creates
00030 // a connection object.  Once the connection object is created, you can then
00031 // connect to a database.  You can allocate a connection and environment 
00032 // directly and provide them as arguments to a DtSqlIfDatabase constructor,
00033 // but it's easier to let the database object create both of these for you.
00034 //
00035 class DT_DLL_VLDB DtSqlConnection : public DtDatabaseConnection
00036 {
00037 public:
00038    // Main constructor
00039    explicit DtSqlConnection( DtSqlEnvironment& environment);
00040 
00041    // Destructor
00042    virtual ~DtSqlConnection();
00043 
00045    virtual void setConnectionParameters(DtDatabaseParameters* params, bool useMaster );
00046 
00047    // Make a connection to a database using the connection object created
00048    // by this class at construction time
00049    virtual bool connect();
00050    virtual bool connectSansDSN();
00051 
00052    // Disconnect from the currently connected database
00053    virtual bool disconnect();
00054 
00055    // Accessors/Mutators
00056    // Return a handle to the connection object
00057    SQLHDBC handle();
00058 
00059    // Returns true if we are currently connected to a DB, false otherwise
00060    bool isConnected() const;
00061 
00062 protected:
00063 
00064    SQLHDBC  myHandle;
00065    bool     myConnected;
00066    DtSqlIfErrorHandler myErrorHandler;
00067    DtDatabaseParameters* myParameters;
00068    bool myUseMaster;
00069 };

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)