You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by fa...@apache.org on 2010/08/12 23:58:14 UTC
svn commit: r985003 -
/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SolidDBDictionary.java
Author: faywang
Date: Thu Aug 12 21:58:14 2010
New Revision: 985003
URL: http://svn.apache.org/viewvc?rev=985003&view=rev
Log:
OPENJPA-735: OpenJPA support for SolidDB
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SolidDBDictionary.java
Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SolidDBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SolidDBDictionary.java?rev=985003&r1=985002&r2=985003&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SolidDBDictionary.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SolidDBDictionary.java Thu Aug 12 21:58:14 2010
@@ -22,6 +22,7 @@ import java.util.Arrays;
import org.apache.commons.lang.StringUtils;
import org.apache.openjpa.jdbc.identifier.DBIdentifier;
+import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
import org.apache.openjpa.jdbc.schema.Column;
import org.apache.openjpa.jdbc.schema.PrimaryKey;
import org.apache.openjpa.jdbc.schema.Table;
@@ -37,9 +38,14 @@ public class SolidDBDictionary
* Sets whether tables are to be located in-memory or on disk.
* Creating in-memory tables should append "STORE MEMORY" to the
* "CREATE TABLE" statement. Creating disk-based tables should
- * append "STORE DISK".
+ * append "STORE DISK". Since cursor hold over commit can not apply
+ * to M-tables (which will cause SOLID Table Error 13187: The cursor
+ * cannot continue accessing M-tables after the transaction has committed
+ * or aborted. The statement must be re-executed.), the default is
+ * STORE DISK.
+ *
*/
- public boolean storeIsMemory = true;
+ public boolean storeIsMemory = false;
public SolidDBDictionary() {
platform = "SolidDB";
@@ -52,6 +58,13 @@ public class SolidDBDictionary
allowsAliasInBulkClause = false;
useGetStringForClobs = true;
useSetStringForClobs = true;
+ supportsDeferredConstraints = false;
+ supportsNullUniqueColumn = false;
+
+ concatenateFunction = "CONCAT({0},{1})";
+ trimLeadingFunction = "LTRIM({0})";
+ trimTrailingFunction = "RTRIM({0})";
+ trimBothFunction = "TRIM({0})";
reservedWordSet.addAll(Arrays.asList(new String[]{
"BIGINT", "BINARY", "DATE", "TIME",
@@ -94,9 +107,67 @@ public class SolidDBDictionary
return new String[]{ buf.toString() };
}
+ @Override
public String convertSchemaCase(DBIdentifier objectName) {
if (objectName != null && objectName.getName() == null)
return "";
return super.convertSchemaCase(objectName);
}
+
+ @Override
+ public void substring(SQLBuffer buf, FilterValue str, FilterValue start,
+ FilterValue end) {
+ if (end != null) {
+ super.substring(buf, str, start, end);
+ } else {
+ buf.append(substringFunctionName).append("(");
+ str.appendTo(buf);
+ buf.append(", ");
+ if (start.getValue() instanceof Number) {
+ long startLong = toLong(start);
+ buf.append(Long.toString(startLong + 1));
+ } else {
+ buf.append("(");
+ start.appendTo(buf);
+ buf.append(" + 1)");
+ }
+ buf.append(", ");
+ if (start.getValue() instanceof Number) {
+ long startLong = toLong(start);
+ long endLong = Integer.MAX_VALUE; //2G
+ buf.append(Long.toString(endLong - startLong));
+ } else {
+ buf.append(Integer.toString(Integer.MAX_VALUE));
+ buf.append(" - (");
+ start.appendTo(buf);
+ buf.append(")");
+ }
+ buf.append(")");
+ }
+ }
+
+ @Override
+ public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find,
+ FilterValue start) {
+ buf.append("(POSITION((");
+ find.appendTo(buf);
+ buf.append(") IN (");
+
+ if (start != null)
+ substring(buf, str, start, null);
+ else
+ str.appendTo(buf);
+
+ buf.append(")) - 1");
+
+ if (start != null) {
+ buf.append(" + ");
+ start.appendTo(buf);
+ }
+ buf.append(")");
+ }
+
+ public String toUpper(String internalName, boolean force) {
+ return internalName.toUpperCase();
+ }
}