Revision 45488 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.h2spatial/org.gvsig.h2spatial.h2gis132/org.gvsig.h2spatial.h2gis132.provider/src/main/java/org/gvsig/fmap/dal/store/h2/H2SpatialHelper.java
H2SpatialHelper.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.fmap.dal.store.h2; |
23 | 23 |
|
24 |
import org.gvsig.fmap.dal.store.jdbc2.spi.ConnectionProvider; |
|
25 | 24 |
import java.io.File; |
26 | 25 |
import java.sql.Connection; |
27 | 26 |
import java.sql.SQLException; |
... | ... | |
30 | 29 |
import org.apache.commons.io.FilenameUtils; |
31 | 30 |
import org.apache.commons.lang3.StringUtils; |
32 | 31 |
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.GeometrySupportType; |
32 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_CONFIGURATION_NAME; |
|
33 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_CONFIGURATION_VALUE; |
|
34 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_RESOURCES_NAME; |
|
35 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_RESOURCES_RESOURCE; |
|
36 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_CONFIGURATION_NAME; |
|
37 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_RESOURCES_NAME; |
|
33 | 38 |
import org.gvsig.fmap.dal.exception.InitializeException; |
34 | 39 |
import org.gvsig.fmap.dal.resource.exception.AccessResourceException; |
35 | 40 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
... | ... | |
43 | 48 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
44 | 49 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCUtils; |
45 | 50 |
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory; |
51 |
import org.gvsig.fmap.dal.store.jdbc2.spi.ConnectionProvider; |
|
46 | 52 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCHelperBase; |
47 | 53 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase; |
48 | 54 |
import org.gvsig.fmap.dal.store.jdbc2.spi.SRSSolverBase; |
49 | 55 |
import org.gvsig.fmap.dal.store.jdbc2.spi.SRSSolverDumb; |
50 | 56 |
import org.h2.tools.Server; |
57 |
import org.h2gis.functions.factory.H2GISFunctions; |
|
58 |
import org.h2gis.functions.system.H2GISversion; |
|
51 | 59 |
import org.slf4j.Logger; |
52 | 60 |
import org.slf4j.LoggerFactory; |
53 |
import org.h2gis.functions.factory.H2GISFunctions; |
|
54 |
import org.h2gis.functions.system.H2GISversion; |
|
55 | 61 |
|
56 | 62 |
|
57 | 63 |
@SuppressWarnings("UseSpecificCatch") |
... | ... | |
277 | 283 |
LOGGER.trace("Can't create schema public.",ex); |
278 | 284 |
// Ignore this error. |
279 | 285 |
} |
286 |
|
|
280 | 287 |
if( newdb ) { |
281 | 288 |
String[] sqls = new String[] { |
282 |
"CREATE CACHED TABLE PUBLIC.\"gvsigd_resources\"(\"name\" VARCHAR(150) NOT NULL, \"resource\" BLOB DEFAULT NULL)",
|
|
283 |
"ALTER TABLE PUBLIC.\"gvsigd_resources\" ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(\"name\")",
|
|
284 |
"CREATE CACHED TABLE PUBLIC.\"gvsigd_config\"(\"name\" VARCHAR(200) NOT NULL, \"value\" VARCHAR(200) DEFAULT NULL)",
|
|
285 |
"ALTER TABLE PUBLIC.\"gvsigd_config\" ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(\"name\")"
|
|
289 |
"CREATE CACHED TABLE PUBLIC.\""+TABLE_RESOURCES_NAME+"\"(\""+FIELD_RESOURCES_NAME+"\" VARCHAR(150) NOT NULL, \""+FIELD_RESOURCES_RESOURCE+"\" BLOB DEFAULT NULL)",
|
|
290 |
"ALTER TABLE PUBLIC.\""+TABLE_RESOURCES_NAME+"\" ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(\""+FIELD_RESOURCES_NAME+"\")",
|
|
291 |
"CREATE CACHED TABLE PUBLIC.\""+TABLE_CONFIGURATION_NAME+"\"(\""+FIELD_CONFIGURATION_NAME+"\" VARCHAR(200) NOT NULL, \""+FIELD_CONFIGURATION_VALUE+"\" VARCHAR(200) DEFAULT NULL)",
|
|
292 |
"ALTER TABLE PUBLIC.\""+TABLE_CONFIGURATION_NAME+"\" ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(\""+FIELD_CONFIGURATION_NAME+"\")"
|
|
286 | 293 |
}; |
287 | 294 |
for (String sql : sqls) { |
288 | 295 |
try { |
Also available in: Unified diff