Revision 47779

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/swing/pickercontroller/impl/EnvelopePickerControllerImpl.java
5 5
import java.awt.Image;
6 6
import java.awt.event.ActionEvent;
7 7
import java.net.URL;
8
import java.util.function.Supplier;
8 9
import javax.swing.ImageIcon;
9 10
import javax.swing.JButton;
10 11
import javax.swing.JTextField;
......
92 93
    }
93 94
    
94 95

  
95
    private final MapControl mapControl;
96
    private final Supplier<MapControl> mapControl;
96 97
    private final JTextField txtUpperLeftX;
97 98
    private final JTextField txtUpperLeftY;
98 99
    private final JTextField txtLowerRightX;
......
106 107
    private String previosTool;
107 108
    
108 109
    public EnvelopePickerControllerImpl(
109
            MapControl mapControl,
110
            Supplier<MapControl> mapControl,
110 111
            JTextField txtUpperLeftX, 
111 112
            JTextField txtUpperLeftY, 
112 113
            JTextField txtLowerRightX, 
......
127 128
    }
128 129
    
129 130
    public EnvelopePickerControllerImpl(
130
            MapControl mapControl,
131
            Supplier<MapControl> mapControl,
131 132
            JTextComponent txtEnvelope, 
132 133
            JButton btnMapControlEnvelope, 
133 134
            final JToggleButton btnCapture
......
147 148
    private void initComponents() {
148 149
        ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager();
149 150
        I18nManager i18n = ToolsLocator.getI18nManager();
151
        MapControl theMapControl = this.getMapControl();
150 152
        this.captureCursor = new ImageIcon(this.getIcon("picker-envelope-cursor-capture").getImage());
151 153
        
152 154
        if( this.btnCapture!=null ) {
......
171 173
            });
172 174
            this.btnMapControlEnvelope.setEnabled(this.mapControl!=null);
173 175
        }
174
        if( this.mapControl!=null ) {
176
        if( theMapControl!=null ) {
175 177
            this.captureTool = new RectangleBehavior(new CaptureEnvelopeListener());
176
            this.mapControl.addBehavior("picker-envelope-capture", captureTool);
177
            this.previosTool = this.mapControl.getCurrentTool();
178
            theMapControl.addBehavior("picker-envelope-capture", captureTool);
179
            this.previosTool = this.mapControl.get().getCurrentTool();
178 180
        }
179 181
        
180 182
        if( this.txtEnvelope==null ) {
......
214 216
    }
215 217
            
216 218
    protected void doSetEnvelopeFromMapControlEnvelope() {
217
        if( !this.isEditable() || mapControl==null ) {
219
        MapControl theMapControl = this.getMapControl();
220
        if( !this.isEditable() || theMapControl==null ) {
218 221
            return;
219 222
        }
220 223
        try {
221
            Envelope env = this.mapControl.getViewPort().getEnvelope();
224
            Envelope env = theMapControl.getViewPort().getEnvelope();
222 225
            if( env == null ) {
223 226
                return;
224 227
            }
......
229 232
        }
230 233
    }
231 234
    
235
    
232 236
    protected void doCaptureEnvelope(boolean enabled) {
233
        if( !this.isEditable() || mapControl==null ) {
237
        MapControl theMapControl = this.getMapControl();
238
        if( !this.isEditable() || theMapControl==null ) {
234 239
            return;
235 240
        }
236
        Envelope env = this.mapControl.getViewPort().getEnvelope();
241
        
242
        Envelope env = theMapControl.getViewPort().getEnvelope();
237 243
        if( env == null ) {
238 244
            return;
239 245
        }
240 246
        if( enabled ) {
241
            this.previosTool = this.mapControl.getCurrentTool();
242
            this.mapControl.setTool("picker-envelope-capture");
247
            this.previosTool = theMapControl.getCurrentTool();
248
            theMapControl.setTool("picker-envelope-capture");
243 249
        } else {
244
            this.mapControl.setTool(this.previosTool);
250
            theMapControl.setTool(this.previosTool);
245 251
        }
246 252
    }
247 253

  
......
344 350
                return null;
345 351
            }
346 352
        }
347
        if( this.mapControl!=null ) {
348
            envelope.setProjection(this.mapControl.getProjection());
353
        MapControl theMapControl = this.getMapControl();
354
        if( theMapControl!=null ) {
355
            envelope.setProjection(theMapControl.getProjection());
349 356
        }
350 357
        return envelope;
351 358
    }
......
438 445
        fireChangeEvent();
439 446
    }
440 447

  
441
    
448

  
449
    private MapControl getMapControl() {
450
        if( this.mapControl == null ) {
451
            return null;
452
        }
453
        return this.mapControl.get();
454
    }
442 455
}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/MapControlManager.java
52 52

  
53 53
import java.util.Map;
54 54
import java.util.function.Predicate;
55
import java.util.function.Supplier;
55 56
import java.util.prefs.Preferences;
56 57
import javax.swing.JButton;
57 58
import javax.swing.JComboBox;
......
299 300
            final JToggleButton btnCapture
300 301
    );
301 302

  
303
    public PickerController<Envelope> createEnvelopePickerController(
304
            Supplier<MapControl> mapControl,
305
            JTextComponent txtEnvelope, 
306
            JButton btnMapControlEnvelope, 
307
            final JToggleButton btnCapture
308
    );
309

  
302 310
    public PickerController<Double> createScalePickerController(
303 311
            MapControl mapControl,
304 312
            JComboBox cboScale, 
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/impl/DefaultMapControlManager.java
36 36
import java.util.Map;
37 37
import java.util.Set;
38 38
import java.util.function.Predicate;
39
import java.util.function.Supplier;
39 40
import java.util.prefs.Preferences;
40 41
import javax.swing.JButton;
41 42
import javax.swing.JComboBox;
......
413 414
            JButton btnMapControlEnvelope, 
414 415
            JToggleButton btnCapture
415 416
        ) {
416
        EnvelopePickerControllerImpl controller = new EnvelopePickerControllerImpl(mapControl, txtUpperLeftX, 
417
                txtUpperLeftY, txtLowerRightX, txtLowerRightY,
418
                btnMapControlEnvelope, btnCapture
417
        EnvelopePickerControllerImpl controller = new EnvelopePickerControllerImpl(
418
                () -> mapControl, 
419
                txtUpperLeftX, 
420
                txtUpperLeftY, 
421
                txtLowerRightX, 
422
                txtLowerRightY,
423
                btnMapControlEnvelope, 
424
                btnCapture
419 425
        );
420 426
        return controller;
421 427
    }
......
427 433
            JButton btnMapControlEnvelope, 
428 434
            JToggleButton btnCapture
429 435
        ) {
436
        return this.createEnvelopePickerController(
437
                () -> mapControl, 
438
                txtEnvelope, 
439
                btnMapControlEnvelope, 
440
                btnCapture
441
        );
442
    }
