MAK Data Logger API Documentation for HLA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sqlIfConnection.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1992-2024 MAK Technologies, Inc
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #ifdef _WIN32
12 #include <windows.h>
13 #include <sqltypes.h>
14 #else
15 #include <sqltypes.h>
16 #endif
17 
18 #include "sqlIfError.h"
19 #include "databaseConnection.h"
20 
22 class DtSqlEnvironment;
23 
24 
25 //
26 // class DtSqlIfConnection:
27 //
28 // To talk to a database, you need to create a connection to it.
29 // DtSqlIfConnection is provided with an SQL environment handle, and creates
30 // a connection object. Once the connection object is created, you can then
31 // connect to a database. You can allocate a connection and environment
32 // directly and provide them as arguments to a DtSqlIfDatabase constructor,
33 // but it's easier to let the database object create both of these for you.
34 //
36 {
37 public:
38  // Main constructor
39  explicit DtSqlConnection( DtSqlEnvironment& environment);
40 
41  // Destructor
42  virtual ~DtSqlConnection();
43 
45  virtual void setConnectionParameters(DtDatabaseParameters* params, bool useMaster );
46 
47  // Make a connection to a database using the connection object created
48  // by this class at construction time
49  virtual bool connect();
50  virtual bool connectSansDSN();
51 
52  // Disconnect from the currently connected database
53  virtual bool disconnect();
54 
55  // Accessors/Mutators
56  // Return a handle to the connection object
57  SQLHDBC handle();
58 
59  // Returns true if we are currently connected to a DB, false otherwise
60  bool isConnected() const;
61 
62 protected:
63 
64  SQLHDBC myHandle;
69 };
DtDatabaseParameters * myParameters
Definition: sqlIfConnection.h:67
SQLHDBC myHandle
Definition: sqlIfConnection.h:64
virtual bool connect()=0
virtual void setConnectionParameters(DtDatabaseParameters *, bool useMaster)=0
Set the connection parameters.
DtSqlIfErrorHandler myErrorHandler
Definition: sqlIfConnection.h:66
bool myConnected
Definition: sqlIfConnection.h:65
Definition: sqlIfConnection.h:35
Contains DtDatabaseConnection class.
Contains DtSqlIfErrorHandler.
An abstract database connection.
Definition: databaseConnection.h:17
Definition: sqlIfError.h:41
#define DT_DLL_VLDB
Definition: vlDatabase.h:20
virtual bool connectSansDSN()=0
virtual bool disconnect()=0
Abstract Database parameters.
Definition: databaseParameters.h:17
bool myUseMaster
Definition: sqlIfConnection.h:68
allocates an environment and uses DtSqlIfErrorHandler to process errors To make most ODBC interface c...
Definition: sqlIfEnv.h:25

Document ID: Generated on Thu Oct 3 15:35:11 EDT 2024 from SVN revision 270037
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)