1 | /** | | 1 | public String toStatementString() { |
2 | * Returns additional display text for the AST node. | | 2 | StringBuffer buf = new StringBuffer( columns.size()*15 + tableName.length() + 10 ); |
3 | * | | 3 | if ( comment != null ) { |
4 | * @return String - The additional display text. | | 4 | buf.append( "/* " ).append( comment ).append( " */ " ); |
5 | */ | | 5 | } |
6 | public String getDisplayText() { | | 6 | buf.append("insert into ") |
7 | StringBuffer buf = new StringBuffer(); | | 7 | .append(tableName); |
8 | if ( getWalker().getQuerySpaces().size() > 0 ) { | | 8 | if ( columns.size()==0 ) { |
9 | buf.append( " querySpaces (" ); | | 9 | buf.append(' ').append( dialect.getNoColumnsInsertString() ); |
10 | for ( Iterator iterator = getWalker().getQuerySpaces().iterator(); iterator.hasNext(); ) { | | 10 | } |
11 | buf.append( iterator.next() ); | | 11 | else { |
12 | if ( iterator.hasNext() ) { | | 12 | buf.append(" ("); |
13 | buf.append( "," ); | | 13 | Iterator iter = columns.keySet().iterator(); |
14 | } | | 14 | while ( iter.hasNext() ) { |
15 | } | | 15 | buf.append( iter.next() ); |
16 | buf.append( ")" ); | | 16 | if ( iter.hasNext() ) { |
17 | } | | 17 | buf.append( ", " ); |
18 | return buf.toString(); | | 18 | } |
19 | } | | 19 | } |
| | | 20 | buf.append(") values ("); |
| | | 21 | iter = columns.values().iterator(); |
| | | 22 | while ( iter.hasNext() ) { |
| | | 23 | buf.append( iter.next() ); |
| | | 24 | if ( iter.hasNext() ) { |
| | | 25 | buf.append( ", " ); |
| | | 26 | } |
| | | 27 | } |
| | | 28 | buf.append(')'); |
| | | 29 | } |
| | | 30 | return buf.toString(); |
| | | 31 | } |