443
    
444
    @Override
445
    public EnvelopePickerControllerImpl createEnvelopePickerController(
446
            Supplier<MapControl> mapControl, 
447
            JTextComponent txtEnvelope, 
448
            JButton btnMapControlEnvelope, 
449
            JToggleButton btnCapture
450
        ) {
430 451
        EnvelopePickerControllerImpl controller = new EnvelopePickerControllerImpl(
431 452
                mapControl, 
432 453
                txtEnvelope, 
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/JDBCStoreProviderBase.java
677 677
    
678 678
    @Override
679 679
    public void beginAppend() throws DataException {
680
        this.beginAppend(FeatureStore.SUBMODE_NONE);
681
    }
682

  
683
    @Override
684
    public void beginAppend(int submode) throws DataException {
680 685
        if( this.appendOperation == null ) {
681 686
            this.appendOperation = createAppendOperation();
682 687
        }
683
        this.appendOperation.begin();
688
        this.appendOperation.begin(submode);
684 689
    }
685

  
690
    
686 691
    @Override
687 692
    public void append(final FeatureProvider featureProvider) throws DataException {
688 693
        this.appendOperation.append(featureProvider);
......
819 824
//        }
820 825
        super.refresh(); 
821 826
    }
822
    
827

  
823 828
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/operations/AppendOperation.java
31 31
import org.gvsig.expressionevaluator.GeometryExpressionBuilder;
32 32
import org.gvsig.fmap.dal.exception.DataException;
33 33
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
34
import static org.gvsig.fmap.dal.feature.FeatureStore.SUBMODE_MERGE;
35
import static org.gvsig.fmap.dal.feature.FeatureStore.SUBMODE_NONE;
34 36
import org.gvsig.fmap.dal.feature.FeatureType;
35 37
import org.gvsig.fmap.dal.feature.exception.AlreadyEditingException;
36 38
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
......
46 48
import org.slf4j.LoggerFactory;
47 49

  
48 50

  
51
@SuppressWarnings("UseSpecificCatch")
49 52
public class AppendOperation {
50 53
    protected static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(AppendOperation.class);
51 54
    
......
78 81
            this.disposableParameters = null;
79 82
        }
80 83
    }
81
    
82
    public void begin() throws DataException {
84
        
85
    public void begin(int submode) throws DataException {
83 86
        if (this.sqlbuilder != null) {
84 87
            throw new AlreadyEditingException(this.helper.getSourceId());
85 88
        }
86 89

  
87 90
        try {
88 91
            this.connection = this.helper.getConnectionWritable();
92
            switch(submode) {
93
                case SUBMODE_MERGE:
94
                    this.insertSQL = this.getMergeSQL();
95
                    break;
96
                case SUBMODE_NONE:
97
                default:
98
                    this.insertSQL = this.getInsertSQL();
99
                    break;
100
            }
89 101
            
102
            if( this.connection != null ) { // Not in test mode ???
103
              this.preparedStatement = this.connection.prepareStatement(insertSQL);
104
              this.connection.begin();
105
              for (String sql : this.getPreviousSQLs()) {
106
                  this.connection.execute(sql);
107
              }
108
            }
109
            
110
        } catch (SQLException ex) {
111
            throw new JDBCPreparingSQLException(this.sqlbuilder.toString(),ex);
112
        }
113

  
114
    }
115

  
116
    protected String getInsertSQL() {
90 117
            this.sqlbuilder = this.helper.createSQLBuilder();
91 118
            this.expbuilder = this.sqlbuilder.expression();
92 119

  
......
112 139
                }
113 140
            }
114 141

  
115
            this.insertSQL = this.sqlbuilder.insert().toString();
116
            if( this.connection != null ) { // Not in test mode ???
117
              this.preparedStatement = this.connection.prepareStatement(insertSQL);
118
              this.connection.begin();
119
              for (String sql : this.getPreviousSQLs()) {
120
                  this.connection.execute(sql);
121
              }
142
            return this.sqlbuilder.insert().toString();
143
    }
144
    
145
    protected String getMergeSQL() { 
146
            this.sqlbuilder = this.helper.createSQLBuilder();
147
            this.expbuilder = this.sqlbuilder.expression();
148

  
149
            this.sqlbuilder.merge().table()
150
                    .database(this.table.getDatabase())
151
                    .schema(this.table.getSchema())
152
                    .name(this.table.getTable()
153
            );
154
            for (FeatureAttributeDescriptor pk : type.getPrimaryKey()) {
155
                this.sqlbuilder.merge().key(pk.getName());
122 156
            }
123 157
            
124
        } catch (SQLException ex) {
125
            throw new JDBCPreparingSQLException(this.sqlbuilder.toString(),ex);
126
        }
158
            for (FeatureAttributeDescriptor attr : type) {
159
                if( attr.isAutomatic() || attr.isComputed() ) {
160
                    continue;
161
                }
162
                if (attr.getType() == DataTypes.GEOMETRY) {
163
                        this.sqlbuilder.merge().column().name(attr.getName()).with_value( 
164
                            expbuilder.parameter(attr.getName()).as_geometry_variable().srs( 
165
                                    expbuilder.parameter().value(attr.getSRS()) 
166
                            ) 
167
                        );
168
                    } else {
169
                        this.sqlbuilder.merge().column().name(attr.getName()).with_value(
170
                        expbuilder.parameter(attr.getName()).as_variable()
171
                    );
172
                }
173
            }
127 174

  
175
            return this.sqlbuilder.merge().toString();
128 176
    }
129
    
177

  
130 178
    protected void clean() {
131 179
        if( this.batchCount > 0 ) {
132 180
            this.clearBatch();
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.mdb/src/test/java/org/gvsig/fmap/dal/store/mdb/operations/sql/TestAppend.java
60 60
            table,
61 61
            featureType
62 62
    );
63
    append.begin();
63
    append.begin(FeatureStore.SUBMODE_NONE);
64 64
    List<String> SQLs = new ArrayList<>();
65 65
    SQLs.addAll(append.getPreviousSQLs());
66 66
    SQLs.add( append.getSQL());
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/test/java/org/gvsig/fmap/dal/feature/DummyFetureStore.java
52 52
public class DummyFetureStore implements FeatureStore {
53 53
    
54 54
    private int mode;
55
    private int submode;
55 56

  
56 57
    @Override
57 58
    public Object clone() throws CloneNotSupportedException {
......
140 141

  
141 142
    @Override
142 143
    public void edit() throws DataException {
143
        this.mode = MODE_FULLEDIT;
144
        this.edit(MODE_FULLEDIT);
144 145
    }
145 146

  
146 147
    @Override
147 148
    public void edit(int mode) throws DataException {
149
        this.edit(MODE_FULLEDIT, SUBMODE_NONE);
150
    }
151

  
152
    @Override
153
    public void edit(int mode, int submode) throws DataException {
148 154
        this.mode = mode;
155
        this.submode = submode;
149 156
    }
150 157

  
151 158
    @Override
152 159
    public int getMode() {
153 160
        return this.mode;
154 161
    }
155
    
156
    
157 162

  
158 163
    @Override
164
    public int getSubmode() {
165
        return this.submode;
166
    }
167

  
168
    @Override
159 169
    public void cancelEditing() throws DataException {
160 170
        this.mode = MODE_QUERY;
161 171
    }
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/SQLBuilder.java
1
package org.gvsig.fmap.dal;
2

  
3
import java.util.List;
4
import org.cresques.cts.IProjection;
5
import org.gvsig.expressionevaluator.ExpressionBuilder;
6
import org.gvsig.expressionevaluator.ExpressionBuilder.Parameter;
7
import org.gvsig.expressionevaluator.ExpressionBuilder.Value;
8
import org.gvsig.expressionevaluator.ExpressionBuilder.Variable;
9
import org.gvsig.expressionevaluator.ExpressionBuilder.Visitable;
10
import org.gvsig.expressionevaluator.Formatter;
11
import org.gvsig.expressionevaluator.GeometryExpressionBuilder;
12
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.GeometrySupportType;
13
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
14
import org.gvsig.fmap.dal.feature.FeatureType;
15
import org.gvsig.fmap.geom.primitive.Envelope;
16
import org.gvsig.tools.util.Bitmask;
17
import org.gvsig.tools.util.IsEmpty;
18

  
19
public interface SQLBuilder extends Visitable {
20

  
21
    public static final String PROP_FEATURE_TYPE = "FeatureType";
22
    public static final String PROP_TABLE = "Table";
23
    public static final String PROP_TABLENAME = "TableName";
24
    public static final String PROP_SYMBOLTABLE = "SymbolTable";
25
    public static final String PROP_JDBCHELPER = "JDBCHelper";
26
    public static final String PROP_QUERY = "Query";
27
    public static final String PROP_SQLBUILDER = "SQLBUILDER";
28
    public static final String PROP_ADD_TABLE_NAME_TO_COLUMNS = "ADD_TABLE_NAME";
29

  
30
    public static final String FEATURE_ATTRIBUTE_DESCRIPTOR = "FeatureAttributeDescriptor";
31
    
32
    public static final int DEFAULT_RECOMENDED_SQL_LENGTH = 2048;
33

  
34
    public enum Privilege {
35
        SELECT,
36
        INSERT,
37
        UPDATE,
38
        DELETE,
39
        TRUNCATE,
40
        REFERENCE,
41
        TRIGGER,
42
        ALL
43
    };
44

  
45
    public interface ColumnDescriptor {
46

  
47
        public String getName();
48

  
49
        public int getType();
50

  
51
        public int getSize();
52

  
53
        public int getPrecision();
54

  
55
        public int getScale();
56

  
57
        public boolean isPrimaryKey();
58

  
59
        public boolean isIndexed();
60

  
61
        public boolean isAutomatic();
62

  
63
        boolean allowNulls();
64
        
65
        boolean allowIndexDuplicateds();
66

  
67
        public Object getDefaultValue();
68

  
69
        public int getGeometryType();
70

  
71
        public int getGeometrySubtype();
72

  
73
        public Object getGeometrySRSId();
74

  
75
        public boolean isGeometry();
76

  
77
        public DataStoreParameters getStoreParameters();
78

  
79
        public void setName(String name);
80

  
81
        public void setType(int type);
82

  
83
        public void setSize(int size);
84

  
85
        public void setPrecision(int precision);
86

  
87
        public void setScale(int scale);
88

  
89
        public void setIsPrimaryKey(boolean isPk);
90

  
91
        public void setIsAutomatic(boolean isAutomatic);
92

  
93
        public void setAllowNulls(boolean allowNulls);
94

  
95
        public void setAllowIndexDuplicateds(boolean allowIndexDuplicateds);
96

  
97
        public void setDefaultValue(Object defaultValue);
98

  
99
        public void setGeometryType(int geom_type);
100

  
101
        public void setGeometrySubtype(int geom_subtype);
102

  
103
        public void setGeometrySRSId(Object geom_srsid);
104

  
105
        public Envelope getTableBBox();
106
        
107
        public void setTableBBox(Envelope bbox);
108
    }
109

  
110
    public interface StatementPart extends Value {
111

  
112
    }
113

  
114
    public interface Statement extends StatementPart {
115

  
116
    }
117
    
118
    public interface Column extends Variable {
119
        public TableNameBuilder table();
120
        public TableNameBuilder table(TableNameBuilder table);
121
    }
122

  
123
    public interface TableNameBuilder extends StatementPart, IsEmpty {
124

  
125
        public TableNameBuilder database(String name);
126

  
127
        public TableNameBuilder schema(String name);
128

  
129
        public TableNameBuilder name(String name);
130

  
131
        public String getDatabase();
132

  
133
        public String getSchema();
134

  
135
        public String getName();
136

  
137
        public boolean has_database();
138

  
139
        public boolean has_schema();
140

  
141
        public boolean has_name();
142
    }
143

  
144
    public interface CountBuilder extends StatementPart {
145

  
146
        public CountBuilder all();
147

  
148
        public CountBuilder column(Value value);
149

  
150
        public CountBuilder distinct();
151
    }
152

  
153
    public interface SelectColumnBuilder extends StatementPart {
154

  
155
        public SelectColumnBuilder name(String name);
156

  
157
        public SelectColumnBuilder name(TableNameBuilder table, String name);
158

  
159
        public SelectColumnBuilder table(TableNameBuilder table);
160
        
161
        public SelectColumnBuilder value(Value value);
162

  
163
        public SelectColumnBuilder as(String alias);
164

  
165
        public SelectColumnBuilder as_geometry();
166

  
167
        public SelectColumnBuilder all();
168

  
169
        public String getName();
170

  
171
        public String getAlias();
172

  
173
        public Value getValue();
174
        
175
        public boolean isGeometry();
176
        
177
        public TableNameBuilder getTable();
178
        
179
        public boolean isAggregateFunction();
180
    }
181

  
182
    public interface InsertColumnBuilder extends StatementPart {
183

  
184
        public InsertColumnBuilder name(String name);
185

  
186
        public InsertColumnBuilder with_value(Value value);
187

  
188
        public String getName();
189

  
190
        public Value getValue();
191
    }
192

  
193
    public interface UpdateColumnBuilder extends InsertColumnBuilder {
194

  
195
        @Override
196
        public UpdateColumnBuilder name(String name);
197

  
198
        @Override
199
        public UpdateColumnBuilder with_value(Value value);
200

  
201
        @Override
202
        public String getName();
203

  
204
        @Override
205
        public Value getValue();
206
    }
207

  
208
    public interface FromBuilder extends StatementPart {
209

  
210
        public TableNameBuilder table();
211

  
212
        public FromBuilder subquery(String subquery);
213

  
214
        public FromBuilder custom(String passthrough);
215
        
216
        public FromBuilder left_join(TableNameBuilder table, Value expression);
217
        
218
        public List<JoinBuilder> getJoins();
219
    }
220
    
221
    public interface JoinBuilder extends StatementPart {
222

  
223
        ExpressionBuilder.Value getCondition();
224

  
225
        SQLBuilder.TableNameBuilder getTable();
226

  
227
        String getType();
228

  
229
    }
230

  
231

  
232
    public interface OrderByBuilder extends StatementPart {
233
        
234
        public static int MODE_NULLS_FIRST = 0;
235
        public static int MODE_NULLS_LAST = 1;
236
        public static int MODE_NULLS_NOT_SPECIFIED = 2;
237
        
238
        public OrderByBuilder column(String name);
239
        
240
        public boolean isColumn(String name);
241
        
242
        public boolean isColumn(Value value);
243

  
244
//        @Deprecated
245
//        public OrderByBuilder column(Value name);
246

  
247
        public OrderByBuilder value(Value expression);
248

  
249
        public OrderByBuilder ascending(boolean asc);
250

  
251
        public OrderByBuilder ascending();
252

  
253
        public OrderByBuilder descending();
254
        
255
        public OrderByBuilder nulls(int mode);
256

  
257
        public OrderByBuilder custom(String order);
258
        
259
        public int getNullsMode();
260
    }
261

  
262
    public interface SelectBuilder extends Statement {
263

  
264
        public SelectColumnBuilder column();
265

  
266
        public SelectColumnBuilder column(String name);
267
        
268
        public SelectColumnBuilder column(SelectColumnBuilder column);
269
        
270
        public SelectBuilder remove_all_columns();
271

  
272
        public FromBuilder from();
273

  
274
        public GeometryExpressionBuilder where();
275

  
276
        public OrderByBuilder order_by();
277

  
278
        public OrderByBuilder getOrderBy(String column);
279
        
280
        public OrderByBuilder getOrderBy(Value column);
281

  
282
        public SelectBuilder group_by(Value... column);
283

  
284
        public SelectBuilder distinct();
285

  
286
        public SelectBuilder limit(long limit);
287

  
288
        public SelectBuilder limit(Long limit);
289

  
290
        /**
291
         * Specifies an offset to be applied to the SQL statement. Only an
292
         * offset can be applied if an order has been specified. Otherwise an
293
         * IllegalStateException exception will be thrown when constructing the
294
         * SQL statement invoking the toString method.
295
         *
296
         * @param offset
297
         * @return this SelectBuilder
298
         */
299
        public SelectBuilder offset(long offset);
300

  
301
        public boolean has_column(String name);
302

  
303
        public boolean has_where();
304

  
305
        public boolean has_from();
306

  
307
        public boolean has_order_by();
308

  
309
        public boolean has_group_by();
310

  
311
        public boolean has_aggregate_functions();
312

  
313
        public boolean has_limit();
314

  
315
        public boolean has_offset();
316
        
317
        public void disable_check_order_and_offset();
318

  
319
        /**
320
         * Constructs the SQL statement. If the values associated with the SQL
321
         * statement are not valid an IllegalStateException exception is thrown.
322
         *
323
         * @return the SQL select statement.
324
         * @throws IllegalStateException if the values of select statement are
325
         * not valids.
326
         */
327
        @Override
328
        public String toString();
329
        
330
        public List<Value> getGroups();
331
        
332
        public List<SelectColumnBuilder> getColumns();
333
        
334
        public SelectColumnBuilder getColumn(String name);
335
        
336
        public void remove_column(String columnName);
337

  
338
        public boolean isGroupBy(String name);
339

  
340
    }
341

  
342
    public interface UpdateBuilder extends Statement {
343

  
344
        public TableNameBuilder table();
345

  
346
        public UpdateColumnBuilder column();
347

  
348
        public GeometryExpressionBuilder where();
349

  
350
        public boolean has_where();
351
    }
352

  
353
    public interface InsertBuilder extends Statement {
354

  
355
        public TableNameBuilder table();
356

  
357
        public InsertColumnBuilder column();
358
    }
359

  
360
    public interface DeleteBuilder extends Statement {
361

  
362
        public TableNameBuilder table();
363

  
364
        public GeometryExpressionBuilder where();
365

  
366
        public boolean has_where();
367
    }
368

  
369
    public interface AlterTableBuilder extends Statement {
370
        public static final int ALTER_COLUMN_ALL = 1;
371
        public static final int ALTER_COLUMN_GEOMETRY = 2;
372
        public static final int ALTER_COLUMN_SET_DEFAULT = 3;
373
        public static final int ALTER_COLUMN_SET_NULL = 4;
374
        public static final int ALTER_COLUMN_SET_DATA_TYPE = 5;
375
        public static final int ALTER_COLUMN_ADD_PRIMARY_KEY = 6;
376
        public static final int ALTER_COLUMN_DROP_PRIMARY_KEY = 7;
377
        public static final int ALTER_COLUMN_CREATE_INDEX = 8;
378
        public static final int ALTER_COLUMN_DROP_INDEX = 9;
379
        public static final int ALTER_COLUMN_DROP_COLUMN = 10;
380
        public static final int ALTER_COLUMN_ADD_COLUMN = 11;
381

  
382
        public TableNameBuilder table();
383

  
384
        public AlterTableBuilder drop_column(String columnName);
385
        
386
        public AlterTableBuilder drop_primary_key(String columnName);
387

  
388
        public AlterTableBuilder add_column(FeatureAttributeDescriptor fad);
389

  
390
        public AlterTableBuilder add_column(String columnName, int type, int size, int precision, int scale, boolean isPk, boolean isIndexed, boolean allowNulls, boolean isAutomatic, Object defaultValue, boolean allowIndexDuplicateds);
391

  
392
        public AlterTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, IProjection proj, boolean isIndexed, boolean allowNulls);
393

  
394
        public AlterTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, Object srsdbcode, boolean isIndexed, boolean allowNulls);
395

  
396
        public AlterTableBuilder alter_column(Bitmask operation, FeatureAttributeDescriptor fad);
397

  
398
        public AlterTableBuilder alter_column(Bitmask operation, String columnName, int type, int size, int precision, int scale, boolean isPk, boolean isIndexed, boolean allowNulls, boolean isAutomatic, Object defaultValue, boolean allowIndexDuplicateds);
399

  
400
        public AlterTableBuilder alter_geometry_column(Bitmask operation,String columnName, int geom_type, int geom_subtype, IProjection proj, boolean isIndexed, boolean allowNulls);
401

  
402
        public AlterTableBuilder alter_geometry_column(Bitmask operation, String columnName, int geom_type, int geom_subtype, Object srsdbcode, boolean isIndexed, boolean allowNulls);
403

  
404
        public AlterTableBuilder rename_column(String source, String target);
405

  
406
        public boolean isEmpty();
407

  
408
        public List<String> toStrings();
409

  
410
        public List<String> toStrings(Formatter formatter);
411
    }
412

  
413
    public interface CreateTableBuilder extends Statement {
414

  
415
        public TableNameBuilder table();
416

  
417
        public CreateTableBuilder add_column(FeatureAttributeDescriptor fad);
418

  
419
        public CreateTableBuilder add_column(String columnName, int type, int size, int precision, int scale, boolean isPk, boolean isIndexed, boolean allowNulls, boolean isAutomatic, Object defaultValue);
420

  
421
        public CreateTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, IProjection proj, boolean isIndexed, boolean allowNulls);
422

  
423
        public CreateTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, Object srsdbcode, boolean isIndexed, boolean allowNulls);
424

  
425
        public ColumnDescriptor getColumnDescriptor(String columnName);
426

  
427
        public List<String> toStrings();
428

  
429
        public List<String> toStrings(Formatter formatter);
430
    }
431

  
432
    public interface UpdateTableStatisticsBuilder extends Statement {
433

  
434
        public TableNameBuilder table();
435

  
436
        public List<String> toStrings();
437

  
438
        public List<String> toStrings(Formatter formatter);
439
    }
440

  
441
    public interface GrantRoleBuilder extends StatementPart {
442

  
443
        public GrantRoleBuilder privilege(Privilege privilege);
444

  
445
        public GrantRoleBuilder select();
446

  
447
        public GrantRoleBuilder insert();
448

  
449
        public GrantRoleBuilder delete();
450

  
451
        public GrantRoleBuilder truncate();
452

  
453
        public GrantRoleBuilder reference();
454

  
455
        public GrantRoleBuilder update();
456

  
457
        public GrantRoleBuilder trigger();
458

  
459
        public GrantRoleBuilder all();
460
    }
461

  
462
    public interface GrantBuilder extends Statement {
463

  
464
        public TableNameBuilder table();
465

  
466
        public GrantRoleBuilder role(String name);
467

  
468
        public List<String> toStrings();
469

  
470
        public List<String> toStrings(Formatter formatter);
471
    }
472

  
473
    public interface DropTableBuilder extends Statement {
474

  
475
        public TableNameBuilder table();
476

  
477
        public List<String> toStrings();
478

  
479
        public List<String> toStrings(Formatter formatter);
480
    }
481

  
482
    public interface CreateIndexBuilder extends Statement {
483

  
484
        public CreateIndexBuilder if_not_exist();
485

  
486
        public CreateIndexBuilder unique();
487

  
488
        public CreateIndexBuilder name(String name);
489

  
490
        public CreateIndexBuilder name(String tableName, String columnName);
491

  
492
        public CreateIndexBuilder spatial();
493

  
494
        public CreateIndexBuilder column(String name);
495

  
496
        public TableNameBuilder table();
497

  
498
        public List<String> toStrings();
499

  
500
        public List<String> toStrings(Formatter formatter);
501

  
502
        public void setFeatureType(FeatureType type);
503
    }
504

  
505
    public interface DropIndexBuilder extends Statement {
506

  
507
        public DropIndexBuilder if_exist();
508

  
509
        public DropIndexBuilder name(String name);
510
        
511
        public DropIndexBuilder name(String tableName, String columnName);
512

  
513
        public List<String> toStrings();
514

  
515
        public List<String> toStrings(Formatter formatter);
516
    }
517

  
518
    public String default_schema();
519

  
520
    public boolean support_schemas();
521

  
522
    public boolean has_spatial_functions();
523

  
524
    public GeometrySupportType geometry_support_type();
525

  
526
    public String sqltype(int dataType, int size, int precision, int scale, int geomType, int geomSubtype);
