forked from orbisgis/orbisgis
-
Notifications
You must be signed in to change notification settings - Fork 0
Executing SQL Instructions
Antoine Gourlay edited this page Jul 23, 2012
·
2 revisions
It is very easy to execute an SQL instruction on a Gdms source. See the Gdms SQL Reference for the description of the supported grammar.
DataSourceFactory dsf = new DataSourceFactory();
// register a source
dsf.getSourceManager().register("myTable", new File("/home/toto/myFile.shp"));
// get a datasource from a query
DataSource ds = dsf.getDataSourceFromSQL(
"SELECT * FROM myTable WHERE myField = 'value';");By default the resulting source is read-only, as any other DataSource.
If a query does not return anything or has a result we are not interested in, it is even easier:
DataSourceFactory dsf = new DataSourceFactory();
// register a source
dsf.getSourceManager().register("myTable", new File("/home/toto/myFile.shp"));
// execute a query
dsf.executeSQL("INSERT INTO myTable (myField) VALUES ('value2') ");- Home - overview for developers
- Using Gdms - directly working with Gdms
- The DataSource API - using data sources
- Executing SQL - using SQL
- Dependencies & Licenses - list dependencies and their licenses
- OrbisGIS 4.0 Internals - internal docs
External links:
- Gdms SQL Reference - documentation for Gdms SQL
- User Documentation (v3.0) - OrbisGIS v3 user docs