private String convertToString ( Object newValue , Database database ) { String sqlString ; if ( newValue == null || newValue . toString ( ) . equals ( "" ) || newValue . toString ( ) . equalsIgnoreCase ( "NULL" ) ) { sqlString = "NULL::INTEGER" ; } else if ( newValue instanceof String && ! looksLikeFunctionCall ( ( ( String ) newValue ) , database ) ) { sqlString = "'" + database . escapeStringForDatabase ( newValue . toString ( ) ) + "'" ; } else if ( newValue instanceof Date ) { sqlString = database . getDateLiteral ( ( ( Date ) newValue ) ) ; } else if ( newValue instanceof Boolean ) { if ( ( ( Boolean ) newValue ) ) { sqlString = DataTypeFactory . getInstance ( ) . getTrueBooleanValue ( database ) ; } else { sqlString = DataTypeFactory . getInstance ( ) . getFalseBooleanValue ( database ) ; } } else { sqlString = newValue . toString ( ) ; } return sqlString ; }
Copied and modified from liquibase . sqlgenerator . core . InsertOrUpdateGeneratorMySQL