Commit Graph

613 Commits

Author SHA1 Message Date
Juergen Hoeller
fe3357d6b9 Polishing (backported) 2021-07-13 19:07:15 +02:00
Sam Brannen
90183568ba Deprecate internal APIs in ScriptUtils
Many of the utility methods in ScriptUtils are public only because they
were once invoked from JdbdTestUtils in spring-test, which is no longer
the case. Consequently, there should no longer be a need for any
external clients to invoke such methods.

To address, this commit formally deprecates the following methods in
ScriptUtils in spring-jdbc.

- readScript(...)
- containsSqlScriptDelimiters(...)
- splitSqlScript(...)

Closes gh-26947
2021-05-18 15:59:57 +02:00
Sam Brannen
b5ce514b27 Logically reorganize methods in ScriptUtils
See gh-26947
2021-05-18 15:47:39 +02:00
Sam Brannen
9ae6268a1a Polish ScriptUtils implementation 2021-05-14 15:18:26 +02:00
Sam Brannen
e4d843e41e Ignore comments when searching for statement delimiter in ScriptUtils
Prior to this commit, the implementation of
ScriptUtils.containsSqlScriptDelimiters() did not ignore comments when
searching for the statement delimiter within an SQL script. This
resulted in subtle bugs if a comment contained a single single-quote or
single double-quote, since the absence of the closing single-quote or
double-quote led the algorithm to believe that it was still "within a
text literal". Similar issues could arise if a comment contained the
sought statement delimiter but the rest of the script did not contain
the sought statement delimiter. In such cases, the algorithms in
ScriptUtils could erroneously choose an incorrect statement delimiter
-- for example, using the fallback statement delimiter instead of the
delimiter specified by the user.

This commit avoids such bugs by ignoring single-line comments and block
comments when searching for the statement delimiter within an SQL
script.

Closes gh-26911
2021-05-14 14:33:07 +02:00
Sam Brannen
22256966fb Ignore delimiter enclosed in double quotes in ScriptUtils
Prior to this commit, the containsSqlScriptDelimiters() method in
ScriptUtils ignored delimiters enclosed in single quotes but not those
enclosed within double quotes, which contradicts the algorithm in
splitSqlScript() and therefore constitutes a bug.

This commit fixes this bug in the ScriptUtils implementation in
spring-jdbc.

Closes gh-26935
2021-05-12 13:06:00 +02:00
Juergen Hoeller
4ae3ab14ec Avoid unnecessary wrapping for SqlParameterValue
Closes gh-26471
2021-02-15 11:49:59 +01:00
Sam Brannen
236623f630 Do not retain partial column metadata in SimpleJdbcInsert
Prior to this commit, if an SQLException was thrown while retrieving
column metadata from the database, SimpleJdbcInsert would generate an
INSERT statement that was syntactically valid but missing columns,
which could lead to data silently missing in the database (for nullable
columns).

This commit fixes this by clearing all collected column metadata if an
SQLException is thrown while processing the metadata. The result is
that an InvalidDataAccessApiUsageException will be thrown later while
generating the INSERT statement. The exception message now contains an
additional hint to make use of SimpleJdbcInsert#usingColumns() in order
to ensure that all required columns are included in the generated
INSERT statement.

SimpleJdbcCall can also encounter an SQLException while retrieving
column metadata for a stored procedure/function, but an exception is
not thrown since a later invocation of the stored procedure/function
will likely fail anyway due to missing arguments. Consequently, this
commit only improves the warning level log message by including a hint
to make use of SimpleJdbcCall#addDeclaredParameter().

Closes gh-26486
2021-02-03 18:53:32 +01:00
Sam Brannen
e18fba1626 Polishing 2021-02-03 18:52:15 +01:00
Juergen Hoeller
f011e58f90 Polishing 2020-12-17 11:05:58 +01:00
Juergen Hoeller
d8b7a593c5 Individually apply the SQL type from each SqlParameterSource argument
Closes gh-26071
2020-11-12 14:18:23 +01:00
Juergen Hoeller
7881329cf7 Polishing 2020-11-05 18:18:38 +01:00
Juergen Hoeller
d12996a6a8 Polishing 2020-10-26 18:18:33 +01:00
Juergen Hoeller
e028ef8170 Add MariaDB to the supported database products for functions as well
Closes gh-25811
2020-09-25 12:47:31 +02:00
Juergen Hoeller
392ad09990 Add MariaDB to the list of supported database products for procedures
Closes gh-25811
2020-09-25 11:25:05 +02:00
Juergen Hoeller
e797398b10 CallParameterMetaData detects function return parameter specifically
Closes gh-25588
2020-09-07 17:51:23 +02:00
Juergen Hoeller
939c76c4a5 Revise documentation notes on getParameterType performance issues
See gh-25679
2020-09-05 13:00:06 +02:00
Juergen Hoeller
40bf83c9e5 Restore original 4.x behavior for initialization of function return name
Closes gh-25707
2020-09-05 12:59:34 +02:00
Juergen Hoeller
670b9fd60b Retry SQLErrorCodesFactory retrieval if DatabaseMetaData access failed
Includes deprecation of JdbcUtils.extractDatabaseMetaData(DataSource, String) in favor of the now generified version of extractDatabaseMetaData(DataSource, DatabaseMetaDataCallback).

Closes gh-25681
Closes gh-25686
2020-09-03 19:16:14 +02:00
Juergen Hoeller
bb9e79daa7 Polishing 2020-08-28 19:58:56 +02:00
Juergen Hoeller
94eee6a32a Provide access to AbstractRoutingDataSource's resolved target DataSources
Closes gh-25544
2020-08-07 13:00:35 +02:00
Juergen Hoeller
43e315f10c Unwrap SqlParameterValue for disposable value detection in cleanupParameters
Closes gh-22972
2020-07-19 19:59:15 +02:00
Juergen Hoeller
30bf870810 Check JDBC 4 getFunctions (for compatibility with PostgreSQL driver 42.2.11)
Closes gh-25399
2020-07-17 17:47:53 +02:00
Juergen Hoeller
08474aa921 Clarify JDBC-defined negative values returned from batchUpdate
Closes gh-25138
2020-05-29 15:51:19 +02:00
Juergen Hoeller
27d5fdc5aa Polishing 2020-05-26 23:35:38 +02:00
Juergen Hoeller
4018b462f1 JdbcOperations polishing (backported from master) 2020-05-22 16:35:34 +02:00
Juergen Hoeller
fe33822fa7 Polishing 2020-05-14 00:23:20 +02:00
Juergen Hoeller
251501587b Consistent nullability of arguments array in JdbcOperations/Template
Closes gh-24839
2020-04-03 21:15:00 +02:00
Juergen Hoeller
6177e38eb6 Close-suppressing Connection proxy exposes target isClosed() state
Closes gh-24853
2020-04-03 21:13:53 +02:00
Sam Brannen
e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Qimiao Chen
7c831d2ef4 Replace anonymous inner classes with lambdas in tests
Closes gh-24808
2020-03-30 12:02:23 +02:00
Juergen Hoeller
910d2788e9 Polishing 2020-03-23 18:02:55 +01:00
Sam Brannen
5e1e689739 Polishing 2020-03-17 15:06:10 +01:00
Qimiao Chen
5f2e298c08 Extract isDebugEnabled() checks to local variables
Closes gh-24683
2020-03-16 15:25:05 +01:00
Juergen Hoeller
6db20eb773 Avoid package import cycles 2020-02-25 14:55:53 +01:00
Sam Brannen
c2367b3ad2 Polish contribution
See gh-24383
2020-02-04 14:48:13 +01:00
Hyunjin Choi
1acf5a7424 Use dedicated catch block for ScriptException
Closes gh-24383
2020-02-04 14:45:52 +01:00
Sam Brannen
7575616d26 Update copyright date
See gh-24385
2020-02-04 14:23:18 +01:00
Hyunjin Choi
b4cf88499c Use try-with-resource in ScriptUtils
Closes gh-24385
2020-02-04 14:21:59 +01:00
Juergen Hoeller
d93403a257 Alphabetical order for database names
See gh-24443
2020-01-28 21:06:04 +01:00
wilrosco
c86e164b03 Add Informix to the list of supported database products for procedure calls
Hi guys,

We're facing an issue in our application when we try to call a procedure in Informix database, 
our app uses standard JDBC (spring-jdbc and com.ibm.informix.jdbc.4.50.3) without Hibernate 
to connect to the database  

Issue:
When we trying to execute any procedure call in our Informix database there is no data returned.

Diagnostic:
It points to the Java class called CallMetaDataProviderFactory in spring-jdbc project.

Taking a look of this class there is no explicit support for Informix procedure calls, so I added "Informix Dynamic Server" to the 
list of supported databases and now I can execute procedures call without issues.

Basically I added the line "Informix Dynamic Server" to the list called "supportedDatabaseProductsForProcedures" 
of CallMetaDataProviderFactory class in my local environment and it worked as expected.


I really appreciate any feedback/suggestion for this approach due we would like to continue using the framework 
normally in our development without losing updates using a workaround in our end.

Many thanks in advance.
2020-01-28 20:57:52 +01:00
Juergen Hoeller
60c7af3625 Mention HikariCP next to DBCP and C3P0 in connection pool notes
Closes gh-24405
2020-01-24 14:54:02 +01:00
Sam Brannen
734db23f4e Fix Checkstyle violation
See gh-gh-24358
2020-01-15 14:09:11 +01:00
Sam Brannen
f527ca7515 Update copyright date 2020-01-15 14:04:50 +01:00
hyeonisism
89b8449999 Simplify getParsedSql() method in NamedParameterJdbcTemplate
Closes gh-24358
2020-01-15 14:01:38 +01:00
Sam Brannen
798744838c Revise exception handling in AbstractEmbeddedDatabaseConfigurer
See gh-24337
2020-01-13 12:51:31 +01:00
Sam Brannen
7cd4ddf5fc Rename test fixture package in spring-beans
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen
4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen
61d4ee594d Use Gradle test fixture support for spring-beans and spring-context
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen
5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00