527

  
528
    public Object sqlgeometrytype(int type, int subtype);
529

  
530
    public Object sqlgeometrydimension(int type, int subtype);
531

  
532
    public Object srs_id(IProjection projection);
533

  
534
    public String toString(Formatter formatter);
535

  
536
    public List<Variable> variables();
537

  
538
    public List<String> variables_names();
539

  
540
    public List<Parameter> parameters();
541

  
542
    public List<String> parameters_names();
543

  
544
    public TableNameBuilder table_name();
545

  
546
    public TableNameBuilder createTableNameBuilder();
547

  
548
    public SelectColumnBuilder column();
549
    
550
    public SelectBuilder select();
551

  
552
    public UpdateBuilder update();
553

  
554
    public InsertBuilder insert();
555

  
556
    public DeleteBuilder delete();
557

  
558
    public AlterTableBuilder alter_table();
559

  
560
    public CreateTableBuilder create_table();
561

  
562
    public CreateIndexBuilder create_index();
563
    
564
    public DropIndexBuilder drop_index();
565

  
566
    public GrantBuilder grant();
567

  
568
    public DropTableBuilder drop_table();
569

  
570
    public UpdateTableStatisticsBuilder update_table_statistics();
571

  
572
    public CountBuilder count();
573

  
574
    public GeometryExpressionBuilder expression();
575

  
576
    public String as_identifier(String id);
577

  
578
    public String as_clob(String s);
579
    
580
    public String as_string(String s);
581

  
582
    public String as_string(byte[] s);
583

  
584
    public String as_string(boolean value);
585

  
586
    public String as_string(Number value);
587

  
588
    public String as_string(Object value);
589
    
590
    public Column column(String name);
591

  
592
    public Column column(TableNameBuilder table, String name);
593
    
594
    public Column column_from(Variable variable);
595

  
596
    public Column column_from(TableNameBuilder table, Variable variable);    
597
    
598
    public void setProperties(Class classToApply, Object... values);
599
    
600
    public void setProperties(ExpressionBuilder.Visitable visitable, Class filter, final Object... values);
601
	
602
    public Formatter formatter();
603
    
604
    public boolean isAggregateFunction(String funcname);
605

  
606
    public int getMaxRecomendedSQLLength();
607
    
608
    public SelectBuilder createSelectBuilder();
609

  
610
    public String getConstrainName(TableNameBuilder table, String columnName, String constrainType);
