mirror of https://github.com/apache/openjpa.git
OPENJPA-745 raise string right truncation error for Sybase
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@706493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e2388e9b3c
commit
1e4aa60859
|
@ -920,6 +920,7 @@ public class JDBCStoreManager
|
||||||
_conn = connectInternal();
|
_conn = connectInternal();
|
||||||
if (ref)
|
if (ref)
|
||||||
_conn.ref();
|
_conn.ref();
|
||||||
|
_dict.initializeSettings(_conn);
|
||||||
} catch (SQLException se) {
|
} catch (SQLException se) {
|
||||||
throw SQLExceptions.getStore(se, _dict);
|
throw SQLExceptions.getStore(se, _dict);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -200,6 +200,7 @@ public class DBDictionary
|
||||||
public String selectWords = null;
|
public String selectWords = null;
|
||||||
public String fixedSizeTypeNames = null;
|
public String fixedSizeTypeNames = null;
|
||||||
public String schemaCase = SCHEMA_CASE_UPPER;
|
public String schemaCase = SCHEMA_CASE_UPPER;
|
||||||
|
public boolean setStringRightTruncationOn = true;
|
||||||
|
|
||||||
// sql
|
// sql
|
||||||
public String validationSQL = null;
|
public String validationSQL = null;
|
||||||
|
@ -4561,4 +4562,8 @@ public class DBDictionary
|
||||||
length));
|
length));
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initializeSettings(Connection conn)
|
||||||
|
throws SQLException {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,6 +269,20 @@ public class SybaseDictionary
|
||||||
return new SybaseConnection(super.decorate(conn));
|
return new SybaseConnection(super.decorate(conn));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initializeSettings(Connection conn)
|
||||||
|
throws SQLException {
|
||||||
|
// In order for Sybase to raise the truncation exception when the
|
||||||
|
// string length is greater than the column length for Char, VarChar,
|
||||||
|
// Binary, VarBinary, the "set string_rtruncation on" must be executed.
|
||||||
|
// This setting is effective for the duration of current connection.
|
||||||
|
if (setStringRightTruncationOn) {
|
||||||
|
String str = "set string_rtruncation on";
|
||||||
|
PreparedStatement stmnt = prepareStatement(conn, str);
|
||||||
|
stmnt.execute();
|
||||||
|
stmnt.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connection wrapper to cache the {@link Connection#getCatalog} result,
|
* Connection wrapper to cache the {@link Connection#getCatalog} result,
|
||||||
* which takes a very long time with the Sybase Connection (and
|
* which takes a very long time with the Sybase Connection (and
|
||||||
|
|
Loading…
Reference in New Issue