DbiBeginTran

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiBeginTran

Return to chapter overview

C syntax

DBIResult DBIFN DbiBeginTran (hDb, eXIL, phXact);

Delphi syntax

function DbiBeginTran (hDb: hDBIDb; eXIL: eXILType; var hXact: hDBIXact): DBIResult stdcall;

Description

DbiBeginTran begins a transaction on SQL server tables or local (Paradox, dBASE, FoxPro, Access) tables.

Parameters

hDb

Type: hDBIDb

(Input)

Specifies the database handle.

eXIL

Type: eXILType

(Input)

Specifies the transaction isolation level.

phXact

Type: phDBIXact

(Output)

Pointer to the transaction handle.

Usage

This function begins a transaction on the given database. Within a transaction, operations are not committed automatically, giving the client control over transaction behavior. The transaction remains active until a call to DbiEndTran is made to end the transaction.

Some servers do not allow Data Definition Language (DDL) statements within a transaction, or implicitly commit the transaction when a DDL statement is issued. For such servers, DDL operations are not allowed within a transaction. If table lock release requests cause implicit commits, a request for a table lock release is held until the transaction is ended.

Servers vary in the availability and behavior of isolation and read repeatability capabilities. Some SQL drivers support only the server default isolation level. To check the isolation level actually used, call DbiGetTranInfo after a successful call to DbiBeginTran.

Nested transactions are not supported. If a previously requested transaction is still active, this function returns an error.

For local transactions, only xlDIRTYREAD is supported.

Prerequisites

A valid database handle must be obtained from a server.

DbiResult

Meaning

DBIERR_NONE

The transaction has begun successfully.

DBIERR_ACTIVETRAN

There is already an active transaction.