611
}
1
package org.gvsig.fmap.dal;
2

  
3
import java.util.List;
4
import org.cresques.cts.IProjection;
5
import org.gvsig.expressionevaluator.ExpressionBuilder;
6
import org.gvsig.expressionevaluator.ExpressionBuilder.Parameter;
7
import org.gvsig.expressionevaluator.ExpressionBuilder.Value;
8
import org.gvsig.expressionevaluator.ExpressionBuilder.Variable;
9
import org.gvsig.expressionevaluator.ExpressionBuilder.Visitable;
10
import org.gvsig.expressionevaluator.Formatter;
11
import org.gvsig.expressionevaluator.GeometryExpressionBuilder;
12
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.GeometrySupportType;
13
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
14
import org.gvsig.fmap.dal.feature.FeatureType;
15
import org.gvsig.fmap.geom.primitive.Envelope;
16
import org.gvsig.tools.util.Bitmask;
17
import org.gvsig.tools.util.IsEmpty;
18

  
19
public interface SQLBuilder extends Visitable {
20

  
21
    public static final String PROP_FEATURE_TYPE = "FeatureType";
22
    public static final String PROP_TABLE = "Table";
23
    public static final String PROP_TABLENAME = "TableName";
24
    public static final String PROP_SYMBOLTABLE = "SymbolTable";
25
    public static final String PROP_JDBCHELPER = "JDBCHelper";
26
    public static final String PROP_QUERY = "Query";
27
    public static final String PROP_SQLBUILDER = "SQLBUILDER";
28
    public static final String PROP_ADD_TABLE_NAME_TO_COLUMNS = "ADD_TABLE_NAME";
29

  
30
    public static final String FEATURE_ATTRIBUTE_DESCRIPTOR = "FeatureAttributeDescriptor";
31
    
32
    public static final int DEFAULT_RECOMENDED_SQL_LENGTH = 2048;
33

  
34
    public enum Privilege {
35
        SELECT,
36
        INSERT,
37
        UPDATE,
38
        DELETE,
39
        TRUNCATE,
40
        REFERENCE,
41
        TRIGGER,
42
        ALL
43
    };
44

  
45
    public interface ColumnDescriptor {
46

  
47
        public String getName();
48

  
49
        public int getType();
50

  
51
        public int getSize();
52

  
53
        public int getPrecision();
54

  
55
        public int getScale();
56

  
57
        public boolean isPrimaryKey();
58

  
59
        public boolean isIndexed();
60

  
61
        public boolean isAutomatic();
62

  
63
        boolean allowNulls();
64
        
65
        boolean allowIndexDuplicateds();
66

  
67
        public Object getDefaultValue();
68

  
69
        public int getGeometryType();
70

  
71
        public int getGeometrySubtype();
72

  
73
        public Object getGeometrySRSId();
74

  
75
        public boolean isGeometry();
76

  
77
        public DataStoreParameters getStoreParameters();
78

  
79
        public void setName(String name);
80

  
81
        public void setType(int type);
82

  
83
        public void setSize(int size);
84

  
85
        public void setPrecision(int precision);
86

  
87
        public void setScale(int scale);
88

  
89
        public void setIsPrimaryKey(boolean isPk);
90

  
91
        public void setIsAutomatic(boolean isAutomatic);
92

  
93
        public void setAllowNulls(boolean allowNulls);
94

  
95
        public void setAllowIndexDuplicateds(boolean allowIndexDuplicateds);
96

  
97
        public void setDefaultValue(Object defaultValue);
98

  
99
        public void setGeometryType(int geom_type);
100

  
101
        public void setGeometrySubtype(int geom_subtype);
102

  
103
        public void setGeometrySRSId(Object geom_srsid);
104

  
105
        public Envelope getTableBBox();
106
        
107
        public void setTableBBox(Envelope bbox);
108
    }
109

  
110
    public interface StatementPart extends Value {
111

  
112
    }
113

  
114
    public interface Statement extends StatementPart {
115

  
116
    }
117
    
118
    public interface Column extends Variable {
119
        public TableNameBuilder table();
120
        public TableNameBuilder table(TableNameBuilder table);
121
    }
122

  
123
    public interface TableNameBuilder extends StatementPart, IsEmpty {
124

  
125
        public TableNameBuilder database(String name);
126

  
127
        public TableNameBuilder schema(String name);
128

  
129
        public TableNameBuilder name(String name);
130

  
131
        public String getDatabase();
132

  
133
        public String getSchema();
134

  
135
        public String getName();
136

  
137
        public boolean has_database();
138

  
139
        public boolean has_schema();
140

  
141
        public boolean has_name();
142
    }
143

  
144
    public interface CountBuilder extends StatementPart {
145

  
146
        public CountBuilder all();
147

  
148
        public CountBuilder column(Value value);
149

  
150
        public CountBuilder distinct();
151
    }
152

  
153
    public interface SelectColumnBuilder extends StatementPart {
154

  
155
        public SelectColumnBuilder name(String name);
156

  
157
        public SelectColumnBuilder name(TableNameBuilder table, String name);
158

  
159
        public SelectColumnBuilder table(TableNameBuilder table);
160
        
161
        public SelectColumnBuilder value(Value value);
162

  
163
        public SelectColumnBuilder as(String alias);
164

  
165
        public SelectColumnBuilder as_geometry();
166

  
167
        public SelectColumnBuilder all();
168

  
169
        public String getName();
170

  
171
        public String getAlias();
172

  
173
        public Value getValue();
174
        
175
        public boolean isGeometry();
176
        
177
        public TableNameBuilder getTable();
178
        
179
        public boolean isAggregateFunction();
180
    }
181

  
182
    public interface InsertColumnBuilder extends StatementPart {
183

  
184
        public InsertColumnBuilder name(String name);
185

  
186
        public InsertColumnBuilder with_value(Value value);
187

  
188
        public String getName();
189

  
190
        public Value getValue();
191
    }
192

  
193
    public interface UpdateColumnBuilder extends InsertColumnBuilder {
194

  
195
        @Override
196
        public UpdateColumnBuilder name(String name);
197

  
198
        @Override
199
        public UpdateColumnBuilder with_value(Value value);
200

  
201
        @Override
202
        public String getName();
203

  
204
        @Override
205
        public Value getValue();
206
    }
207

  
208
    public interface FromBuilder extends StatementPart {
209

  
210
        public TableNameBuilder table();
211

  
212
        public FromBuilder subquery(String subquery);
213

  
214
        public FromBuilder custom(String passthrough);
215
        
216
        public FromBuilder left_join(TableNameBuilder table, Value expression);
217
        
218
        public List<JoinBuilder> getJoins();
219
    }
220
    
221
    public interface JoinBuilder extends StatementPart {
222

  
223
        ExpressionBuilder.Value getCondition();
224

  
225
        SQLBuilder.TableNameBuilder getTable();
226

  
227
        String getType();
228

  
229
    }
230

  
231

  
232
    public interface OrderByBuilder extends StatementPart {
233
        
234
        public static int MODE_NULLS_FIRST = 0;
235
        public static int MODE_NULLS_LAST = 1;
236
        public static int MODE_NULLS_NOT_SPECIFIED = 2;
237
        
238
        public OrderByBuilder column(String name);
239
        
240
        public boolean isColumn(String name);
241
        
242
        public boolean isColumn(Value value);
243

  
244
//        @Deprecated
245
//        public OrderByBuilder column(Value name);
246

  
247
        public OrderByBuilder value(Value expression);
248

  
249
        public OrderByBuilder ascending(boolean asc);
250

  
251
        public OrderByBuilder ascending();
252

  
253
        public OrderByBuilder descending();
254
        
255
        public OrderByBuilder nulls(int mode);
256

  
257
        public OrderByBuilder custom(String order);
258
        
259
        public int getNullsMode();
260
    }
261

  
262
    public interface SelectBuilder extends Statement {
263

  
264
        public SelectColumnBuilder column();
265

  
266
        public SelectColumnBuilder column(String name);
267
        
268
        public SelectColumnBuilder column(SelectColumnBuilder column);
269
        
270
        public SelectBuilder remove_all_columns();
271

  
272
        public FromBuilder from();
273

  
274
        public GeometryExpressionBuilder where();
275

  
276
        public OrderByBuilder order_by();
277

  
278
        public OrderByBuilder getOrderBy(String column);
279
        
280
        public OrderByBuilder getOrderBy(Value column);
281

  
282
        public SelectBuilder group_by(Value... column);
283

  
284
        public SelectBuilder distinct();
285

  
286
        public SelectBuilder limit(long limit);
287

  
288
        public SelectBuilder limit(Long limit);
289

  
290
        /**
291
         * Specifies an offset to be applied to the SQL statement. Only an
292
         * offset can be applied if an order has been specified. Otherwise an
293
         * IllegalStateException exception will be thrown when constructing the
294
         * SQL statement invoking the toString method.
295
         *
296
         * @param offset
297
         * @return this SelectBuilder
298
         */
299
        public SelectBuilder offset(long offset);
300

  
301
        public boolean has_column(String name);
302

  
303
        public boolean has_where();
304

  
305
        public boolean has_from();
306

  
307
        public boolean has_order_by();
308

  
309
        public boolean has_group_by();
310

  
311
        public boolean has_aggregate_functions();
312

  
313
        public boolean has_limit();
314

  
315
        public boolean has_offset();
316
        
317
        public void disable_check_order_and_offset();
318

  
319
        /**
320
         * Constructs the SQL statement. If the values associated with the SQL
321
         * statement are not valid an IllegalStateException exception is thrown.
322
         *
323
         * @return the SQL select statement.
324
         * @throws IllegalStateException if the values of select statement are
325
         * not valids.
326
         */
327
        @Override
328
        public String toString();
329
        
330
        public List<Value> getGroups();
331
        
332
        public List<SelectColumnBuilder> getColumns();
333
        
334
        public SelectColumnBuilder getColumn(String name);
335
        
336
        public void remove_column(String columnName);
337

  
338
        public boolean isGroupBy(String name);
339

  
340
    }
341

  
342
    public interface UpdateBuilder extends Statement {
343

  
344
        public TableNameBuilder table();
345

  
346
        public UpdateColumnBuilder column();
347

  
348
        public GeometryExpressionBuilder where();
349

  
350
        public boolean has_where();
351
    }
352

  
353
    public interface InsertBuilder extends Statement {
354

  
355
        public TableNameBuilder table();
356

  
357
        public InsertColumnBuilder column();
358
    }
359

  
360
    public interface MergeBuilder extends InsertBuilder {
361
        
362
        public MergeBuilder key(String id);
363
    }
364
    
365
    public interface DeleteBuilder extends Statement {
366

  
367
        public TableNameBuilder table();
368

  
369
        public GeometryExpressionBuilder where();
370

  
371
        public boolean has_where();
372
    }
373

  
374
    public interface AlterTableBuilder extends Statement {
375
        public static final int ALTER_COLUMN_ALL = 1;
376
        public static final int ALTER_COLUMN_GEOMETRY = 2;
377
        public static final int ALTER_COLUMN_SET_DEFAULT = 3;
378
        public static final int ALTER_COLUMN_SET_NULL = 4;
379
        public static final int ALTER_COLUMN_SET_DATA_TYPE = 5;
380
        public static final int ALTER_COLUMN_ADD_PRIMARY_KEY = 6;
381
        public static final int ALTER_COLUMN_DROP_PRIMARY_KEY = 7;
382
        public static final int ALTER_COLUMN_CREATE_INDEX = 8;
383
        public static final int ALTER_COLUMN_DROP_INDEX = 9;
384
        public static final int ALTER_COLUMN_DROP_COLUMN = 10;
385
        public static final int ALTER_COLUMN_ADD_COLUMN = 11;
386

  
387
        public TableNameBuilder table();
388

  
389
        public AlterTableBuilder drop_column(String columnName);
390
        
391
        public AlterTableBuilder drop_primary_key(String columnName);
392

  
393
        public AlterTableBuilder add_column(FeatureAttributeDescriptor fad);
394

  
395
        public AlterTableBuilder add_column(String columnName, int type, int size, int precision, int scale, boolean isPk, boolean isIndexed, boolean allowNulls, boolean isAutomatic, Object defaultValue, boolean allowIndexDuplicateds);
396

  
397
        public AlterTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, IProjection proj, boolean isIndexed, boolean allowNulls);
398

  
399
        public AlterTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, Object srsdbcode, boolean isIndexed, boolean allowNulls);
