StandardDialect implements Dialect, SequenceSupport, IdentityColumnSupport, TriggerSupport { @Override public String evaluateRand(String sql) { StringBuffer buffer = new StringBuffer(); Matcher matcher = this.randomPattern.matcher(sql); while (matcher.find()) { matcher.appendReplacement(buffer, Double.toString(Math.random())); } return matcher.appendTail(buffer).toString(); }  @Override String getTruncateTableSQL(TableProperties properties); @Override String getCreateForeignKeyConstraintSQL(ForeignKeyConstraint key); @Override String getDropForeignKeyConstraintSQL(ForeignKeyConstraint key); @Override String getCreateUniqueConstraintSQL(UniqueConstraint constraint); @Override String getDropUniqueConstraintSQL(UniqueConstraint constraint); @Override boolean isSelectForUpdate(String sql); @Override List<String> getDefaultSchemas(DatabaseMetaData metaData); @Override SequenceSupport getSequenceSupport(); @Override String parseSequence(String sql); @Override int getColumnType(ColumnProperties properties); @Override Collection<SequenceProperties> getSequences(DatabaseMetaData metaData, SequencePropertiesFactory factory); @Override String getNextSequenceValueSQL(SequenceProperties sequence); @Override String getAlterSequenceSQL(SequenceProperties sequence, long value); @Override IdentityColumnSupport getIdentityColumnSupport(); @Override String parseInsertTable(String sql); @Override String getAlterIdentityColumnSQL(TableProperties table, ColumnProperties column, long value); @Override String evaluateCurrentDate(String sql, java.sql.Date date); @Override String evaluateCurrentTime(String sql, java.sql.Time time); @Override String evaluateCurrentTimestamp(String sql, java.sql.Timestamp timestamp); @Override String evaluateRand(String sql); @Override boolean indicatesFailure(SQLException e); @Override boolean indicatesFailure(XAException e); @Override DumpRestoreSupport getDumpRestoreSupport(); @Override TriggerSupport getTriggerSupport(); @Override String getCreateTriggerSQL(String name, TableProperties table, TriggerEvent event, String action); @Override String getDropTriggerSQL(String name, TableProperties table); @Override String getTriggerRowAlias(TriggerTime time); @Override String getCreateSchemaSQL(String schema); @Override String getDropSchemaSQL(String schema); @Override Collection<QualifiedName> getTables(DatabaseMetaData metaData, QualifiedNameFactory factory); @Override Map<String, ColumnProperties> getColumns(DatabaseMetaData metaData, QualifiedName table, ColumnPropertiesFactory factory); @Override UniqueConstraint getPrimaryKey(DatabaseMetaData metaData, QualifiedName table, UniqueConstraintFactory factory); @Override Collection<ForeignKeyConstraint> getForeignKeyConstraints(DatabaseMetaData metaData, QualifiedName table, ForeignKeyConstraintFactory factory); @Override Collection<UniqueConstraint> getUniqueConstraints(DatabaseMetaData metaData, QualifiedName table, UniqueConstraint primaryKey, UniqueConstraintFactory factory); @Override Collection<String> getIdentityColumns(Collection<ColumnProperties> columns); @Override Map<Integer, Entry<String, Integer>> getTypes(DatabaseMetaData metaData); @Override IdentifierNormalizer createIdentifierNormalizer(DatabaseMetaData metaData); @Override QualifiedNameFactory createQualifiedNameFactory(DatabaseMetaData metaData, IdentifierNormalizer normalizer); @Override ColumnPropertiesFactory createColumnPropertiesFactory(IdentifierNormalizer normalizer); @Override SequencePropertiesFactory createSequencePropertiesFactory(QualifiedNameFactory factory); @Override ForeignKeyConstraintFactory createForeignKeyConstraintFactory(QualifiedNameFactory factory); @Override UniqueConstraintFactory createUniqueConstraintFactory(IdentifierNormalizer normalizer); @Override boolean isValid(Connection connection); @Override ConnectionProperties getConnectionProperties(D database, Decoder decoder);  }
@Test public void evaluateRand() { assertTrue(Pattern.matches("SELECT ((0\\.\\d+)|([1-9]\\.\\d+E\\-\\d+)) FROM test", this.dialect.evaluateRand("SELECT RAND() FROM test"))); assertTrue(Pattern.matches("SELECT ((0\\.\\d+)|([1-9]\\.\\d+E\\-\\d+)) FROM test", this.dialect.evaluateRand("SELECT RAND ( ) FROM test"))); assertEquals("SELECT RAND FROM test", this.dialect.evaluateRand("SELECT RAND FROM test")); assertEquals("SELECT OPERAND() FROM test", this.dialect.evaluateRand("SELECT OPERAND() FROM test")); assertEquals("SELECT 1 FROM test", this.dialect.evaluateRand("SELECT 1 FROM test")); }