Fyracle dump and bug fixes
This commit is contained in:
parent
cca70607ff
commit
a309e926b8
|
@ -564,26 +564,42 @@ public final class Find extends CDialog
|
||||||
m_query = new MQuery(m_tableName);
|
m_query = new MQuery(m_tableName);
|
||||||
if (hasValue && !valueField.getText().equals("%") && valueField.getText().length() != 0)
|
if (hasValue && !valueField.getText().equals("%") && valueField.getText().length() != 0)
|
||||||
{
|
{
|
||||||
String value = valueField.getText().toUpperCase();
|
//@TODO Fyracle bug with upper
|
||||||
|
String value;
|
||||||
|
if(DB.isFyracle()){
|
||||||
|
value = valueField.getText();
|
||||||
|
}else{
|
||||||
|
value = valueField.getText().toUpperCase();
|
||||||
|
}
|
||||||
if (!value.endsWith("%"))
|
if (!value.endsWith("%"))
|
||||||
value += "%";
|
value += "%";
|
||||||
m_query.addRestriction("UPPER(Value)", MQuery.LIKE, value, valueLabel.getText(), value);
|
m_query.addRestriction((DB.isFyracle()?"Value":"UPPER(Value)"), MQuery.LIKE, value, valueLabel.getText(), value);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (hasDocNo && !docNoField.getText().equals("%") && docNoField.getText().length() != 0)
|
if (hasDocNo && !docNoField.getText().equals("%") && docNoField.getText().length() != 0)
|
||||||
{
|
{
|
||||||
String value = docNoField.getText().toUpperCase();
|
String value;
|
||||||
|
if(DB.isFyracle()){
|
||||||
|
value = docNoField.getText();
|
||||||
|
}else{
|
||||||
|
value = docNoField.getText().toUpperCase();
|
||||||
|
}
|
||||||
if (!value.endsWith("%"))
|
if (!value.endsWith("%"))
|
||||||
value += "%";
|
value += "%";
|
||||||
m_query.addRestriction("UPPER(DocumentNo)", MQuery.LIKE, value, docNoLabel.getText(), value);
|
m_query.addRestriction((DB.isFyracle()?"DocumentNo":"UPPER(DocumentNo)"), MQuery.LIKE, value, docNoLabel.getText(), value);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if ((hasName) && !nameField.getText().equals("%") && nameField.getText().length() != 0)
|
if ((hasName) && !nameField.getText().equals("%") && nameField.getText().length() != 0)
|
||||||
{
|
{
|
||||||
String value = nameField.getText().toUpperCase();
|
String value;
|
||||||
|
if(DB.isFyracle()){
|
||||||
|
value = nameField.getText();
|
||||||
|
}else{
|
||||||
|
value = nameField.getText().toUpperCase();
|
||||||
|
}
|
||||||
if (!value.endsWith("%"))
|
if (!value.endsWith("%"))
|
||||||
value += "%";
|
value += "%";
|
||||||
m_query.addRestriction("UPPER(Name)", MQuery.LIKE, value, nameLabel.getText(), value);
|
m_query.addRestriction((DB.isFyracle()?"Name":"UPPER(Name)"), MQuery.LIKE, value, nameLabel.getText(), value);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (hasDescription && !descriptionField.getText().equals("%") && descriptionField.getText().length() != 0)
|
if (hasDescription && !descriptionField.getText().equals("%") && descriptionField.getText().length() != 0)
|
||||||
|
|
|
@ -13,12 +13,16 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.db;
|
package org.compiere.db;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
@ -28,6 +32,8 @@ import org.compiere.dbPort.Convert_Oracle;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
|
import org.firebirdsql.jdbc.FBConnection;
|
||||||
|
import org.firebirdsql.pool.DriverConnectionPoolDataSource;
|
||||||
import org.firebirdsql.pool.FBWrappingDataSource;
|
import org.firebirdsql.pool.FBWrappingDataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,20 +59,19 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
/** Default Port */
|
/** Default Port */
|
||||||
public static final int DEFAULT_PORT = 3050;
|
public static final int DEFAULT_PORT = 3050;
|
||||||
|
|
||||||
|
|
||||||
/** Connection String */
|
/** Connection String */
|
||||||
private String m_connection;
|
private String m_connection;
|
||||||
|
|
||||||
private FBWrappingDataSource m_ds;
|
private FBWrappingDataSource m_ds;
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger (DB_Fyracle.class);
|
private static CLogger log = CLogger.getCLogger(DB_Fyracle.class);
|
||||||
|
|
||||||
private Convert m_convert = new Convert_Oracle();
|
private Convert m_convert = new Convert_Oracle();
|
||||||
|
|
||||||
private String m_userName;
|
private String m_userName;
|
||||||
|
|
||||||
private String m_connectionURL;
|
private String m_connectionURL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Database Name
|
* Get Database Name
|
||||||
*
|
*
|
||||||
|
@ -122,22 +127,25 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
m_userName = connection.getDbUid();
|
m_userName = connection.getDbUid();
|
||||||
return m_connection;
|
return m_connection;
|
||||||
} // getConnectionString
|
} // getConnectionString
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Connection URL.
|
* Get Connection URL.
|
||||||
* http://download-east.oracle.com/docs/cd/B14117_01/java.101/b10979/urls.htm#BEIDBFDF
|
* http://download-east.oracle.com/docs/cd/B14117_01/java.101/b10979/urls.htm#BEIDBFDF
|
||||||
* @param dbHost db Host
|
*
|
||||||
* @param dbPort db Port
|
* @param dbHost
|
||||||
* @param dbName db Name
|
* db Host
|
||||||
* @param userName user name
|
* @param dbPort
|
||||||
|
* db Port
|
||||||
|
* @param dbName
|
||||||
|
* db Name
|
||||||
|
* @param userName
|
||||||
|
* user name
|
||||||
* @return connection
|
* @return connection
|
||||||
*/
|
*/
|
||||||
public String getConnectionURL (String dbHost, int dbPort, String dbName,
|
public String getConnectionURL(String dbHost, int dbPort, String dbName,
|
||||||
String userName)
|
String userName) {
|
||||||
{
|
|
||||||
StringBuffer sb = new StringBuffer("jdbc:firebirdsql:oracle:");
|
StringBuffer sb = new StringBuffer("jdbc:firebirdsql:oracle:");
|
||||||
sb.append(dbHost).append("/").append(
|
sb.append(dbHost).append("/").append(dbPort).append(":").append(dbName);
|
||||||
dbPort).append(":").append(
|
|
||||||
dbName);
|
|
||||||
m_connection = sb.toString();
|
m_connection = sb.toString();
|
||||||
m_userName = userName;
|
m_userName = userName;
|
||||||
return m_connection;
|
return m_connection;
|
||||||
|
@ -204,7 +212,6 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
return rs.getString(pos);
|
return rs.getString(pos);
|
||||||
} // getRowID
|
} // getRowID
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -216,7 +223,9 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
if (m_ds == null)
|
if (m_ds == null)
|
||||||
getDataSource(connection);
|
getDataSource(connection);
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
conn = m_ds.getConnection();
|
// @TODO FYRACLE PooledConnection ignore setAutoCommit
|
||||||
|
// conn = m_ds.getConnection();
|
||||||
|
conn = getDriverConnection(connection);
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
if (conn.getTransactionIsolation() != transactionIsolation)
|
if (conn.getTransactionIsolation() != transactionIsolation)
|
||||||
conn.setTransactionIsolation(transactionIsolation);
|
conn.setTransactionIsolation(transactionIsolation);
|
||||||
|
@ -227,40 +236,48 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
}
|
}
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get JDBC Schema
|
* Get JDBC Schema
|
||||||
|
*
|
||||||
* @return user name
|
* @return user name
|
||||||
*/
|
*/
|
||||||
public String getSchema()
|
public String getSchema() {
|
||||||
{
|
|
||||||
if (m_userName != null)
|
if (m_userName != null)
|
||||||
return m_userName.toUpperCase();
|
return m_userName.toUpperCase();
|
||||||
log.severe("User Name not set (yet) - call getConnectionURL first");
|
log.severe("User Name not set (yet) - call getConnectionURL first");
|
||||||
return null;
|
return null;
|
||||||
} // getSchema
|
} // getSchema
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Driver Connection
|
* Get Driver Connection
|
||||||
* @param dbUrl URL
|
*
|
||||||
* @param dbUid user
|
* @param dbUrl
|
||||||
* @param dbPwd password
|
* URL
|
||||||
|
* @param dbUid
|
||||||
|
* user
|
||||||
|
* @param dbPwd
|
||||||
|
* password
|
||||||
* @return connection
|
* @return connection
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public Connection getDriverConnection (String dbUrl, String dbUid, String dbPwd)
|
public Connection getDriverConnection(String dbUrl, String dbUid,
|
||||||
throws SQLException
|
String dbPwd) throws SQLException {
|
||||||
{
|
|
||||||
getDriver();
|
getDriver();
|
||||||
return DriverManager.getConnection (dbUrl, dbUid, dbPwd);
|
return DriverManager.getConnection(dbUrl, dbUid, dbPwd);
|
||||||
} // getDriverConnection
|
} // getDriverConnection
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Connection from Driver
|
* Get Connection from Driver
|
||||||
* @param connection info
|
*
|
||||||
|
* @param connection
|
||||||
|
* info
|
||||||
* @return connection or null
|
* @return connection or null
|
||||||
*/
|
*/
|
||||||
public Connection getDriverConnection (CConnection connection) throws SQLException
|
public Connection getDriverConnection(CConnection connection)
|
||||||
{
|
throws SQLException {
|
||||||
getDriver();
|
getDriver();
|
||||||
return DriverManager.getConnection (getConnectionURL (connection),
|
return DriverManager.getConnection(getConnectionURL(connection),
|
||||||
connection.getDbUid(), connection.getDbPwd());
|
connection.getDbUid(), connection.getDbPwd());
|
||||||
} // getDriverConnection
|
} // getDriverConnection
|
||||||
|
|
||||||
|
@ -274,9 +291,9 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
return m_ds;
|
return m_ds;
|
||||||
try {
|
try {
|
||||||
m_ds = new FBWrappingDataSource();
|
m_ds = new FBWrappingDataSource();
|
||||||
StringBuffer db = new StringBuffer().append(connection.getDbHost()).append("/").append(
|
StringBuffer db = new StringBuffer().append(connection.getDbHost())
|
||||||
connection.getDbPort()).append(":").append(
|
.append("/").append(connection.getDbPort()).append(":")
|
||||||
connection.getDbName());
|
.append(connection.getDbName());
|
||||||
|
|
||||||
m_ds.setDatabase(db.toString());
|
m_ds.setDatabase(db.toString());
|
||||||
m_ds.setUserName(connection.getDbUid());
|
m_ds.setUserName(connection.getDbUid());
|
||||||
|
@ -287,13 +304,14 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
|
|
||||||
m_ds.setLoginTimeout(10);
|
m_ds.setLoginTimeout(10);
|
||||||
m_ds.setMaxStatements(MAX_STATEMENTS);
|
m_ds.setMaxStatements(MAX_STATEMENTS);
|
||||||
|
m_ds.setLoginTimeout(10);
|
||||||
|
m_ds.setMaxStatements(MAX_STATEMENTS);
|
||||||
|
|
||||||
return m_ds;
|
return m_ds;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.SEVERE, toString(), e);
|
log.log(Level.SEVERE, toString(), e);
|
||||||
//throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -315,7 +333,7 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
* @see org.compiere.db.CompiereDatabase#close()
|
* @see org.compiere.db.CompiereDatabase#close()
|
||||||
*/
|
*/
|
||||||
public void close() {
|
public void close() {
|
||||||
m_ds=null;
|
m_ds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] a) {
|
public static void main(String[] a) {
|
||||||
|
@ -335,69 +353,81 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
m_ds.setType("ORACLE_MODE");
|
m_ds.setType("ORACLE_MODE");
|
||||||
Connection c = null;
|
Connection c = null;
|
||||||
c = m_ds.getConnection();
|
c = m_ds.getConnection();
|
||||||
c.createStatement().executeQuery("SELECT * FROM ad_CLIENT WHERE created>TO_DATE('2001-01-01')");
|
c
|
||||||
|
.createStatement()
|
||||||
|
.executeQuery(
|
||||||
|
"SELECT * FROM ad_CLIENT WHERE created>TO_DATE('2001-01-01')");
|
||||||
|
|
||||||
new DB_Fyracle().getDriver();
|
new DB_Fyracle().getDriver();
|
||||||
c = DriverManager.getConnection ("jdbc:firebirdsql:oracle:localhost/3050:c:/devspace/apps/fyracle/data/compiere.fdb", "SYSDBA", "masterkey");
|
c = DriverManager
|
||||||
|
.getConnection(
|
||||||
|
"jdbc:firebirdsql:oracle:localhost/3050:c:/devspace/apps/fyracle/data/compiere.fdb",
|
||||||
|
"SYSDBA", "masterkey");
|
||||||
|
|
||||||
|
c
|
||||||
c.createStatement().executeQuery("SELECT * FROM ad_CLIENT WHERE created>TO_DATE('2001-01-01')");
|
.createStatement()
|
||||||
|
.executeQuery(
|
||||||
|
"SELECT * FROM ad_CLIENT WHERE created>TO_DATE('2001-01-01')");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get JDBC Catalog
|
* Get JDBC Catalog
|
||||||
|
*
|
||||||
* @return null - not used
|
* @return null - not used
|
||||||
*/
|
*/
|
||||||
public String getCatalog()
|
public String getCatalog() {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
} // getCatalog
|
} // getCatalog
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get SQL Commands.
|
* Get SQL Commands. The following variables are resolved:
|
||||||
* The following variables are resolved:
|
*
|
||||||
* @SystemPassword@, @CompiereUser@, @CompierePassword@
|
* @SystemPassword@,
|
||||||
* @SystemPassword@, @DatabaseName@, @DatabaseDevice@
|
* @CompiereUser@,
|
||||||
* @param cmdType CMD_*
|
* @CompierePassword@
|
||||||
|
* @SystemPassword@,
|
||||||
|
* @DatabaseName@,
|
||||||
|
* @DatabaseDevice@
|
||||||
|
* @param cmdType
|
||||||
|
* CMD_*
|
||||||
* @return array of commands to be executed
|
* @return array of commands to be executed
|
||||||
*/
|
*/
|
||||||
public String[] getCommands (int cmdType)
|
public String[] getCommands(int cmdType) {
|
||||||
{
|
|
||||||
if (CMD_CREATE_USER == cmdType)
|
if (CMD_CREATE_USER == cmdType)
|
||||||
return new String[]
|
return new String[] {
|
||||||
{
|
|
||||||
|
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
if (CMD_CREATE_DATABASE == cmdType)
|
if (CMD_CREATE_DATABASE == cmdType)
|
||||||
return new String[]
|
return new String[] {
|
||||||
{
|
|
||||||
|
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
if (CMD_DROP_DATABASE == cmdType)
|
if (CMD_DROP_DATABASE == cmdType)
|
||||||
return new String[]
|
return new String[] {
|
||||||
{
|
|
||||||
|
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
return null;
|
return null;
|
||||||
} // getCommands
|
} // getCommands
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create SQL TO Date String from Timestamp
|
* Create SQL TO Date String from Timestamp
|
||||||
*
|
*
|
||||||
* @param time Date to be converted
|
* @param time
|
||||||
* @param dayOnly true if time set to 00:00:00
|
* Date to be converted
|
||||||
|
* @param dayOnly
|
||||||
|
* true if time set to 00:00:00
|
||||||
*
|
*
|
||||||
* @return TO_DATE('2001-01-30 18:10:20',''YYYY-MM-DD HH24:MI:SS')
|
* @return TO_DATE('2001-01-30 18:10:20',''YYYY-MM-DD HH24:MI:SS') or
|
||||||
* or TO_DATE('2001-01-30',''YYYY-MM-DD')
|
* TO_DATE('2001-01-30',''YYYY-MM-DD')
|
||||||
*/
|
*/
|
||||||
public String TO_DATE (Timestamp time, boolean dayOnly)
|
public String TO_DATE(Timestamp time, boolean dayOnly) {
|
||||||
{
|
if (time == null) {
|
||||||
if (time == null)
|
|
||||||
{
|
|
||||||
if (dayOnly)
|
if (dayOnly)
|
||||||
return "TRUNC(SysDate)";
|
return "TRUNC(SysDate)";
|
||||||
return "SysDate";
|
return "SysDate";
|
||||||
|
@ -406,14 +436,13 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
StringBuffer dateString = new StringBuffer("TO_DATE('");
|
StringBuffer dateString = new StringBuffer("TO_DATE('");
|
||||||
// YYYY-MM-DD HH24:MI:SS.mmmm JDBC Timestamp format
|
// YYYY-MM-DD HH24:MI:SS.mmmm JDBC Timestamp format
|
||||||
String myDate = time.toString();
|
String myDate = time.toString();
|
||||||
if (dayOnly)
|
if (dayOnly) {
|
||||||
{
|
dateString.append(myDate.substring(0, 10));
|
||||||
dateString.append(myDate.substring(0,10));
|
|
||||||
dateString.append("','YYYY-MM-DD')");
|
dateString.append("','YYYY-MM-DD')");
|
||||||
}
|
} else {
|
||||||
else
|
dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut
|
||||||
{
|
// off
|
||||||
dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut off miliseconds
|
// miliseconds
|
||||||
dateString.append("','YYYY-MM-DD HH24:MI:SS')");
|
dateString.append("','YYYY-MM-DD HH24:MI:SS')");
|
||||||
}
|
}
|
||||||
return dateString.toString();
|
return dateString.toString();
|
||||||
|
@ -422,24 +451,26 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
/**
|
/**
|
||||||
* Create SQL for formatted Date, Number
|
* Create SQL for formatted Date, Number
|
||||||
*
|
*
|
||||||
* @param columnName the column name in the SQL
|
* @param columnName
|
||||||
* @param displayType Display Type
|
* the column name in the SQL
|
||||||
* @param AD_Language 6 character language setting (from Env.LANG_*)
|
* @param displayType
|
||||||
|
* Display Type
|
||||||
|
* @param AD_Language
|
||||||
|
* 6 character language setting (from Env.LANG_*)
|
||||||
*
|
*
|
||||||
* @return TRIM(TO_CHAR(columnName,'9G999G990D00','NLS_NUMERIC_CHARACTERS='',.'''))
|
* @return TRIM(TO_CHAR(columnName,'9G999G990D00','NLS_NUMERIC_CHARACTERS='',.'''))
|
||||||
* or TRIM(TO_CHAR(columnName,'TM9')) depending on DisplayType and Language
|
* or TRIM(TO_CHAR(columnName,'TM9')) depending on DisplayType and
|
||||||
|
* Language
|
||||||
* @see org.compiere.util.DisplayType
|
* @see org.compiere.util.DisplayType
|
||||||
* @see org.compiere.util.Env
|
* @see org.compiere.util.Env
|
||||||
*
|
*
|
||||||
* */
|
*/
|
||||||
public String TO_CHAR (String columnName, int displayType, String AD_Language)
|
public String TO_CHAR(String columnName, int displayType, String AD_Language) {
|
||||||
{
|
|
||||||
StringBuffer retValue = new StringBuffer("TRIM(TO_CHAR(");
|
StringBuffer retValue = new StringBuffer("TRIM(TO_CHAR(");
|
||||||
retValue.append(columnName);
|
retValue.append(columnName);
|
||||||
|
|
||||||
// Numbers
|
// Numbers
|
||||||
if (DisplayType.isNumeric(displayType))
|
if (DisplayType.isNumeric(displayType)) {
|
||||||
{
|
|
||||||
if (displayType == DisplayType.Amount)
|
if (displayType == DisplayType.Amount)
|
||||||
retValue.append(",'9G999G990D00'");
|
retValue.append(",'9G999G990D00'");
|
||||||
else
|
else
|
||||||
|
@ -447,11 +478,9 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
// TO_CHAR(GrandTotal,'9G999G990D00','NLS_NUMERIC_CHARACTERS='',.''')
|
// TO_CHAR(GrandTotal,'9G999G990D00','NLS_NUMERIC_CHARACTERS='',.''')
|
||||||
if (!Language.isDecimalPoint(AD_Language)) // reversed
|
if (!Language.isDecimalPoint(AD_Language)) // reversed
|
||||||
retValue.append(",'NLS_NUMERIC_CHARACTERS='',.'''");
|
retValue.append(",'NLS_NUMERIC_CHARACTERS='',.'''");
|
||||||
}
|
} else if (DisplayType.isDate(displayType)) {
|
||||||
else if (DisplayType.isDate(displayType))
|
retValue.append(",'").append(
|
||||||
{
|
Language.getLanguage(AD_Language).getDBdatePattern())
|
||||||
retValue.append(",'")
|
|
||||||
.append(Language.getLanguage(AD_Language).getDBdatePattern())
|
|
||||||
.append("'");
|
.append("'");
|
||||||
}
|
}
|
||||||
retValue.append("))");
|
retValue.append("))");
|
||||||
|
@ -461,12 +490,14 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return number as string for INSERT statements with correct precision
|
* Return number as string for INSERT statements with correct precision
|
||||||
* @param number number
|
*
|
||||||
* @param displayType display Type
|
* @param number
|
||||||
|
* number
|
||||||
|
* @param displayType
|
||||||
|
* display Type
|
||||||
* @return number as string
|
* @return number as string
|
||||||
*/
|
*/
|
||||||
public String TO_NUMBER (BigDecimal number, int displayType)
|
public String TO_NUMBER(BigDecimal number, int displayType) {
|
||||||
{
|
|
||||||
if (number == null)
|
if (number == null)
|
||||||
return "NULL";
|
return "NULL";
|
||||||
return number.toString();
|
return number.toString();
|
||||||
|
@ -474,20 +505,21 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Name of System User
|
* Get Name of System User
|
||||||
|
*
|
||||||
* @return system
|
* @return system
|
||||||
*/
|
*/
|
||||||
public String getSystemUser()
|
public String getSystemUser() {
|
||||||
{
|
|
||||||
return "sysdba";
|
return "sysdba";
|
||||||
} // getSystemUser
|
} // getSystemUser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Name of System Database
|
* Get Name of System Database
|
||||||
* @param databaseName database Name
|
*
|
||||||
|
* @param databaseName
|
||||||
|
* database Name
|
||||||
* @return e.g. master or database Name
|
* @return e.g. master or database Name
|
||||||
*/
|
*/
|
||||||
public String getSystemDatabase(String databaseName)
|
public String getSystemDatabase(String databaseName) {
|
||||||
{
|
|
||||||
return databaseName;
|
return databaseName;
|
||||||
} // getSystemDatabase
|
} // getSystemDatabase
|
||||||
|
|
||||||
|
@ -501,11 +533,12 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
return m_connectionURL;
|
return m_connectionURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConstraintType(Connection conn, String tableName, String IXName) {
|
public String getConstraintType(Connection conn, String tableName,
|
||||||
if (IXName == null || IXName.length()==0)
|
String IXName) {
|
||||||
|
if (IXName == null || IXName.length() == 0)
|
||||||
return "0";
|
return "0";
|
||||||
if (IXName.endsWith("_KEY"))
|
if (IXName.endsWith("_KEY"))
|
||||||
return "1"+IXName;
|
return "1" + IXName;
|
||||||
else
|
else
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
|
@ -518,5 +551,77 @@ public class DB_Fyracle implements AdempiereDatabase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // DB_Firebird
|
} // DB_Firebird
|
||||||
|
|
||||||
|
class DataSourceImpl implements DataSource {
|
||||||
|
DriverConnectionPoolDataSource impl;
|
||||||
|
|
||||||
|
public DataSourceImpl() {
|
||||||
|
impl = new DriverConnectionPoolDataSource();
|
||||||
|
impl.setPooling(true);
|
||||||
|
impl.setStatementPooling(true);
|
||||||
|
impl.setDriverClassName("org.firebirdsql.jdbc.FBDriver");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Connection getConnection() throws SQLException {
|
||||||
|
return impl.getPooledConnection("SYSDBA", "masterkey").getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJdbcUrl(String url) throws SQLException {
|
||||||
|
impl.setJdbcUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Connection getConnection(String username, String password)
|
||||||
|
throws SQLException {
|
||||||
|
return impl.getPooledConnection(username, password).getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrintWriter getLogWriter() throws SQLException {
|
||||||
|
return impl.getLogWriter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLoginTimeout() throws SQLException {
|
||||||
|
return impl.getLoginTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogWriter(PrintWriter out) throws SQLException {
|
||||||
|
impl.setLogWriter(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoginTimeout(int seconds) throws SQLException {
|
||||||
|
impl.setLoginTimeout(seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
return impl.equals(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxConnections(int arg0) {
|
||||||
|
impl.setMaxConnections(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxIdleTime(int arg0) {
|
||||||
|
impl.setMaxIdleTime(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxPoolSize(int arg0) {
|
||||||
|
impl.setMaxPoolSize(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxStatements(int arg0) {
|
||||||
|
impl.setMaxStatements(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperty(String arg0, String arg1) {
|
||||||
|
impl.setProperty(arg0, arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionIsolationLevel(int arg0) {
|
||||||
|
impl.setTransactionIsolationLevel(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return impl.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue