Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/src/main/java/com/genexus/db/BlobUpdateCursor.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void postExecuteInsert(AbstractDataStoreProviderBase connectionProvider, Abstrac
IGXPreparedStatement selStmt = SentenceProvider.getPreparedStatement(connectionProvider, mCursorId + BLOB_SEL_ID, blobStmt2, false);

// Seteo el argumento (el rowId) y ejecuto el select
String rowId = ((IGXCallableStatement)mPreparedStatement).getString(cantNoBlobParms + 1);
String rowId = ((IGXCallableStatement)mPreparedStatement).getString(cantNoBlobParms + 1).trim();
selStmt.setString(1, rowId);
IGXResultSet resultSet = (IGXResultSet)selStmt.executeQuery();
resultSet.next();
Expand Down
6 changes: 6 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@
<version>10.2.0.jre8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.2.79</version>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/genexus/db/driver/DataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ public String[] concatOp()
case GXDBMS.DBMS_DB2:
return new String[]{"", " CONCAT ", ""};
case GXDBMS.DBMS_ORACLE:
case GXDBMS.DBMS_DAMENG:
case GXDBMS.DBMS_HANA:
case GXDBMS.DBMS_POSTGRESQL:
case GXDBMS.DBMS_SQLITE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void setNotInUse()

public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
{
if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE && sqlType == Types.BIT)
if ((con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG) && sqlType == Types.BIT)
{
sqlType = PLSQL_BOOLEAN;
}
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/genexus/db/driver/GXDBMS.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public interface GXDBMS
public static final int DBMS_SQLITE = 9;
public static final int DBMS_HANA = 10;
public static final int DBMS_SERVICE = 11;
public static final int DBMS_DAMENG = 12;

boolean DataTruncation(SQLException e);
boolean useReadOnlyConnections();
Expand Down
207 changes: 207 additions & 0 deletions java/src/main/java/com/genexus/db/driver/GXDBMSdameng.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
package com.genexus.db.driver;

import java.io.InputStream;
import java.sql.*;
import java.util.Date;

import com.genexus.CommonUtil;

public class GXDBMSdameng implements GXDBMS {

public void setDatabaseName(String dbName) {
}

public String getDatabaseName() {
return "";
}

public void setInReorg() {
}

public ResultSet executeQuery(PreparedStatement stmt, boolean hold) throws SQLException {
return stmt.executeQuery();
}

public int executeUpdate(PreparedStatement stmt) throws SQLException {
return stmt.executeUpdate();
}

public boolean execute(PreparedStatement stmt) throws SQLException {
return stmt.execute();
}

public int[] executeBatch(Statement stmt) throws SQLException {
return stmt.executeBatch();
}

public boolean isAlive(GXConnection con) {
try {
serverDateTime(con);
}
catch (SQLException e) {
return false;
}

return true;
}


public boolean DataTruncation(SQLException e) {
return false;
}

private DataSource dataSource;

public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}

public boolean useReadOnlyConnections() {
return true;
}

public boolean EndOfFile(SQLException e) {
return (e.getErrorCode() == 1403 || e.getErrorCode() == 100);
}

public boolean ReferentialIntegrity(SQLException e) {
return (e.getErrorCode() == -6607);
}

public boolean DuplicateKeyValue(SQLException e) {
return (e.getErrorCode() == -6602);
}

public boolean ObjectLocked(SQLException e) {
return ( e.getErrorCode() == 54);
}

public boolean ObjectNotFound(SQLException e) {
return ( e.getErrorCode() == 942 ||
e.getErrorCode() == 950 ||
e.getErrorCode() == 1418 ||
e.getErrorCode() == 1432 ||
e.getErrorCode() == 2289 ||
e.getErrorCode() == 2443 ||
e.getErrorCode() == 4080);
}

public java.util.Date nullDate() {
return CommonUtil.ymdhmsToT_noYL(1, 1, 1, 0, 0, 0);
}

public boolean useDateTimeInDate() {
return false;
}

public boolean useCharInDate() {
return false;
}

public void setConnectionProperties(java.util.Properties props) {
props.put("fixedString", "true");
}

public void onConnection(GXConnection con) {
}

public java.util.Date serverDateTime(GXConnection con) throws SQLException {
ResultSet rslt = con.getStatement("_ServerDT_", "SELECT LOCALTIMESTAMP()", false).executeQuery();

rslt.next();
Date value = rslt.getTimestamp(1);
rslt.close();

return value;
}

public String serverVersion(GXConnection con) throws SQLException {
return "";
}

public String connectionPhysicalId(GXConnection con) {
try {
ResultSet rslt = con.getStatement("_ConnectionID_", "SELECT SESSID() AS S", false).executeQuery();

rslt.next();
int value = rslt.getInt(1);
rslt.close();

return String.valueOf(value);
}
catch (SQLException e) {
return "";
}
}

public boolean getSupportsAutocommit() {
return true;
}

public void commit(Connection con) throws SQLException {
//Las reorgs corren en modo autocommit con lo cual no se debe hacer commit ni rollback implicitos.
if (!com.genexus.ApplicationContext.getInstance().getReorganization()) {
con.commit();
}
}

public void rollback(Connection con) throws SQLException {
//Las reorgs corren en modo autocommit con lo cual no se debe hacer commit ni rollback implicitos.
if (!com.genexus.ApplicationContext.getInstance().getReorganization()) {
con.rollback();
}
}

public boolean ignoreConnectionError(SQLException e) {
return false;
}

public boolean rePrepareStatement(SQLException e) {
return false;
}

public boolean getSupportsQueryTimeout() {
return true;
}

public boolean useStreamsInNullLongVarchar() {
return false;
}

public boolean useStreamsInLongVarchar() {
return true;
}

private static java.lang.reflect.Method PUTBYTES;

/** Setea los datos de un blob
* El parametro blob debe ser una instancia de java.sql.Blob o descendiente
* Esta puesto como Object para que compile sin problemas en JSharp
*/
public void setBlobData(Object blob, InputStream stream, int length)throws Exception {
try {
byte [] bytes = new byte[length];
com.genexus.PrivateUtilities.readFully(stream, bytes, 0, length);
if(PUTBYTES == null) {
PUTBYTES = Class.forName("java.sql.Blob").getMethod("setBytes", new Class[]{long.class, byte[].class});
}
PUTBYTES.invoke(blob, new Object[]{new Long(1), bytes});
}
catch(Exception e) {
System.err.println(e.toString());
throw e;
}
}

public int getId() {
return DBMS_DAMENG;
}

public int getLockRetryCount(int lockRetryCount, int waitRecord){
return lockRetryCount * waitRecord * 2;
}

public boolean connectionClosed(SQLException e) {
return (e.getErrorCode() == 17002);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public void setBoolean(int index, boolean value) throws SQLException
log(GXDBDebug.LOG_MAX, "setBoolean - index : " + index + " value : " + value);
try
{
if (this instanceof GXCallableStatement && !isUpdateBlobStmt && con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
if (this instanceof GXCallableStatement && !isUpdateBlobStmt && (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
stmt.setObject(index, value, PLSQL_BOOLEAN);
}
Expand All @@ -410,7 +410,7 @@ public void setBoolean(int index, boolean value) throws SQLException
}
else
{
if (this instanceof GXCallableStatement && !isUpdateBlobStmt && con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
if (this instanceof GXCallableStatement && !isUpdateBlobStmt && (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
stmt.setObject(index, value, PLSQL_BOOLEAN);
}
Expand Down Expand Up @@ -615,12 +615,12 @@ public void setVarchar(int index, String value) throws SQLException
public static boolean addSpaceToEmptyVarChar = true;
public void setVarchar(int index, String value, int length) throws SQLException
{
String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE) ? CommonUtil.rtrim(value) : value;
String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG) ? CommonUtil.rtrim(value) : value;
realValue = CommonUtil.left(realValue, length);

if(realValue.equals("") &&
(addSpaceToEmptyVarChar||!fieldAcceptsNull) &&
con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
(con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
realValue = " ";
}
Expand Down Expand Up @@ -686,10 +686,10 @@ public void setLongVarchar(int index, String value) throws SQLException
}
private void setLongVarchar2(int index, String value, boolean nls) throws SQLException
{
String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE) ? CommonUtil.rtrim(value) : value;
String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG) ? CommonUtil.rtrim(value) : value;
if(realValue.equals("") &&
(addSpaceToEmptyVarChar||!fieldAcceptsNull) &&
con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
(con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
realValue = " ";
}
Expand Down Expand Up @@ -894,7 +894,7 @@ public void setString(int index, String value, int length) throws SQLException
}


if(value.equals("") && con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
if(value.equals("") && (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
value = " ";
}
Expand All @@ -904,7 +904,7 @@ public void setString(int index, String value, int length) throws SQLException
log(GXDBDebug.LOG_MAX, "setString - index : " + index + " value : " + value);
try
{
if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG)
{
stmt.setObject(index, value);
}
Expand All @@ -921,7 +921,7 @@ public void setString(int index, String value, int length) throws SQLException
}
else
{
if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG)
{
stmt.setObject(index, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public boolean supportsSavePoint(Object obj) {
return ( ds.dbms.getId() == GXDBMS.DBMS_SQLSERVER ||
ds.dbms.getId() == GXDBMS.DBMS_AS400 ||
ds.dbms.getId() == GXDBMS.DBMS_DB2 ||
ds.dbms.getId() == GXDBMS.DBMS_POSTGRESQL ||
ds.dbms.getId() == GXDBMS.DBMS_POSTGRESQL ||
ds.dbms.getId() == GXDBMS.DBMS_DAMENG ||
ds.dbms.getId() == GXDBMS.DBMS_ORACLE );
}

Expand Down