Unicorn XML Toolkit
Version 1.00.00

Namespace Sql
Class CSqlConnection

class CSqlConnection: public CInterface {
public:
    CSqlConnection();
    virtual ~CSqlConnection();
public:
    enum {
        autoCommit,
        manualCommit
        };
public:
    virtual void Connect(
        const CString &strSource,
        const CString &strUser,
        const CString &strAuthentication) = 0;
    virtual void SetCommitMode(int nMode) = 0;
    virtual void Commit() = 0;
    virtual void Rollback() = 0;
    virtual XSqlStatement CreateStatement() = 0;
    };  

The abstract interace to connection objects.

The connection object represents connection to a single data source.

Connection objects provide interface for controlling transactions and serve as factories for SQL statements.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
CSqlStatement
Constructor/Destructor Summary
CSqlConnection ();
����������Constructs the connection object.
~CSqlConnection ();
����������Destroys the connection object.

Function Summary
void Connect (const CString &strSource, const CString &strUser, const CString &strAuthentication);
����������Connects to a specified data source.
void SetCommitMode (int nMode);
����������Specifies the new commit mode for this connection.
void Commit ();
����������Commits all transactions on this connection.
void Rollback ();
����������Rollbacks all transactions on this connection.
XSqlStatement CreateStatement ();
����������Creates a new statement.

Constructor/Destructor Detail

CSqlConnection

CSqlConnection();

Constructs the connection object.

~CSqlConnection

virtual ~CSqlConnection();

Destroys the connection object.

Function Detail

Connect

virtual void Connect(
    const CString &strSource,
    const CString &strUser,
    const CString &strAuthentication) = 0;

Connects to a specified data source.

The connection to the data source must be established prior to any data access operation.

The name of the data source must be specified as the parameter of Connect . The format of the data source name is platform-dependent.

Some data sources may require specification of the user name and the authentication information as additional parameters. The format of the user name and the authentication information is platform-dependent.

Parameters:
strSource - the data source name
strUser - the optional user name; the empty string if not specified
strAuthentication - the optional authentication string; empty if not specified

SetCommitMode

virtual void SetCommitMode(int nMode) = 0;

Specifies the new commit mode for this connection.

The allowed values for the commit mode are autoCommit and manualCommit . The commit mode indicates the application programmers' suggestions about how transactions should be commited.

The value autoCommit specifies the auto-commit mode. When this mode is set, each statement is commited immediately after it is executed. This is the default mode.

The value manualCommit specifies the manual-commit mode. When this mode is set, a new transaction is implicitly started when the SQL statement which can be contained within a transaction is executed on this connection. The transaction must be eventually commited by the explicit call to Commit or rolled back by the explicit call to Rollback .

Data sources are not required to support both commit modes, and the exact implementation of modes supported by each particular data source is platform-dependent.

Parameters:
nMode - the commit mode

Commit

virtual void Commit() = 0;

Commits all transactions on this connection.

The behavior is platform-dependent.

Rollback

virtual void Rollback() = 0;

Rollbacks all transactions on this connection.

The behavior is platform-dependent.

CreateStatement

virtual XSqlStatement CreateStatement() = 0;

Creates a new statement.

Returns:
the newly created statement

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.