File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/exec/MultiTableDeleteExecutor.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/exec/MultiTableUpdateExecutor.java | |||
Method name: int execute(QueryParameters, SessionImplementor)
|
Method name: int execute(QueryParameters, SessionImplementor)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 7 | |||
1 | try {↵ | 1 | try {↵ | |
2 | ps = session.getBatcher().prepareStatement( idInsertSelect );↵ | 2 | ps = session.getBatcher().prepareStatement( idInsertSelect );↵ | |
3 | Iterator paramSpecification↵ | 3 | // int parameterStart = getWalker().getNumberOfParametersInSetClause();↵ | |
4 | // List allParams = getIdSelectParameterSpecifications();↵ | |||
5 | // Iterator whereParams = allParams.subList( parameterStart, allParams.size() ).iterator();↵ | |||
4 | s = getIdSelectParameterSpecifications().iterator();↵ | 6 | Iterator whereParams = getIdSelectParameterSpecifications().iterator();↵ | |
5 | int pos = 1;↵ | 7 | int sum = 1;↵ | |
6 | while ( paramSpecifications.hasNext() ) {↵ | |||
7 | final ParameterSpecification paramSpec = ( ParameterSpecification ) paramSpecifications.next();↵ | |||
8 | pos += paramSpec↵ | 8 | // jdbc params are 1-based↵ | |
9 | while ( whereParams.hasNext() ) {↵ | |||
9 | .bind( ps, parameters, session, pos );↵ | 10 | sum += ( ( ParameterSpecification ) whereParams.next() ).bind( ps, parameters, session, sum );↵ | |
10 | }↵ | 11 | }↵ | |
11 | resultCount = ps.executeUpdate();↵ | 12 | resultCount = ps.executeUpdate();↵ | |
12 | }↵ | 13 | }↵ | |
13 | finally {↵ | 14 | finally {↵ | |
14 | if ( ps != null ) {↵ | 15 | if ( ps != null ) {↵ | |
15 | session.getBatcher().closeStatement( ps );↵ | 16 | session.getBatcher().closeStatement( ps );↵ | |
16 | }↵ | 17 | }↵ | |
17 | } | 18 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 32 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 27.2 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | try | 7 | try | |||||||||||||||||||
8 | ps = session.getBatcher().prepareStatement(idInsertSelect); | 8 | ps = session.getBatcher().prepareStatement(idInsertSelect); | |||||||||||||||||||
9 | Iterator paramSpecifications = getIdSelectParameterSpecifications().iterator(); |
| 9 | Iterator whereParams = getIdSelectParameterSpecifications().iterator(); | ||||||||||||||||||
10 | int pos = 1; |
| 10 | int sum = 1; | ||||||||||||||||||
11 | while (paramSpecifications.hasNext()) |
| 11 | while (whereParams.hasNext()) | ||||||||||||||||||
12 | final ParameterSpecification paramSpec = (ParameterSpecification)paramSpecifications.next(); |
| | |||||||||||||||||||
13 | pos += paramSpec.bind(ps, parameters, session, pos); |
| 12 | sum += ((ParameterSpecification)whereParams.next()).bind(ps, parameters, session, sum); | ||||||||||||||||||
14 | resultCount = ps.executeUpdate(); | 13 | resultCount = ps.executeUpdate(); |
Row | Violation |
---|---|
1 | Unmatched statement final ParameterSpecification paramSpec=(ParameterSpecification)paramSpecifications.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression paramSpec cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression ((ParameterSpecification)whereParams.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Clone fragment #1 returns variables paramSpecifications, ps, resultCount , while Clone fragment #2 returns variables ps, resultCount |