/** * INTERNAL: * Initialize any platform-specific operators */ @Override protected void initializePlatformOperators() { super.initializePlatformOperators(); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToUpperCase, "UCASE")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToLowerCase, "LCASE")); addOperator(concatOperator()); addOperator(ExpressionOperator.simpleTwoArgumentFunction(ExpressionOperator.Instring, "Locate")); // CR#2811076 some missing DB2 functions added. addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToNumber, "DECIMAL")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToChar, "CHAR")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.DateToString, "CHAR")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToDate, "DATE")); addOperator(ltrim2Operator()); addOperator(rtrim2Operator()); }
/** * INTERNAL: * TODO: Need to find out how can byte arrays be inlined in Derby */ protected void appendByteArray(byte[] bytes, Writer writer) throws IOException { super.appendByteArray(bytes, writer); }
/** * INTERNAL: * Append the Timestamp in native format if usesNativeSQL() is true * otherwise use ODBC format from DatabasePlatform. Native format: * 'YYYY-MM-DD-hh.mm.ss.SSSSSS' */ @Override protected void appendCalendar(Calendar calendar, Writer writer) throws IOException { if (usesNativeSQL()) { writer.write("'"); appendDB2Calendar(calendar, writer); writer.write("'"); } else { super.appendCalendar(calendar, writer); } }
/** * INTERNAL * DB2 has some issues with using parameters on certain functions and relations. * This allows statements to disable binding only in these cases. * If users set casting on, then casting is used instead of dynamic SQL. */ @Override public boolean isDynamicSQLRequiredForFunctions() { if(shouldForceBindAllParameters()) { return false; } return !isCastRequired(); }
/** * INTERNAL: * Appends the Date in native format if usesNativeSQL() otherwise use ODBC * format from DatabasePlatform. Native format: 'mm/dd/yyyy' */ @Override protected void appendDate(java.sql.Date date, Writer writer) throws IOException { if (usesNativeSQL()) { appendDB2Date(date, writer); } else { super.appendDate(date, writer); } }
/** * INTERNAL: * Append the Timestamp in native format if usesNativeSQL() is true * otherwise use ODBC format from DatabasePlatform. Native format: * 'YYYY-MM-DD-hh.mm.ss.SSSSSS' */ @Override protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException { if (usesNativeSQL()) { writer.write("'"); appendDB2Timestamp(timestamp, writer); writer.write("'"); } else { super.appendTimestamp(timestamp, writer); } }
/** * Initialize any platform-specific operators */ @Override protected void initializePlatformOperators() { super.initializePlatformOperators(); addOperator(ExpressionOperator.simpleLogicalNoParens(ExpressionOperator.Concat, "CONCAT")); }
/** * INTERNAL: * Initialize any platform-specific operators */ @Override protected void initializePlatformOperators() { super.initializePlatformOperators(); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToUpperCase, "UCASE")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToLowerCase, "LCASE")); addOperator(concatOperator()); addOperator(ExpressionOperator.simpleTwoArgumentFunction(ExpressionOperator.Instring, "Locate")); // CR#2811076 some missing DB2 functions added. addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToNumber, "DECIMAL")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToChar, "CHAR")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.DateToString, "CHAR")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToDate, "DATE")); }
/** * PUBLIC: * Set the database platform to be DB2. */ public void useDB2() { if (getPlatform().isDB2()) { return; } DatabasePlatform newPlatform = new DB2Platform(); getPlatform().copyInto(newPlatform); setPlatform(newPlatform); }
castType = "DOUBLE"; } else if (typeHelper.isStringType(type)) { castType = "VARCHAR(" + getCastSizeForVarcharParameter() + ")";
/** * INTERNAL * DB2 has some issues with using parameters on certain functions and relations. * This allows statements to disable binding only in these cases. * If users set casting on, then casting is used instead of dynamic SQL. */ @Override public boolean isDynamicSQLRequiredForFunctions() { return !isCastRequired(); }
/** * INTERNAL: * Appends the Date in native format if usesNativeSQL() otherwise use ODBC * format from DatabasePlatform. Native format: 'mm/dd/yyyy' */ @Override protected void appendDate(java.sql.Date date, Writer writer) throws IOException { if (usesNativeSQL()) { appendDB2Date(date, writer); } else { super.appendDate(date, writer); } }
/** * INTERNAL: * Append the Timestamp in native format if usesNativeSQL() is true * otherwise use ODBC format from DatabasePlatform. Native format: * 'YYYY-MM-DD-hh.mm.ss.SSSSSS' */ @Override protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException { if (usesNativeSQL()) { writer.write("'"); appendDB2Timestamp(timestamp, writer); writer.write("'"); } else { super.appendTimestamp(timestamp, writer); } }
/** * Initialize any platform-specific operators */ protected void initializePlatformOperators() { super.initializePlatformOperators(); // Derby does not support DECIMAL, but does have a DOUBLE function. addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToNumber, "DOUBLE")); }
/** * PUBLIC: * Set the database platform to be DB2. */ public void useDB2() { if (getPlatform().isDB2()) { return; } DatabasePlatform newPlatform = new DB2Platform(); getPlatform().copyInto(newPlatform); setPlatform(newPlatform); }
castType = "DOUBLE"; } else if (typeHelper.isStringType(type)) { castType = "VARCHAR(" + getCastSizeForVarcharParameter() + ")";
/** * INTERNAL * DB2 has some issues with using parameters on certain functions and relations. * This allows statements to disable binding only in these cases. * If users set casting on, then casting is used instead of dynamic SQL. */ @Override public boolean isDynamicSQLRequiredForFunctions() { return !isCastRequired(); }
/** * INTERNAL: * Initialize any platform-specific operators */ @Override protected void initializePlatformOperators() { super.initializePlatformOperators(); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToUpperCase, "UCASE")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToLowerCase, "LCASE")); addOperator(concatOperator()); addOperator(ExpressionOperator.simpleTwoArgumentFunction(ExpressionOperator.Instring, "Locate")); // CR#2811076 some missing DB2 functions added. addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToNumber, "DECIMAL")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToChar, "CHAR")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.DateToString, "CHAR")); addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToDate, "DATE")); addOperator(ltrim2Operator()); addOperator(rtrim2Operator()); }
/** * INTERNAL: * Appends the Date in native format if usesNativeSQL() otherwise use ODBC * format from DatabasePlatform. Native format: 'mm/dd/yyyy' */ @Override protected void appendDate(java.sql.Date date, Writer writer) throws IOException { if (usesNativeSQL()) { appendDB2Date(date, writer); } else { super.appendDate(date, writer); } }
/** * INTERNAL: * Append the Timestamp in native format if usesNativeSQL() is true * otherwise use ODBC format from DatabasePlatform. Native format: * 'YYYY-MM-DD-hh.mm.ss.SSSSSS' */ @Override protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException { if (usesNativeSQL()) { writer.write("'"); appendDB2Timestamp(timestamp, writer); writer.write("'"); } else { super.appendTimestamp(timestamp, writer); } }