Commit Graph

264 Commits

Author SHA1 Message Date
Thomas Risberg 9fb6e2313c Fix single quote parsing in NamedParameterUtils
Prior to this change, single quotes were incorrectly parsed by
NamedParameterUtils#parseSqlStatement, resulting in incorrect parameter
counts:

    ParsedSql sql = NamedParameterUtils
            .parseSqlStatement("SELECT 'foo''bar', :xxx FROM DUAL");
    assert sql.getTotalParameterCount() == 0 // incorrect, misses :xxx

That is, presence of the single-quoted string caused the parser to
overlook the named parameter :xxx.

This commit fixes the parsing error such that:

    ParsedSql sql = NamedParameterUtils
            .parseSqlStatement("SELECT 'foo''bar', :xxx FROM DUAL");
    assert sql.getTotalParameterCount() == 1 // correct

Issue: SPR-8280
2012-02-06 09:47:17 +01:00
Thomas Risberg 2ffa4725cd Allow SELECT statements in ResourceDatabasePopulator
ResourceDatabasePopulator is a component that underlies the database
initialization support within Spring's jdbc: namespace, e.g.:

    <jdbc:initialize-database data-source="dataSource">
        <jdbc:script execution="INIT" location="classpath:init.sql"/>
    </jdbc:initialize-database>

Prior to this commit, ResourceDatabasePopulator#executeSqlScript's use
of Statement#executeUpdate(sql) precluded the possibility of SELECT
statements because returning a result is not permitted by this method
and results in an exception being thrown.

Whether this behavior is a function of the JDBC specification or an
idiosyncracy of certain implementations does not matter as the issue
can be worked around entirely. This commit eliminates use
of #executeUpdate(sql) in favor of #execute(sql) followed by a call
to #getUpdateCount, effectively allowing any kind of SQL statement to
be executed during database initialization.

Issue: SPR-8932
2012-02-06 08:59:28 +01:00
Chris Beams 87a021d5c9 Add <license> section to 3.1.x Maven poms
Issue: SPR-8927
2012-01-31 15:18:05 +01:00
Juergen Hoeller adac38f91b fixed documented bean class names in jdbc namespace xsd (SPR-8972) 2012-01-05 17:38:01 +01:00
Juergen Hoeller 211f8ea854 JBossNativeJdbcExtractor is compatible with JBoss AS 7 as well (SPR-8957) 2012-01-05 17:37:59 +01:00
Chris Beams 41c405998e Convert CRLF=>LF on files missed earlier
Complete pass with `dos2unix` found additional files missed on earlier
related commit.

Issue: SPR-5608
2011-12-22 14:06:44 +01:00
Chris Beams 88913f2b23 Convert CRLF (dos) to LF (unix)
Prior to this change, roughly 5% (~300 out of 6000+) of files under the
source tree had CRLF line endings as opposed to the majority which have
LF endings.

This change normalizes these files to LF for consistency going forward.

Command used:

$ git ls-files | xargs file | grep CRLF | cut -d":" -f1 | xargs dos2unix

