2525public final class JdbcAttributesGetter implements SqlClientAttributesGetter <DbRequest , Void > {
2626
2727 // Databases where double quotes are exclusively identifiers and cannot be string literals.
28- private static final Set <String > DOUBLE_QUOTES_FOR_IDENTIFIERS_SYSTEMS =
28+ private static final Set <String > DOUBLE_QUOTES_FOR_IDENTIFIERS_SYSTEM_NAMES =
2929 new HashSet <>(
3030 asList (
3131 // "A string constant in SQL is an arbitrary sequence of characters
@@ -35,11 +35,11 @@ public final class JdbcAttributesGetter implements SqlClientAttributesGetter<DbR
3535 // "Text, character, and string literals are always surrounded
3636 // by single quotation marks."
3737 // https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/Literals.html
38- "oracle" ,
38+ "oracle.db " ,
3939 // "A sequence of characters that starts and ends with a string delimiter,
4040 // which is an apostrophe (')"
4141 // https://www.ibm.com/docs/en/db2/12.1?topic=elements-constants
42- "db2" ,
42+ "ibm. db2" ,
4343 // "Single quotation marks delimit character strings."
4444 // "Double quotation marks delimit special identifiers"
4545 // https://db.apache.org/derby/docs/10.17/ref/rrefsqlj28468.html
@@ -51,44 +51,56 @@ public final class JdbcAttributesGetter implements SqlClientAttributesGetter<DbR
5151 // <string_literal> ::= <single_quote>[<any_character>...]<single_quote>
5252 // <special_identifier> ::= <double_quotes><any_character>...<double_quotes>
5353 // https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/sql-notation-conventions
54- "hanadb " ,
54+ "sap.hana " ,
5555 // "String literals must be enclosed in single quotes.
5656 // Double quotes are not supported."
5757 // https://clickhouse.com/docs/en/sql-reference/syntax#string
5858 "clickhouse" ,
5959 // PostgreSQL-compatible fork, inherits PG string literal rules
6060 "polardb" ));
6161
62- @ Nullable
6362 @ Override
6463 public String getDbSystemName (DbRequest request ) {
65- return request .getDbInfo ().getSystem ();
64+ return request .getDbInfo ().getDbSystemName ();
65+ }
66+
67+ @ Deprecated // to be removed in 3.0
68+ @ Override
69+ public String getDbSystem (DbRequest request ) {
70+ return request .getDbInfo ().getDbSystem ();
6671 }
6772
6873 @ Deprecated // to be removed in 3.0
6974 @ Nullable
7075 @ Override
7176 public String getUser (DbRequest request ) {
72- return request .getDbInfo ().getUser ();
77+ return request .getDbInfo ().getDbUser ();
7378 }
7479
7580 @ Nullable
7681 @ Override
7782 public String getDbNamespace (DbRequest request ) {
78- return request .getDbInfo ().getName ();
83+ return request .getDbInfo ().getDbNamespace ();
84+ }
85+
86+ @ Deprecated // to be removed in 3.0
87+ @ Nullable
88+ @ Override
89+ public String getDbName (DbRequest request ) {
90+ return request .getDbInfo ().getDbName ();
7991 }
8092
8193 @ Deprecated // to be removed in 3.0
8294 @ Nullable
8395 @ Override
8496 public String getConnectionString (DbRequest request ) {
85- return request .getDbInfo ().getShortUrl ();
97+ return request .getDbInfo ().getDbConnectionString ();
8698 }
8799
88100 @ Override
89101 public SqlDialect getSqlDialect (DbRequest request ) {
90- String system = request .getDbInfo ().getSystem ();
91- if (system != null && DOUBLE_QUOTES_FOR_IDENTIFIERS_SYSTEMS .contains (system )) {
102+ String systemName = request .getDbInfo ().getDbSystemName ();
103+ if (systemName != null && DOUBLE_QUOTES_FOR_IDENTIFIERS_SYSTEM_NAMES .contains (systemName )) {
92104 return DOUBLE_QUOTES_ARE_IDENTIFIERS ;
93105 }
94106 // default to treating double-quoted tokens as string literals for safety, ensuring that
@@ -129,12 +141,12 @@ public boolean isParameterizedQuery(DbRequest request) {
129141 @ Nullable
130142 @ Override
131143 public String getServerAddress (DbRequest request ) {
132- return request .getDbInfo ().getHost ();
144+ return request .getDbInfo ().getServerAddress ();
133145 }
134146
135147 @ Nullable
136148 @ Override
137149 public Integer getServerPort (DbRequest request ) {
138- return request .getDbInfo ().getPort ();
150+ return request .getDbInfo ().getServerPort ();
139151 }
140152}
0 commit comments