Adempiere 3.5.2a

org.compiere.db
Interface AdempiereDatabase

All Known Implementing Classes:
DB_Oracle, DB_PostgreSQL

public interface AdempiereDatabase

Interface for Adempiere Databases

Version:
$Id: AdempiereDatabase.java,v 1.5 2006/09/22 23:35:19 jjanke Exp $
Author:
Jorg Janke

Field Summary
static int CMD_CREATE_DATABASE
          Create Database/Schema Commands
static int CMD_CREATE_USER
          Create User commands
static int CMD_DROP_DATABASE
          Drop Database/Schema Commands
static String DEFAULT_CONN_TEST_SQL
          Default sql use to test whether a connection is still valid
 
Method Summary
 void close()
          Close
 String convertStatement(String oraStatement)
          Convert an individual Oracle Style statements to target database statement syntax
 String getAlternativeSQL(int reExNo, String msg, String sql)
          Check and generate an alternative SQL
 Connection getCachedConnection(CConnection connection, boolean autoCommit, int transactionIsolation)
          Get Cached Connection on Server
 String getCatalog()
          Get JDBC Catalog
 String[] getCommands(int cmdType)
          Get SQL Commands.
 String getConnectionURL(CConnection connection)
          Get Database Connection String
 String getConnectionURL(String dbHost, int dbPort, String dbName, String userName)
          Get Connection URL
 String getConnectionURL(String connectionURL, String userName)
          Get Database Connection String
 String getConstraintType(Connection conn, String tableName, String IXName)
          Get constraint type associated with the index
 Convert getConvert()
           
 DataSource getDataSource(CConnection connection)
          Create DataSource
 String getDescription()
          Get Database Description
 Driver getDriver()
          Get and register Database Driver
 Connection getDriverConnection(CConnection connection)
          Get Connection from Driver
 Connection getDriverConnection(String dbUrl, String dbUid, String dbPwd)
          Get Driver Connection
 String getName()
          Get Database Name
 String getSchema()
          Get JDBC Schema
 int getStandardPort()
          Get Standard JDBC Port
 String getStatus()
          Get Status
 String getSystemDatabase(String databaseName)
          Get Name of System Database
 String getSystemUser()
          Get Name of System User
 boolean isSupported(String sql)
          Check if DBMS support the sql statement
 boolean supportsBLOB()
          Supports BLOB
 String TO_CHAR(String columnName, int displayType, String AD_Language)
          Create SQL for formatted Date, Number
 String TO_DATE(Timestamp time, boolean dayOnly)
          Create SQL TO Date String from Timestamp
 String TO_NUMBER(BigDecimal number, int displayType)
          Return number as string for INSERT statements with correct precision
 String toString()
          String Representation
 

Field Detail

CMD_CREATE_USER

static final int CMD_CREATE_USER
Create User commands

See Also:
Constant Field Values

CMD_CREATE_DATABASE

static final int CMD_CREATE_DATABASE
Create Database/Schema Commands

See Also:
Constant Field Values

CMD_DROP_DATABASE

static final int CMD_DROP_DATABASE
Drop Database/Schema Commands

See Also:
Constant Field Values

DEFAULT_CONN_TEST_SQL

static final String DEFAULT_CONN_TEST_SQL
Default sql use to test whether a connection is still valid

See Also:
Constant Field Values
Method Detail

getName

String getName()
Get Database Name

Returns:
database short name

getDescription

String getDescription()
Get Database Description

Returns:
database long name and version

getDriver

Driver getDriver()
                 throws SQLException
Get and register Database Driver

Returns:
Driver
Throws:
SQLException

getStandardPort

int getStandardPort()
Get Standard JDBC Port

Returns:
standard port

getConnectionURL

String getConnectionURL(CConnection connection)
Get Database Connection String

Parameters:
connection - Connection Descriptor
Returns:
connection String

getConnectionURL

String getConnectionURL(String dbHost,
                        int dbPort,
                        String dbName,
                        String userName)