400

  
401
        public AlterTableBuilder alter_column(Bitmask operation, FeatureAttributeDescriptor fad);
402

  
403
        public AlterTableBuilder alter_column(Bitmask operation, String columnName, int type, int size, int precision, int scale, boolean isPk, boolean isIndexed, boolean allowNulls, boolean isAutomatic, Object defaultValue, boolean allowIndexDuplicateds);
404

  
405
        public AlterTableBuilder alter_geometry_column(Bitmask operation,String columnName, int geom_type, int geom_subtype, IProjection proj, boolean isIndexed, boolean allowNulls);
406

  
407
        public AlterTableBuilder alter_geometry_column(Bitmask operation, String columnName, int geom_type, int geom_subtype, Object srsdbcode, boolean isIndexed, boolean allowNulls);
408

  
409
        public AlterTableBuilder rename_column(String source, String target);
410

  
411
        public boolean isEmpty();
412

  
413
        public List<String> toStrings();
414

  
415
        public List<String> toStrings(Formatter formatter);
416
    }
417

  
418
    public interface CreateTableBuilder extends Statement {
419

  
420
        public TableNameBuilder table();
421

  
422
        public CreateTableBuilder add_column(FeatureAttributeDescriptor fad);
423

  
424
        public CreateTableBuilder add_column(String columnName, int type, int size, int precision, int scale, boolean isPk, boolean isIndexed, boolean allowNulls, boolean isAutomatic, Object defaultValue);
425

  
426
        public CreateTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, IProjection proj, boolean isIndexed, boolean allowNulls);
427

  
428
        public CreateTableBuilder add_geometry_column(String columnName, int geom_type, int geom_subtype, Object srsdbcode, boolean isIndexed, boolean allowNulls);
429

  
430
        public ColumnDescriptor getColumnDescriptor(String columnName);
431

  
432
        public List<String> toStrings();
433

  
434
        public List<String> toStrings(Formatter formatter);
435
    }
436

  
437
    public interface UpdateTableStatisticsBuilder extends Statement {
438

  
439
        public TableNameBuilder table();
440

  
441
        public List<String> toStrings();
442

  
443
        public List<String> toStrings(Formatter formatter);
444
    }
445

  
446
    public interface GrantRoleBuilder extends StatementPart {
447

  
448
        public GrantRoleBuilder privilege(Privilege privilege);
449

  
450
        public GrantRoleBuilder select();
451

  
452
        public GrantRoleBuilder insert();
453

  
454
        public GrantRoleBuilder delete();
455

  
456
        public GrantRoleBuilder truncate();
457

  
458
        public GrantRoleBuilder reference();
459

  
460
        public GrantRoleBuilder update();
461

  
462
        public GrantRoleBuilder trigger();
463

  
464
        public GrantRoleBuilder all();
465
    }
466

  
467
    public interface GrantBuilder extends Statement {
468

  
469
        public TableNameBuilder table();
470

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff