mirror of
https://github.com/apache/openjpa.git
synced 2025-02-20 17:05:15 +00:00
OPENJPA-2713 improve MariaDB Dictionary
Seems like MariaDB does still have quite a few problems in their JDBC driver. I at least tried to iron out new functionality.
This commit is contained in:
parent
9f0631bbf4
commit
fffc74f0a7
@ -301,10 +301,8 @@ public class JDBCExpressionFactory
|
||||
String single, String multi, String esc) {
|
||||
if (!(v2 instanceof Const))
|
||||
throw new UserException(_loc.get("const-only", "matches"));
|
||||
if (esc == null && _type.getMappingRepository().
|
||||
getDBDictionary().requiresSearchStringEscapeForLike == true) {
|
||||
esc = _type.getMappingRepository().
|
||||
getDBDictionary().searchStringEscape;
|
||||
if (esc == null && _type.getMappingRepository().getDBDictionary().requiresSearchStringEscapeForLike) {
|
||||
esc = _type.getMappingRepository().getDBDictionary().searchStringEscape;
|
||||
}
|
||||
return new MatchesExpression((Val) v1, (Const) v2, single, multi, esc);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class MariaDBDictionary extends DBDictionary {
|
||||
* combined <code>DELETE FROM foo, bar, baz</code> syntax.
|
||||
* Defaults to false, since this may fail in the presence of InnoDB tables
|
||||
* with foreign keys.
|
||||
* @see http://dev.mysql.com/doc/refman/5.0/en/delete.html
|
||||
* @link http://dev.mysql.com/doc/refman/5.0/en/delete.html
|
||||
*/
|
||||
public boolean optimizeMultiTableDeletes = false;
|
||||
|
||||
@ -98,6 +98,8 @@ public class MariaDBDictionary extends DBDictionary {
|
||||
supportsSelectStartIndex = true;
|
||||
supportsSelectEndIndex = true;
|
||||
|
||||
datePrecision = MICRO;
|
||||
|
||||
concatenateFunction = "CONCAT({0},{1})";
|
||||
|
||||
maxTableNameLength = 64;
|
||||
@ -153,11 +155,11 @@ public class MariaDBDictionary extends DBDictionary {
|
||||
}));
|
||||
|
||||
requiresSearchStringEscapeForLike = true;
|
||||
|
||||
// MariaDB requires double-escape for strings
|
||||
searchStringEscape = "\\\\";
|
||||
|
||||
typeModifierSet.addAll(Arrays.asList(new String[] { "UNSIGNED",
|
||||
"ZEROFILL" }));
|
||||
typeModifierSet.addAll(Arrays.asList(new String[] { "UNSIGNED", "ZEROFILL" }));
|
||||
|
||||
setLeadingDelimiter(DELIMITER_BACK_TICK);
|
||||
setTrailingDelimiter(DELIMITER_BACK_TICK);
|
||||
@ -186,6 +188,13 @@ public class MariaDBDictionary extends DBDictionary {
|
||||
}
|
||||
|
||||
supportsXMLColumn = true;
|
||||
|
||||
if (maj > 10 || (maj == 10 && min > 1)) {
|
||||
// MariaDB supports fraction of a second
|
||||
timestampTypeName = "DATETIME{0}";
|
||||
fixedSizeTypeNameSet.remove(timestampTypeName);
|
||||
fractionalTypeNameSet.add(timestampTypeName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -191,7 +191,7 @@ The generated PDF is available under ./target/docbook/manual.pdf
|
||||
|
||||
Running unit tests in the Debugger
|
||||
==================================
|
||||
TODO: finish!
|
||||
|
||||
By default all tests run against a derby database.
|
||||
To run the tests in the debugger simply add the following JVM properties
|
||||
|
||||
@ -203,4 +203,14 @@ For running against a MySQL Docker installation:
|
||||
|
||||
Running against a PostgreSQL Docker installation:
|
||||
|
||||
-ea -Dopenjpa.ConnectionDriverName=org.postgresql.Driver -Dopenjpa.ConnectionURL=jdbc:postgresql:5432//localhost/openjpatst -Dopenjpa.ConnectionUserName=postgres -Dopenjpa.ConnectionPassword=postgres
|
||||
-ea -Dopenjpa.ConnectionDriverName=org.postgresql.Driver -Dopenjpa.ConnectionURL=jdbc:postgresql:5432//localhost/openjpatst -Dopenjpa.ConnectionUserName=postgres -Dopenjpa.ConnectionPassword=postgres
|
||||
|
||||
For running against a MariaDB Docker installation:
|
||||
|
||||
-ea -Dopenjpa.ConnectionDriverName=org.mariadb.jdbc.Driver -Dopenjpa.ConnectionURL=jdbc:mariadb://localhost:3306/openjpatst -Dopenjpa.ConnectionUserName=root -Dopenjpa.ConnectionPassword=openjpatst
|
||||
|
||||
TODO: finish!
|
||||
|
||||
For starting tests in `openjpa-persistence-jdbc` inside a compiler you can also trigger all the enhancement manually via:
|
||||
|
||||
$> mvn process-test-classes
|
||||
|
Loading…
x
Reference in New Issue
Block a user