File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/dialect/Oracle9Dialect.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java | |||
Method name: String getLimitString(String, boolean)
|
Method name: String getLimitString(String, boolean)
|
|||
Number of AST nodes: 16 | Number of AST nodes: 16 | |||
1 | sql = sql.trim();↵ | 1 | sql = sql.trim();↵ | |
2 | boolean isForUpdate = false;↵ | 2 | boolean isForUpdate = false;↵ | |
3 | if ( sql.toLowerCase().endsWith(" for update") ) {↵ | 3 | if ( sql.toLowerCase().endsWith(" for update") ) {↵ | |
4 | sql = sql.substring( 0, sql.length()-11 );↵ | 4 | sql = sql.substring( 0, sql.length()-11 );↵ | |
5 | isForUpdate = true;↵ | 5 | isForUpdate = true;↵ | |
6 | }↵ | 6 | }↵ | |
7 | ↵ | |||
8 | StringBuffer pagingSelect = new StringBuffer( sql.length()+100 );↵ | 7 | StringBuffer pagingSelect = new StringBuffer( sql.length()+100 );↵ | |
9 | if (hasOffset) {↵ | 8 | if (hasOffset) {↵ | |
10 | pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");↵ | 9 | pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");↵ | |
11 | }↵ | 10 | }↵ | |
12 | else {↵ | 11 | else {↵ | |
13 | pagingSelect.append("select * from ( ");↵ | 12 | pagingSelect.append("select * from ( ");↵ | |
14 | }↵ | 13 | }↵ | |
15 | pagingSelect.append(sql);↵ | 14 | pagingSelect.append(sql);↵ | |
16 | if (hasOffset) {↵ | 15 | if (hasOffset) {↵ | |
17 | pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?");↵ | 16 | pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?");↵ | |
18 | }↵ | 17 | }↵ | |
19 | else {↵ | 18 | else {↵ | |
20 | pagingSelect.append(" ) where rownum <= ?");↵ | 19 | pagingSelect.append(" ) where rownum <= ?");↵ | |
21 | }↵ | 20 | }↵ | |
22 | if ( isForUpdate ) {↵ | 21 | if ( isForUpdate ) {↵ | |
23 | pagingSelect.append( " for update" );↵ | 22 | pagingSelect.append( " for update" );↵ | |
24 | }↵ | 23 | }↵ | |
25 | ↵ | |||
26 | return pagingSelect.toString(); | 24 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 73 |
Number of mapped statements | 16 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 3.9 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | sql = sql.trim(); | 1 | sql = sql.trim(); | |
2 | boolean isForUpdate = false; | 2 | boolean isForUpdate = false; | |
3 | if (sql.toLowerCase().endsWith(" for update")) | 3 | if (sql.toLowerCase().endsWith(" for update")) | |
4 | sql = sql.substring(0, sql.length() - 11); | 4 | sql = sql.substring(0, sql.length() - 11); | |
5 | isForUpdate = true; | 5 | isForUpdate = true; | |
6 | StringBuffer pagingSelect = new StringBuffer(sql.length() + 100); | 6 | StringBuffer pagingSelect = new StringBuffer(sql.length() + 100); | |
7 | if (hasOffset) | 7 | if (hasOffset) | |
8 | pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( "); | 8 | pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( "); | |
else | else | |||
9 | pagingSelect.append("select * from ( "); | 9 | pagingSelect.append("select * from ( "); | |
10 | pagingSelect.append(sql); | 10 | pagingSelect.append(sql); | |
11 | if (hasOffset) | 11 | if (hasOffset) | |
12 | pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?"); | 12 | pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?"); | |
else | else | |||
13 | pagingSelect.append(" ) where rownum <= ?"); | 13 | pagingSelect.append(" ) where rownum <= ?"); | |
14 | if (isForUpdate) | 14 | if (isForUpdate) | |
15 | pagingSelect.append(" for update"); | 15 | pagingSelect.append(" for update"); | |
16 | return pagingSelect.toString(); | 16 | return pagingSelect.toString(); |
Row | Violation |
---|