Main Page | Class List | Class Members | Related Pages

OdbcEnvironment Class Reference

Helper class for the environment handle henv. Applications need this first. More...

List of all members.

Public Member Functions

public this ()
 Sets up an environment for odbc version 3 (SQL_OV_ODBC3).
public this (uint odbcVersion)
 Sets up an environment for the odbc version passed in.
public HENV handle ()
 The underlying henv for operations not provided by this class.
public char[][2][] drivers ()
 A list of available drivers in this environment.
public OdbcConnection newConnection ()
 Returns a new, unconnected connection object bound to this environment.
public OdbcConnection connect (char[] dsn, char[] username="", char[] password="")
 Connect to a database providing DSN, and optionally username and password.
public OdbcConnection connectDriver (char[] connectionString)
 Connect to a database providing a connection string.
public void commit ()
 Commits changes for all connections.
public void rollback ()
 Rolls back changes for all connections.
public void free ()
 Deletes this object.

Static Public Member Functions

public void setLibPath (char[] odbc32dll)
 Sets the path to odbc32.dll (windows).
public bit probeOdbc32dll ()
 Probes the odbc library.
public void freeOdbc32dll ()
 Frees the odbc library. Throws an exception.

Public Attributes

public RETCODE lastRetcode
 Return code from the last API call.
public OdbcMessage lastMessage
 Diagnostics message from the last odbc call that returned SQL_SUCCESS_WITH_INFO.


Detailed Description

Helper class for the environment handle henv. Applications need this first.

After instanciating a new environment, applications can call connect and connectDriver to get an OdbcConnection.


Member Function Documentation

public void OdbcEnvironment.setLibPath char[]  odbc32dll  )  [static]
 

Sets the path to odbc32.dll (windows).

By default, the dll filename is set to odbc32.dll. Does nothing on linux

public bit OdbcEnvironment.probeOdbc32dll  )  [static]
 

Probes the odbc library.

Returns true if the library is already loaded. If not loaded, attempts to load the library and returns true on sucess, false otherwise.

If odbc32.dll is not found you can provide a path with setLibPath. Always returns true on linux

public void OdbcEnvironment.freeOdbc32dll  )  [static]
 

Frees the odbc library. Throws an exception.

Warning:
This function always throws an exception because the class destructors in this package will try to access the library.
If no destructors will be called after this call you can catch the exception and proceed.

Does nothing on linux

public OdbcEnvironment.this  ) 
 

Sets up an environment for odbc version 3 (SQL_OV_ODBC3).

Most applications will need only one environment to create all connections.

public char [][2][] OdbcEnvironment.drivers  ) 
 

A list of available drivers in this environment.

The first string in each row of the array (drivers[i][0]) holds the Driver Description. The second string in each row of the array (drivers[i][1]) holds the Driver Attributes.

public OdbcConnection OdbcEnvironment.connect char[]  dsn,
char[]  username = "",
char[]  password = ""
 

Connect to a database providing DSN, and optionally username and password.

Connects directly using default attributes and returns a connected connection object.

public OdbcConnection OdbcEnvironment.connectDriver char[]  connectionString  ) 
 

Connect to a database providing a connection string.

Connects directly using default attributes and returns a connected connection object.

If you need to set attributes prior to connect, use newConnection().

public void OdbcEnvironment.free  ) 
 

Deletes this object.

Warning:
env.free(); and delete env; both delete ALL connection and result objects derived from this environment!


Member Data Documentation

public RETCODE OdbcEnvironment.lastRetcode
 

Return code from the last API call.

If this is set to SQL_SUCCESS_WITH_INFO, the info message is available in lastMessage.


Generated on Tue Sep 21 00:33:13 2004 for Simple Database Objects by doxygen 1.3.8