-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: optimize PreparedStatementProxy initialization logic #2242
Conversation
@CharmingRabbit please resolve conflict. |
Codecov Report
@@ Coverage Diff @@
## develop #2242 +/- ##
=============================================
- Coverage 50.22% 50.16% -0.06%
Complexity 3026 3026
=============================================
Files 598 598
Lines 19314 19311 -3
Branches 2348 2347 -1
=============================================
- Hits 9700 9688 -12
- Misses 8652 8664 +12
+ Partials 962 959 -3
|
|
@@ -50,7 +50,7 @@ public OracleOutputVisitor createOutputVisitor(final ParametersHolder parameters | |||
@Override | |||
public boolean visit(SQLVariantRefExpr x) { | |||
if ("?".equals(x.getName())) { | |||
ArrayList<Object> oneParamValues = parametersHolder.getParameters()[x.getIndex()]; | |||
ArrayList<Object> oneParamValues = parametersHolder.getParameters().get(x.getIndex()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if need index+1 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, my fault.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected,please take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ⅰ. Describe what this PR did
Change the data structure of ParameterHolder from 2 Dimension Array to Map so that we don't need to execute getParameterCount() while initializing PreparedStatementProxy,which will execute an additional business independent SQL query.
A further explanation of the present deficiencies:
If the ParameterHolder uses ArrayList as storage structure, the method "targetStatement.getParameterMetaData ().getparametercount()" will be executed when initializing parameterholder to determine the size of the ArrayList. In some database drivers (such as postgressql), this method will execute a database query, which will lead to performance degradation. In addition, this method may throw a SQLException , if that happen , the Exception that was thrown before the real business SQL will lead to an error that is hard to understand for the users.
Ⅱ. Does this pull request fix one issue?
fixes #2394
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews