com.sage.accpac.sm
Interface DBLink

All Superinterfaces:
HasCurrency, HasDispose

@ThreadSafe
public interface DBLink
extends HasCurrency, HasDispose

A DBLink represents a database link or connection to a Sage Accpac ERP company or system database.
An object of this class cannot be created directly by applications. Instead, it should be obtained from the Program object's openDBLink method.
The caller must call the dispose method when finished with the object so that all its resources can be released. The caller must not call any other method on the object after calling dispose.


Nested Class Summary
static class DBLink.DatabaseType
          This class defines all the database types used by Accpac
static class DBLink.LinkFlags
          The DBLink.LinkFlags enumeration lists the different ways a link can be opened
static class DBLink.LinkType
          The DBLink.LinkType describes the different types of links available
 
Method Summary
 DBLink.DatabaseType getDatabaseType()
          Return the database type
 java.sql.ResultSet getDirectQuery(java.lang.String query)
          gets a new ResultSet containing the result of running the query directly against the database.
 DBLink.LinkFlags getFlags()
          gets the database flags used to open the link.
 Program getParent()
          Deprecated. use getProgram()
 IProgram getProgram()
          gets the Program object that is the parent of this object
 DBTableMetaData getTableMetaData(java.lang.String tableName)
          Get table meta data by calling native A4WAPIs
 int getTransactionLevel()
          Gets the current transaction level on the current database connection
 DBLink.LinkType getType()
          gets the type of database that the link connects to
 boolean isPermitted(java.lang.String resource)
          returns whether or not the user is permitted to access the given security resource.
 IView openIView(java.lang.String viewid)
          open an Accpac view
 IView openIView(java.lang.String viewid, int modes, int prefetch, int directives)
          open an Accpac view.
 int transactionBegin()
          Begins a transaction on the current database connection
 int transactionCommit()
          Commits the most recent transaction on the current database connection
 int transactionRollback()
          Rolls back the most recent transaction on the current database connection
 
Methods inherited from interface com.sage.accpac.sm.currency.HasCurrency
getCurrency, getCurrencyRate, getCurrencyRateComposite, getCurrencyRateFloating, getCurrencyTable
 
Methods inherited from interface com.sage.accpac.sm.HasDispose
dispose
 

Method Detail

getDatabaseType

DBLink.DatabaseType getDatabaseType()
Return the database type

Returns:
one of the database types defined in the DatabaseType class

getDirectQuery

java.sql.ResultSet getDirectQuery(java.lang.String query)
gets a new ResultSet containing the result of running the query directly against the database.

Parameters:
query - the query to run
Returns:
a ResultSet containing the results

getParent

@Deprecated
Program getParent()
Deprecated. use getProgram()

Use getProgram()

Returns:
the Program

getProgram

IProgram getProgram()
gets the Program object that is the parent of this object

Returns:
the IProgram to which this link belongs

getTransactionLevel

int getTransactionLevel()
Gets the current transaction level on the current database connection

Returns:
The current transaction level
Throws:
DBLinkException - If a database error occurs.

getFlags

DBLink.LinkFlags getFlags()
gets the database flags used to open the link. The flags control the access mode of the database connection.

Returns:
the DBLink.LinkFlags used to open the link

getType

DBLink.LinkType getType()
gets the type of database that the link connects to

Returns:
the DBLink.LinkType of the link

isPermitted

boolean isPermitted(java.lang.String resource)
returns whether or not the user is permitted to access the given security resource.

Parameters:
resource - the name of the resource to be checked. This must consist of only ASCII printable characters at may be at most 10 characters long.
Returns:
true if and only if the user is permitted to access the given resource.

openIView

IView openIView(java.lang.String viewid,
                int modes,
                int prefetch,
                int directives)
open an Accpac view.

Parameters:
viewid - the rotoid (e.g. BK0001) of the view. This must be six characters long once trimmed.
modes - an integer value containing a set of flags that control behavior. See View.OpenModes.
prefetch - the number of records to pre-fetch when the view is opened (0 to 63)
directives - specifies how the view should be used. See View.OpenDirectives.
If the view does not identify itself as a 4.2A or later template (either it identifies itself as earlier or it does not support the xxxVersionTemplate entry) then the InstanceOpen directive will be assumed.
Returns:
a new view

openIView

IView openIView(java.lang.String viewid)
open an Accpac view

Parameters:
viewid - the rotoid of the view to open
Returns:
a new view

transactionBegin

int transactionBegin()
Begins a transaction on the current database connection

Returns:
The transaction level after the transaction has begun
Throws:
DBLinkException - If a database error occurs.

transactionCommit

int transactionCommit()
Commits the most recent transaction on the current database connection

Returns:
The transaction level after the transaction was committed
Throws:
java.lang.IllegalStateException - If the connection is not currently in a transaction
DBLinkException - If a database error occurs

transactionRollback

int transactionRollback()
Rolls back the most recent transaction on the current database connection

Returns:
The transaction level after the transaction was rolled back
Throws:
DBLinkException - If a database error occurs.

getTableMetaData

DBTableMetaData getTableMetaData(java.lang.String tableName)
Get table meta data by calling native A4WAPIs

Parameters:
tableName - - the name of an ACCPAC database table
Returns:
ResultSetMetaData
Throws:
DBLinkException - If a database error occurs


Copyright © 2011 Sage Software, Inc. All rights reserved.