Issue: SPR-5608
2011-12-21 14:52:47 +01:00
Chris Beams e158f61e93 Increment version to 3.1.1.BUILD-SNAPSHOT 2011-12-16 11:59:06 +01:00
Chris Beams ac107d0c2a Release Spring Framework 3.1.0.RELEASE 2011-12-13 16:35:49 +00:00
Juergen Hoeller 1141a1d610 polishing 2011-12-11 23:07:07 +00:00
Chris Beams 70c28a0bc5 Add Apache license header where missing in src/main 2011-11-16 18:23:56 +00:00
Chris Beams 7b491370a3 Polish EmbeddedDatabaseBuilder
Minor improvements made during the triage of SPR-8817
2011-11-13 01:38:47 +00:00
Juergen Hoeller b21e1ee669 polishing 2011-11-11 09:57:34 +00:00
Thomas Risberg dee9e280b0 SPR-7476 Improving named parameter parsing skipping escaped colons like '\:' and allowing for delimiting parameter names with curly brackets like :{p1} 2011-10-08 12:48:26 +00:00
Thomas Risberg 933e22320d SPR-7476 Improving named parameter parsing skipping escaped colons like '\:' and allowing for delimiting parameter names with curly brackets like :{p1} 2011-10-08 12:10:56 +00:00
Thomas Risberg 4f5248bb5c SPR-7476 Improving named parameter parsing skipping escaped colons like '\:' and allowing for delimiting parameter names with curly brackets like :{p1} 2011-10-08 11:48:45 +00:00
Thomas Risberg aec82fbd4a SPR-7476 Improving named parameter parsing skipping escaped colons like '\:' and allowing for delimiting parameter names with curly brackets like :{p1} 2011-10-07 18:57:32 +00:00
Thomas Risberg 92d6e5a14c SPR-8270 Adding improved support for detecting current schema name for Oracle 2011-10-07 03:01:43 +00:00
Thomas Risberg 118ee3fce8 SPR-8652 Fixing queryForLong and queryForInt implementation to use correct expected type 2011-10-06 23:58:38 +00:00
Thomas Risberg 0920f2d7d5 SPR-8235 SPR-7480 Updating H2 error codes 2011-10-06 23:19:05 +00:00
Chris Beams 4e522c0cc3 Fix Javadoc error in JdbcOperations
Issue: SPR-8664
2011-09-03 20:07:08 +00:00
Sam Brannen 1de71c6e37 [SPR-8222] Upgraded to JUnit 4.9. 2011-08-30 13:16:12 +00:00
Sam Brannen 87dad65ff0 [SPR-8622] Upgraded to JUnit 4.8.2 2011-08-18 16:06:31 +00:00
David Syer 296099f222 SPR-8592: add SpEL support in <jdbc:/> 2011-08-09 10:17:10 +00:00
Juergen Hoeller bbcf358a9d jdbc:script's "separator" and "execution" attributes work nested with embedded-database as well; added "encoding" attribute to jdbc:script element; general revision of DatabasePopulator configuration and execution code 2011-07-28 14:19:53 +00:00
Juergen Hoeller e63e6cdbde polishing 2011-07-27 21:57:59 +00:00
Juergen Hoeller 19c2672dc3 polishing 2011-07-27 21:52:18 +00:00
Juergen Hoeller 4a11765dfd avoid Logger.getGlobal() - it's Java 7 only... 2011-06-09 23:15:27 +00:00
Juergen Hoeller e1d81e04bc prepared Spring's DataSource and RowSet adapters for forward compatibility with JDBC 4.1 2011-06-09 23:09:55 +00:00
Juergen Hoeller c60511bf04 shortened build properties "org.junit.version" to "junit.version" and "org.testng.version" to "testng.version"; reverted SLF4J version back to 1.5.3 (for Hibernate 3.3.1 compatibility) 2011-06-09 09:58:15 +00:00
David Syer 6933a1af28 SPR-6717: Added support for database destroy scripts 2011-06-06 07:28:25 +00:00
Thomas Risberg 97e047ed66 added check for existing configuration of generated keys before calling update with a KeyHolder. (SPR-7564) 2011-06-06 00:52:01 +00:00
Thomas Risberg 189cc262ad updated codes for Sybase (SPR-8125) 2011-06-05 19:05:06 +00:00
Thomas Risberg 0adcb2ad2e Added batchUpdate method taking a Collection, a batch size and a ParameterizedPreparedStatementSetter as arguments (SPR-6334) 2011-06-05 16:42:24 +00:00
Sam Brannen bfecedf5e2 Reverted Dave's changes to Eclipse project settings since we do not use Maven to build. 2011-06-02 17:59:52 +00:00
David Syer 14edc9fc03 SPR-7364: added separator property to database populator to deal with things like PL/SQL 2011-06-02 16:22:26 +00:00
David Syer 645631ad2e SPR-6688: Add tests and explicit detection of \ in sql script extractor 2011-06-02 14:28:58 +00:00
Thomas Risberg f5f738f2b4 SPR-6922 deprecated SimpleJdbcTemplate/SimpleJdbcOperations/SimpleJdbcDaoSupport in favor of JdbcTemplate/NamedParameterJdbcTemplate and related interfaces support classes 2011-04-14 18:44:40 +00:00
Thomas Risberg 939da34869 switched to create the PreparedStatementCreatorFactory using a list of SqlParameters to preserve type names (SPR-7699) 2011-02-09 13:58:30 +00:00
Chris Beams 2f7c2230f0 Include license.txt and notice.txt in module JARs 2011-02-09 06:56:40 +00:00
Chris Beams b3ff9be78f M1 cut of environment, profiles and property work (SPR-7508)
Decomposed Environment interface into PropertySources, PropertyResolver
objects

    Environment interface and implementations are still present, but
    simpler.

    PropertySources container aggregates PropertySource objects;
    PropertyResolver provides search, conversion, placeholder
    replacement. Single implementation for now is
    PropertySourcesPlaceholderResolver

Renamed EnvironmentAwarePropertyPlaceholderConfigurer to
PropertySourcesPlaceholderConfigurer

    <context:property-placeholder/> now registers PSPC by default, else
    PPC if systemPropertiesMode* settings are involved

Refined configuration and behavior of default profiles

    See Environment interface Javadoc for details

Added Portlet implementations of relevant interfaces:

    * DefaultPortletEnvironment
    * PortletConfigPropertySource, PortletContextPropertySource
    * Integrated each appropriately throughout Portlet app contexts

