Disallow non-parameterized queries for Bulk Copy API for batch insert#756
Disallow non-parameterized queries for Bulk Copy API for batch insert#756peterbae merged 22 commits intomicrosoft:devfrom
Conversation
| pstmt.addBatch(); | ||
|
|
||
| pstmt.executeBatch(); | ||
| throw new Exception("shouldn't come here."); |
There was a problem hiding this comment.
Can we throw "Test did not throw an exception when it was Expected" instead? I think there's existing tests that do this and we should be consistent.
Codecov Report
@@ Coverage Diff @@
## dev #756 +/- ##
============================================
+ Coverage 48.35% 48.43% +0.08%
- Complexity 2771 2806 +35
============================================
Files 116 116
Lines 27871 27853 -18
Branches 4631 4636 +5
============================================
+ Hits 13476 13490 +14
- Misses 12212 12225 +13
+ Partials 2183 2138 -45
Continue to review full report at Codecov.
|
| checkAdditionalQuery(); | ||
|
|
||
| String destinationTableName = tableName; | ||
| SQLServerStatement stmt = (SQLServerStatement) connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, |
There was a problem hiding this comment.
Statement is created here, and closed in next try's finally block? Better to put it in the next try-with-resources block along with ResultSet and remove finally block as it will have no purpose.
There was a problem hiding this comment.
that try block is closing the resultset. this statement is closed during finally.
There was a problem hiding this comment.
@peterbae , Why don't you just move statement creation to try-with-resources?
…/datetime/spatial datatype columns. added tests.
This reverts commit fd68988.
| @@ -2514,9 +2605,17 @@ private boolean checkAndRemoveComments() { | |||
| localUserSQL = localUserSQL.substring(temp); | |||
There was a problem hiding this comment.
int temp = localUserSQL.indexOf("\n") + 2;
It should be +1 here, not +2.
* Update Snapshot for upcoming RTW release v7.0.0 * Change order of logic for checking the condition for using Bulk Copy API (#736) Fix | Change order of logic for checking the condition for using Bulk Copy API (#736) * Update CHANGELOG.md * Merge pull request #732 from cheenamalhotra/module (Export driver in automatic module) Introduce Automatic Module Name in POM. * Update CHANGELOG.md * Change Sha1HashKey to CityHash128Key for generating PreparedStatement handle and metadata cache keys (#717) * Change Sha1HashKey to CityHash128Key * Formatted code * Prepared statement performance fixes 1) Further speedups to prepared statement hashing 2) Caching of '?' chararacter positiobs in prepared statements to speed parameter substitution * String compare for hash keys added missing line for bulkcopy tests. * comment change * Move CityHash class to a separate file * spacings fixes cleaner code & logic * Add | Adding useBulkCopyForBatchInsert property to Request Boundary methods (#739) * Apply the collation name change to UTF8SupportTest * Package changes for CityHash with license information (#740) * Reformatted Code + Updated formatter (#742) * Reformatted Code + Updated formatter * Fix policheck issue with 'Country' keyword (#745) * Adding a new test for beginRequest()/endRequest() (#746) * Add | Adding a new test to notify the developers to consider beginRequest()/endRequest() when adding a new Connection API * Fix | Fixes for issues reported by static analysis tools (SonarQube + Fortify) (#747) * handle buffer reading for invalid buffer input by user * Revert "handle buffer reading" This reverts commit 11e2bf4. * updated javadocs (#754) * fixed some typos in javadocs (#760) * API and JavaDoc changes for Spatial Datatypes (#752) Add | API and JavaDoc changes for Spatial Datatypes (#752) * Disallow non-parameterized queries for Bulk Copy API for batch insert (#756) fix | Disallow non-parameterized queries for Bulk Copy API for batch insert (#756) * Formatting | Change scope of unwanted Public APIs + Code Format (#757) * Fix unwanted Public APIs. * Updated formatter to add new line to EOF + formatted project * Release | Release 7.0 changelog and version update (#748) * Updated Changelog + release version changes * Changelog entry updated as per review. * Updated changelog for new changes * Terminology update: request boundary declaration APIs * Trigger Appveyor * Update Samples and add new samples for new features (#761) * Update Samples and add new Samples for new features * Update samples from Peter * Updated JavaDocs * Switch to block comment * Update License copyright (#767)
As for the error messages, I am throwing an illegalArgumentException but it gets caught and gets turned into a logging message, so this part doesn't need translation into other languages.