mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-21 08:35:00 -05:00
Rename JdbcMapper.DatabaseType.STANDARD to ANY
This commit is contained in:
parent
5522014f8e
commit
d89078ad89
@ -129,7 +129,7 @@ public interface JdbcMapper extends Closeable {
|
||||
public enum DatabaseType {
|
||||
DEFAULT(null, null),
|
||||
BIND(null, null),
|
||||
STANDARD("numeric", "text"),
|
||||
ANY("NUMERIC", "TEXT"),
|
||||
UNNEST("NUMERIC", "VARCHAR"),
|
||||
ORACLE("ARRAY_NUM_TYPE", "ARRAY_STR_TYPE"),
|
||||
;
|
||||
|
@ -126,7 +126,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
enumType = types.getDeclaredType(elements.getTypeElement(Enum.class.getCanonicalName()), types.getWildcardType(null, null));
|
||||
|
||||
final String databaseType = processingEnv.getOptions().get("jdbcMapper.databaseType");
|
||||
defaultDatabaseType = databaseType == null || databaseType.isEmpty() ? JdbcMapper.DatabaseType.STANDARD : JdbcMapper.DatabaseType.valueOf(databaseType.toUpperCase());
|
||||
defaultDatabaseType = databaseType == null || databaseType.isEmpty() ? JdbcMapper.DatabaseType.ANY : JdbcMapper.DatabaseType.valueOf(databaseType.toUpperCase());
|
||||
defaultArrayNumberTypeName = processingEnv.getOptions().get("jdbcMapper.arrayNumberTypeName");
|
||||
if (defaultArrayNumberTypeName == null || defaultArrayNumberTypeName.isEmpty())
|
||||
defaultArrayNumberTypeName = defaultDatabaseType.arrayNumberTypeName;
|
||||
@ -188,7 +188,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
case ORACLE:
|
||||
arrayInList = new OracleArrayInList(arrayNumberTypeName, arrayStringTypeName);
|
||||
break;
|
||||
case STANDARD:
|
||||
case ANY:
|
||||
arrayInList = new ArrayInList(arrayNumberTypeName, arrayStringTypeName);
|
||||
break;
|
||||
case UNNEST:
|
||||
@ -411,7 +411,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
"(" + inColumnName + " NOT IN(select column_value from table(?)))" :
|
||||
"(" + inColumnName + " IN(select column_value from table(?)))";
|
||||
break;
|
||||
case STANDARD:
|
||||
case ANY:
|
||||
replacement = not ?
|
||||
"(" + inColumnName + " != ANY(?))" :
|
||||
"(" + inColumnName + " = ANY(?))";
|
||||
@ -790,7 +790,7 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
||||
*/
|
||||
//w.write("(Array) createArray.invoke(conn.unwrap(oracleConnection), \"");
|
||||
break;
|
||||
case STANDARD:
|
||||
case ANY:
|
||||
case UNNEST:
|
||||
w.write("conn.createArrayOf(\"");
|
||||
break;
|
||||
|
@ -71,7 +71,7 @@ public class SimpleSQLChecker implements SQLChecker {
|
||||
if (sqlStatement.trim().substring(0, 5).toUpperCase().equals("MERGE"))
|
||||
return sqlStatement;
|
||||
return "EXPLAIN PLAN FOR " + sqlStatement;
|
||||
case STANDARD:
|
||||
case ANY:
|
||||
return "EXPLAIN " + sqlStatement;
|
||||
}
|
||||
return sqlStatement;
|
||||
|
@ -26,7 +26,7 @@ public class ArrayInList implements InList {
|
||||
}
|
||||
|
||||
public ArrayInList() {
|
||||
this(JdbcMapper.DatabaseType.STANDARD.arrayNumberTypeName, JdbcMapper.DatabaseType.STANDARD.arrayStringTypeName);
|
||||
this(JdbcMapper.DatabaseType.ANY.arrayNumberTypeName, JdbcMapper.DatabaseType.ANY.arrayStringTypeName);
|
||||
}
|
||||
|
||||
protected String columnAppend(final String columnName) {
|
||||
|
16
test/pom.xml
16
test/pom.xml
@ -210,5 +210,21 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>any</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<compilerArgs>
|
||||
<compilerArg>-AjdbcMapper.databaseType=ANY</compilerArg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
@ -4,7 +4,6 @@ import com.moparisthebest.jdbc.Cleaner;
|
||||
import com.moparisthebest.jdbc.dto.*;
|
||||
import com.moparisthebest.jdbc.util.ResultSetIterable;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
@ -20,7 +19,7 @@ import java.time.*;
|
||||
*/
|
||||
@JdbcMapper.Mapper(
|
||||
jndiName = "bob",
|
||||
databaseType = JdbcMapper.DatabaseType.STANDARD, // todo: PrestoPersonDao breaks with ORACLE or UNNEST
|
||||
databaseType = JdbcMapper.DatabaseType.ANY, // todo: PrestoPersonDao breaks with ORACLE or UNNEST
|
||||
cachePreparedStatements = JdbcMapper.OptionalBool.FALSE
|
||||
// , sqlParser = SimpleSQLParser.class
|
||||
, allowReflection = JdbcMapper.OptionalBool.TRUE
|
||||
|
@ -4,7 +4,6 @@ import com.moparisthebest.jdbc.Cleaner;
|
||||
import com.moparisthebest.jdbc.dto.*;
|
||||
import com.moparisthebest.jdbc.util.ResultSetIterable;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
@ -20,7 +19,7 @@ import java.time.*;
|
||||
*/
|
||||
@JdbcMapper.Mapper(
|
||||
jndiName = "bob",
|
||||
databaseType = JdbcMapper.DatabaseType.STANDARD, // PrestoPersonDao breaks with ORACLE or UNNEST
|
||||
databaseType = JdbcMapper.DatabaseType.ANY, // PrestoPersonDao breaks with ORACLE or UNNEST
|
||||
cachePreparedStatements = JdbcMapper.OptionalBool.FALSE
|
||||
, sqlParser = PrestoSQLParser.class
|
||||
, allowReflection = JdbcMapper.OptionalBool.TRUE
|
||||
|
Loading…
Reference in New Issue
Block a user