|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* Copyright 2002-2024 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -63,9 +63,6 @@ public class TableMetaDataContext { |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private String schemaName; |
|
|
|
private String schemaName; |
|
|
|
|
|
|
|
|
|
|
|
// List of columns objects to be used in this context
|
|
|
|
|
|
|
|
private List<String> tableColumns = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Should we access insert parameter meta-data info or not
|
|
|
|
// Should we access insert parameter meta-data info or not
|
|
|
|
private boolean accessTableColumnMetaData = true; |
|
|
|
private boolean accessTableColumnMetaData = true; |
|
|
|
|
|
|
|
|
|
|
|
@ -76,6 +73,9 @@ public class TableMetaDataContext { |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private TableMetaDataProvider metaDataProvider; |
|
|
|
private TableMetaDataProvider metaDataProvider; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// List of columns objects to be used in this context
|
|
|
|
|
|
|
|
private List<String> tableColumns = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
// Are we using generated key columns
|
|
|
|
// Are we using generated key columns
|
|
|
|
private boolean generatedKeyColumnsUsed = false; |
|
|
|
private boolean generatedKeyColumnsUsed = false; |
|
|
|
|
|
|
|
|
|
|
|
@ -139,7 +139,6 @@ public class TableMetaDataContext { |
|
|
|
return this.accessTableColumnMetaData; |
|
|
|
return this.accessTableColumnMetaData; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Specify whether we should override default for accessing synonyms. |
|
|
|
* Specify whether we should override default for accessing synonyms. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -266,7 +265,6 @@ public class TableMetaDataContext { |
|
|
|
return values; |
|
|
|
return values; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Build the insert string based on configuration and meta-data information. |
|
|
|
* Build the insert string based on configuration and meta-data information. |
|
|
|
* @return the insert string to be used |
|
|
|
* @return the insert string to be used |
|
|
|
@ -303,8 +301,8 @@ public class TableMetaDataContext { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
String message = "Unable to locate columns for table '" + getTableName() |
|
|
|
String message = "Unable to locate columns for table '" + getTableName() + |
|
|
|
+ "' so an insert statement can't be generated."; |
|
|
|
"' so an insert statement can't be generated."; |
|
|
|
if (isAccessTableColumnMetaData()) { |
|
|
|
if (isAccessTableColumnMetaData()) { |
|
|
|
message += " Consider specifying explicit column names -- for example, via SimpleJdbcInsert#usingColumns()."; |
|
|
|
message += " Consider specifying explicit column names -- for example, via SimpleJdbcInsert#usingColumns()."; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -349,26 +347,27 @@ public class TableMetaDataContext { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Does this database support the JDBC 3.0 feature of retrieving generated keys: |
|
|
|
* Does this database support the JDBC feature for retrieving generated keys? |
|
|
|
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}? |
|
|
|
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean isGetGeneratedKeysSupported() { |
|
|
|
public boolean isGetGeneratedKeysSupported() { |
|
|
|
return obtainMetaDataProvider().isGetGeneratedKeysSupported(); |
|
|
|
return obtainMetaDataProvider().isGetGeneratedKeysSupported(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Does this database support simple query to retrieve generated keys |
|
|
|
* Does this database support a simple query to retrieve generated keys when |
|
|
|
* when the JDBC 3.0 feature is not supported: |
|
|
|
* the JDBC feature for retrieving generated keys is not supported? |
|
|
|
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}? |
|
|
|
* @see #isGetGeneratedKeysSupported() |
|
|
|
|
|
|
|
* @see #getSimpleQueryForGetGeneratedKey(String, String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean isGetGeneratedKeysSimulated() { |
|
|
|
public boolean isGetGeneratedKeysSimulated() { |
|
|
|
return obtainMetaDataProvider().isGetGeneratedKeysSimulated(); |
|
|
|
return obtainMetaDataProvider().isGetGeneratedKeysSimulated(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Does this database support a simple query to retrieve generated keys |
|
|
|
* Get the simple query to retrieve generated keys when the JDBC feature for |
|
|
|
* when the JDBC 3.0 feature is not supported: |
|
|
|
* retrieving generated keys is not supported. |
|
|
|
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}? |
|
|
|
* @see #isGetGeneratedKeysSimulated() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName) { |
|
|
|
public String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName) { |
|
|
|
@ -376,8 +375,9 @@ public class TableMetaDataContext { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Is a column name String array for retrieving generated keys supported: |
|
|
|
* Does this database support a column name String array for retrieving generated |
|
|
|
* {@link java.sql.Connection#createStruct(String, Object[])}? |
|
|
|
* keys? |
|
|
|
|
|
|
|
* @see java.sql.Connection#createStruct(String, Object[]) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean isGeneratedKeysColumnNameArraySupported() { |
|
|
|
public boolean isGeneratedKeysColumnNameArraySupported() { |
|
|
|
return obtainMetaDataProvider().isGeneratedKeysColumnNameArraySupported(); |
|
|
|
return obtainMetaDataProvider().isGeneratedKeysColumnNameArraySupported(); |
|
|
|
|