Added protected 'createEnvironment()' method to AbstractApplicationContext

    Subclasses can override at will to supply a custom Environment
    implementation.  In practice throughout the framework, this is how
    Web- and Portlet-related ApplicationContexts override use of the
    DefaultEnvironment and swap in DefaultWebEnvironment or
    DefaultPortletEnvironment as appropriate.

Introduced "stub-and-replace" behavior for Servlet- and Portlet-based
PropertySource implementations

    Allows for early registration and ordering of the stub, then
    replacement with actual backing object at refresh() time.

    Added AbstractApplicationContext.initPropertySources() method to
    support stub-and-replace behavior. Called from within existing
    prepareRefresh() method so as to avoid impact with
    ApplicationContext implementations that copy and modify AAC's
    refresh() method (e.g.: Spring DM).

    Added methods to WebApplicationContextUtils and
    PortletApplicationContextUtils to support stub-and-replace behavior

Added comprehensive Javadoc for all new or modified types and members

Added XSD documentation for all new or modified elements and attributes

    Including nested <beans>, <beans profile="..."/>, and changes for
    certain attributes type from xsd:IDREF to xsd:string

Improved fix for detecting non-file based Resources in
PropertiesLoaderSupport (SPR-7547, SPR-7552)

    Technically unrelated to environment work, but grouped in with
    this changeset for convenience.

Deprecated (removed) context:property-placeholder
'system-properties-mode' attribute from spring-context-3.1.xsd

    Functionality is preserved for those using schemas up to and including
    spring-context-3.0.  For 3.1, system-properties-mode is no longer
    supported as it conflicts with the idea of managing a set of property
    sources within the context's Environment object. See Javadoc in
    PropertyPlaceholderConfigurer, AbstractPropertyPlaceholderConfigurer
    and PropertySourcesPlaceholderConfigurer for details.

Introduced CollectionUtils.toArray(Enumeration<E>, A[])

Work items remaining for 3.1 M2:

    Consider repackaging PropertySource* types; eliminate internal use
    of SystemPropertyUtils and deprecate

    Further work on composition of Environment interface; consider
    repurposing existing PlaceholderResolver interface to obviate need
    for resolve[Required]Placeholder() methods currently in Environment.

    Ensure configurability of placeholder prefix, suffix, and value
    separator when working against an AbstractPropertyResolver

    Add JNDI-based Environment / PropertySource implementatinos

    Consider support for @Profile at the @Bean level

    Provide consistent logging for the entire property resolution
    lifecycle; consider issuing all such messages against a dedicated
    logger with a single category.

    Add reference documentation to cover the featureset.
2011-01-03 09:04:34 +00:00
Sam Brannen b130a36af7 [SPR-7850][SPR-7851] Upgraded to JUnit 4.8.1 and TestNG 5.12.1; added changelog entries for 3.1.0.M1. 2010-12-30 08:00:58 +00:00
Chris Beams f480333d31 Merge 3.1.0 development branch into trunk
Branch in question is 'env' branch from git://git.springsource.org/sandbox/cbeams.git; merged into
git-svn repository with:

    git merge -s recursive -Xtheirs --no-commit env

No merge conflicts, but did need to

    git rm spring-build

prior to committing.

With this change, Spring 3.1.0 development is now happening on SVN
trunk. Further commits to the 3.0.x line will happen in an as-yet
uncreated SVN branch.  3.1.0 snapshots will be available
per the usual nightly CI build from trunk.
2010-10-25 19:48:20 +00:00
Thomas Risberg 171f1ee097 added additional parameter name matching using lowercase with Locale.ENGLISH (SPR-7658) 2010-10-15 15:56:59 +00:00
Juergen Hoeller 5da5fc6499 polishing 2010-10-15 08:44:03 +00:00
Juergen Hoeller 0f924820e8 revised OracleTableMetaDataProvider for reliable Oracle Connection detection; autodetect JdbcTemplate's NativeJdbcExtractor (SPR-7611) 2010-10-14 21:25:14 +00:00
Thomas Risberg bd22bed10a added a SybaseAnywhereMaxValueIncrementer since syntax is slightly different than for Sybase ASE (SPR-7623) 2010-10-11 14:17:09 +00:00
Juergen Hoeller ccded10d86 added configurable Connection/Statement/ResultSet target types to Jdbc4NativeJdbcExtractor (SPR-7613); added OracleJdbc4NativeJdbcExtractor with pre-configured Oracle JDBC API types 2010-10-09 23:04:50 +00:00
Juergen Hoeller 2433feab09 fixed embedded database exception test 2010-10-09 13:29:22 +00:00
Juergen Hoeller be04aca037 consistent handling of unwrap/isWrapperFor/isClosed in JDBC proxies 2010-10-09 12:38:37 +00:00