Get Connection URL

Parameters:
dbHost - db Host
dbPort - db Port
dbName - db Name
userName - user name
Returns:
url

getConnectionURL

String getConnectionURL(String connectionURL,
                        String userName)
Get Database Connection String

Parameters:
connectionURL - Connection URL
userName - user name
Returns:
connection String

getCatalog

String getCatalog()
Get JDBC Catalog

Returns:
catalog

getSchema

String getSchema()
Get JDBC Schema

Returns:
schema

supportsBLOB

boolean supportsBLOB()
Supports BLOB

Returns:
true if BLOB is supported

toString

String toString()
String Representation

Overrides:
toString in class Object
Returns:
info

convertStatement

String convertStatement(String oraStatement)
Convert an individual Oracle Style statements to target database statement syntax

Parameters:
oraStatement - oracle statement
Returns:
converted Statement

isSupported

boolean isSupported(String sql)
Check if DBMS support the sql statement

Returns:
true: yes

getConstraintType

String getConstraintType(Connection conn,
                         String tableName,
                         String IXName)
Get constraint type associated with the index

Returns:
String[0] = 0: do not know, 1: Primary Key 2: Foreign Key String[1] - String[n] = Constraint Name

getAlternativeSQL

String getAlternativeSQL(int reExNo,
                         String msg,
                         String sql)
Check and generate an alternative SQL

Returns:
String, the alternative SQL, null if no alternative

getSystemUser

String getSystemUser()
Get Name of System User

Returns:
e.g. sa, system

getSystemDatabase

String getSystemDatabase(String databaseName)
Get Name of System Database

Parameters:
databaseName - database Name
Returns:
e.g. master or database Name

TO_DATE

String TO_DATE(Timestamp time,
               boolean dayOnly)
Create SQL TO Date String from Timestamp

Parameters:
time - Date to be converted
dayOnly - true if time set to 00:00:00
Returns:
date function

TO_CHAR

String TO_CHAR(String columnName,
               int displayType,
               String AD_Language)
Create SQL for formatted Date, Number

Parameters:
columnName - the column name in the SQL
displayType - Display Type
AD_Language - 6 character language setting (from Env.LANG_*)
Returns:
TRIM(TO_CHAR(columnName,'999G999G999G990D00','NLS_NUMERIC_CHARACTERS='',.''')) or TRIM(TO_CHAR(columnName,'TM9')) depending on DisplayType and Language
See Also:
DisplayType, Env

TO_NUMBER

String TO_NUMBER(BigDecimal number,
                 int displayType)
Return number as string for INSERT statements with correct precision

Parameters:
number - number
displayType - display Type
Returns:
number as string

getCommands

String[] getCommands(int cmdType)
Get SQL Commands. The following variables are resolved:

Parameters:
cmdType - CMD_*
Returns:
array of commands to be executed

getCachedConnection

Connection getCachedConnection(CConnection connection,
                               boolean autoCommit,
                               int transactionIsolation)
                               throws Exception
Get Cached Connection on Server

Parameters:
connection - info
autoCommit - true if autocommit connection
transactionIsolation - Connection transaction level
Returns:
connection or null
Throws:
Exception

getDriverConnection

Connection getDriverConnection(CConnection connection)
                               throws SQLException
Get Connection from Driver

Parameters:
connection - info
Returns:
connection or null
Throws:
SQLException

getDriverConnection

Connection getDriverConnection(String dbUrl,
                               String dbUid,
                               String dbPwd)
                               throws SQLException
Get Driver Connection

Parameters:
dbUrl - URL
dbUid - user
dbPwd - password
Returns:
connection
Throws:
SQLException

getDataSource

DataSource getDataSource(CConnection connection)
Create DataSource

Parameters:
connection - connection
Returns:
data dource

getStatus

String getStatus()
Get Status

Returns:
status info or null if no local datasource available

close

void close()
Close


getConvert

Convert getConvert()

Adempiere 3.5.2a

Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.