Statistics
| Revision:

svn-gvsig-desktop / 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 / feature / SQLBuilder_save.java @ 43020

History | View | Annotate | Download (9.02 KB)

1
package org.gvsig.fmap.dal.feature;
2

    
3
import java.util.List;
4
import org.cresques.cts.IProjection;
5
import org.gvsig.fmap.geom.Geometry;
6
import org.gvsig.fmap.geom.primitive.Envelope;
7
import org.gvsig.tools.dataTypes.DataType;
8

    
9
public interface SQLBuilder_save {
10

    
11
    public enum Privilege {
12
        SELECT,
13
        INSERT,
14
        UPDATE,
15
        DELETE,
16
        TRUNCATE,
17
        REFERENCE,
18
        TRIGGER,
19
        ALL
20
    };
21

    
22
    public enum GeometrySupportType {
23
        WKT,
24
        WKB,
25
        EWKB
26
    }
27
    
28
    public interface Parameter {
29
        public int getType();
30
        public String getName();
31
        public IProjection getCRS();
32
        public boolean isConstant();
33
        public Object getValue();
34
    }
35

    
36
    public interface ExpBuilder {
37
        public boolean isEmpty();
38
        public ExpBuilder set(String value);
39
        public ExpBuilder set(OpBuilder op);
40
        public ExpBuilder and(String value);
41
        public ExpBuilder and(OpBuilder op);
42
        public ExpBuilder or(String value);
43
        public ExpBuilder or(OpBuilder op);
44
    }
45
    
46
    public interface ColumnBuilder {
47
        public ColumnBuilder name(String name);
48
        public ColumnBuilder geometry(String name);
49
        public ColumnBuilder expression(String value);
50
        public ColumnBuilder as(String alias);
51
        public String getName();
52
        public String getAlias();
53
        public String getExpression();
54
    }
55
    
56
    public interface OpBuilder {
57
        public OpBuilder setop1(String op);
58
        public OpBuilder setop2(String op);
59
    }
60
    
61
    public interface FromBuilder {
62
        public FromBuilder table(String tableName);
63
        public FromBuilder table(String dbname, String schemaName, String tableName);
64
        public FromBuilder subquery(String subquery);
65
        public FromBuilder passThrough(String passthrough);
66
    }
67
    
68
    public interface SelectBuilder {
69
        public ColumnBuilder column();
70
        public boolean has_column(String name);
71
        public FromBuilder from();
72
        public FromBuilder from(String s);
73
        public ExpBuilder where();
74
        public ExpBuilder where(String s);
75
        public ExpBuilder where(OpBuilder s);
76
        public SelectBuilder limit(long limit);
77
        public SelectBuilder offset(long offset);
78
        public SelectBuilder add_order_by(String order);
79
        public SelectBuilder add_order_by(String column, boolean ascending);
80
        public boolean has_order_by();
81
    }
82
    
83
    public interface UpdateBuilder {
84
        public UpdateBuilder table(String tableName);
85
        public UpdateBuilder table(String dbName, String schemaName, String tableName);
86
        public UpdateBuilder set(String fieldname, String value);
87
        public UpdateBuilder setGeometry(String fieldname, String value, IProjection crs);
88
        public ExpBuilder where();
89
        public boolean hasWhere();
90
    }
91
    
92
    public interface InsertBuilder {
93
        public InsertBuilder table(String tableName);
94
        public InsertBuilder table(String dbName, String schemaName, String tableName);
95
        public InsertBuilder set(String fieldname, String value);
96
        public InsertBuilder setGeometry(String fieldname, String value, IProjection crs);
97
    }
98
    
99
    public interface DeleteBuilder {
100
        public DeleteBuilder table(String tableid);
101
        public DeleteBuilder table(String dbName, String schemaName, String tableName);
102
        public ExpBuilder where();
103
        public boolean hasWhere();
104
    }
105
    
106
    public interface AlterTableBuilder {
107
        public AlterTableBuilder table(String tableName);
108
        public AlterTableBuilder table(String dbName, String schemaName, String tableName);
109
        public AlterTableBuilder drop_column(String columnName);
110
        public AlterTableBuilder add_column(String columnName, int type, int type_p, int type_s, boolean isPk, boolean allowNulls, boolean isAutomatic, Object defaultValue);
111
        public AlterTableBuilder alter_column(String columnName, int type, int type_p, int type_s, boolean isPk, boolean allowNulls, boolean isAutomatic, Object defaultValue);
112
        public AlterTableBuilder rename_column(String source, String target);
113
        public List<String> toStrings();
114
    }
115
    
116
    public interface CreateTableBuilder {
117
        public CreateTableBuilder table(String tableName);
118
        public CreateTableBuilder table(String dbname, String schemaName, String tableName);
119
        public CreateTableBuilder add_column(String columnName, int type, int type_p, int type_s, boolean isPk, boolean allowNulls, boolean isAutomatic, Object defaultValue);
120
        public List<String> toStrings();
121
    }
122
    
123
    public interface UpdateTableStatisticsBuilder {
124
        public UpdateTableStatisticsBuilder table(String tableName);
125
        public UpdateTableStatisticsBuilder table(String dbName, String schemaName, String tableName);
126
        public List<String> toStrings();
127
    }
128
        
129
    public interface GrantBuilder {
130
        public GrantBuilder table(String tableName);
131
        public GrantBuilder table(String dbName, String schemaName, String tableName);
132
        public GrantBuilder add(String roleid, Privilege privilege);
133
        public GrantBuilder select(String roleid);
134
        public GrantBuilder insert(String roleid);
135
        public GrantBuilder delete(String roleid);
136
        public GrantBuilder truncate(String roleid);
137
        public GrantBuilder reference(String roleid);
138
        public GrantBuilder trigger(String roleid);
139
        public GrantBuilder all(String roleid);
140
        public GrantBuilder select();
141
        public GrantBuilder insert();
142
        public GrantBuilder delete();
143
        public GrantBuilder truncate();
144
        public GrantBuilder reference();
145
        public GrantBuilder trigger();
146
        public GrantBuilder all();
147
        public List<String> toStrings();
148
    }
149
        
150
    public interface DropTableBuilder {
151
        public DropTableBuilder table(String tableName);
152
        public DropTableBuilder table(String dbName, String schemaName, String tableName);
153
        public List<String> toStrings();
154
    }
155
    
156
    boolean has_spatial_functions();
157
    
158
    String ST_AsText(String geom);
159

    
160
    String ST_AsBinary(String geom);
161

    
162
    String ST_AsEWKB(String geom);
163

    
164
    String ST_Envelope(String geom);
165

    
166
    String ST_ExtentAggregate(String geom);
167

    
168
    String ST_UnionAggregate(String geom);
169
    
170
    String ST_GeomFromText(String geom, String crs);
171
    
172
    String ST_GeomFromWKB(String geom, String crs);
173
            
174
    String ST_GeomFromEWKB(String geom, String crs);
175

    
176
    String ST_GeomFromText(String geom, int crs);
177

    
178
    String ST_GeomFromText(Geometry geom, IProjection crs);
179

    
180
    String ST_GeomFromWKB(Geometry geom, IProjection crs);
181
    
182
    String ST_GeomFromEWKB(Geometry geom, IProjection crs);
183

    
184
    String ST_GeomFromText(Envelope env, IProjection crs);
185

    
186
    String ST_Intersects(String geom1, String geom2);
187

    
188
    String ST_Contains(String geom1, String geom2);
189

    
190
    String ST_Crosses(String geom1, String geom2);
191

    
192
    String ST_IsClosed(String geom1, String geom2);
193

    
194
    String ST_Overlaps(String geom1, String geom2);
195

    
196
    String ST_Touches(String geom1, String geom2);
197

    
198
    String ST_Within(String geom1, String geom2);
199

    
200
    String isNull(String s);
201

    
202
    String default_schema();
203
    
204
    String count(String column);
205
    
206
    String lcase(String s);
207
    
208
    String ucase(String s);
209
    
210
    String getWKT(Geometry geom);
211
    byte[] getWKB(Geometry geom);
212
    byte[] getEWKB(Geometry geom);
213
        
214
    String getWKT(Envelope env);
215
    byte[] getWKB(Envelope env);
216
    byte[] getEWKB(Envelope env);
217

    
218
    String geometry(Geometry geom, IProjection crs);
219
    
220
    String geometry(Envelope env, IProjection crs);
221
    
222
    String string(String s);
223
    
224
    String identifier(String id);
225
    
226
    String bytearray(byte[] data);
227
    
228
    String crs(String crs);
229
    
230
    String crs(IProjection crs);
231

    
232
    String sqltype(int dataType, int p, int s);
233

    
234
    GeometrySupportType geometry_support_type();
235
    
236
    OpBuilder and(String op1, String op2);
237

    
238
    OpBuilder or(String op1, String op2);
239

    
240
    OpBuilder eq(String op1, String op2);
241
    
242
    OpBuilder ne(String op1, String op2);
243
    
244
    OpBuilder gt(String op1, String op2);
245
    
246
    OpBuilder ge(String op1, String op2);
247

    
248
    OpBuilder lt(String op1, String op2);
249
    
250
    OpBuilder le(String op1, String op2);
251

    
252
    OpBuilder like(String op1, String op2);
253

    
254
    OpBuilder ilike(String op1, String op2);
255

    
256
    ExpBuilder createExpresionBuilder(String x);
257
    
258
    ExpBuilder createExpresionBuilder(OpBuilder x);
259
    
260
    ExpBuilder createExpresionBuilder();
261
    
262
    void clearParameters();
263
    
264
    void addParameter(DataType type, String name);
265
    
266
    void addParameter(int type, String name);
267
    
268
    void addParameter(int type, String name, IProjection crs);
269
    
270
    void addConstantParameter(Object value);
271

    
272
    List<Parameter> getParameters();
273
    
274
    SelectBuilder select();
275
    
276
    UpdateBuilder update();
277

    
278
    InsertBuilder insert();
279
    
280
    DeleteBuilder delete();
281
    
282
    AlterTableBuilder alter_table();
283

    
284
    CreateTableBuilder create_table();
285

    
286
    GrantBuilder grant();
287

    
288
    DropTableBuilder drop_table();
289

    
290
    UpdateTableStatisticsBuilder update_table_statistics();
291
}