protected JDBCDataStore createDataStoreInternal(JDBCDataStore dataStore, Map params) throws IOException { // setup loose bbox PostGISDialect dialect = (PostGISDialect) dataStore.getSQLDialect(); Boolean loose = (Boolean) LOOSEBBOX.lookUp(params); dialect.setLooseBBOXEnabled(loose == null || Boolean.TRUE.equals(loose)); // check the estimated extents Boolean estimated = (Boolean) ESTIMATED_EXTENTS.lookUp(params); dialect.setEstimatedExtentsEnabled(estimated == null || Boolean.TRUE.equals(estimated)); // check if we can encode functions in sql Boolean encodeFunctions = (Boolean) ENCODE_FUNCTIONS.lookUp(params); dialect.setFunctionEncodingEnabled(encodeFunctions == null || encodeFunctions); // setup the ps dialect if need be Boolean usePs = (Boolean) PREPARED_STATEMENTS.lookUp(params); if (Boolean.TRUE.equals(usePs)) { dataStore.setSQLDialect(new PostGISPSDialect(dataStore, dialect)); } // check geometry simplification (on by default) Boolean simplify = (Boolean) SIMPLIFY.lookUp(params); dialect.setSimplifyEnabled(simplify == null || simplify); // encode BBOX filter with wrapping ST_Envelope (GEOT-5167) Boolean encodeBBOXAsEnvelope = false; String largeGeometriesOptimized = System.getProperty("org.geotools.data.postgis.largeGeometriesOptimize"); if (largeGeometriesOptimized != null) { encodeBBOXAsEnvelope = largeGeometriesOptimized.toLowerCase().equals("true"); } dialect.setEncodeBBOXFilterAsEnvelope(Boolean.TRUE.equals(encodeBBOXAsEnvelope)); return dataStore; }
jdbcDataStore.setSQLDialect(sqlDialect); List<Future> futures = new ArrayList<>(); for (int j = 0; j < nThreads; j++) {
@Test public void testQueryIsFilteredOnLockedFeatureIdsWithPreparedStatements() throws IOException, SQLException { dataStore.setSQLDialect(createPreparedSQLDialect()); createLock(); dataStore.ensureAuthorization(featureType, Filter.INCLUDE, tx, cx); assertTrue(cx.filteredOnIds); }
@Before public void setUp() throws SQLException { cx = new TracingMockConnection(); configureMetadata(); dataStore = new JDBCDataStore(); dataStore.setFilterFactory(CommonFactoryFinder.getFilterFactory2()); dataStore.setSQLDialect(createBasicSQLDialect()); MockDataSource dataSource = new MockDataSource(); dataSource.setupConnection(cx); dataStore.setDataSource(dataSource); featureType = Mockito.mock(SimpleFeatureType.class); Mockito.when(featureType.getTypeName()).thenReturn(SAMPLE_FEATURE_NAME); Mockito.when(featureType.getName()).thenReturn(new NameImpl(SAMPLE_FEATURE_NAME)); tx = new DefaultTransaction(); }
.thenReturn(true); store.setSQLDialect(dialect);
dataStore.setSQLDialect(dialect);
protected JDBCDataStore createDataStoreInternal(JDBCDataStore dataStore, Map params) throws IOException { // setup loose bbox PostGISDialect dialect = (PostGISDialect) dataStore.getSQLDialect(); Boolean loose = (Boolean) LOOSEBBOX.lookUp(params); dialect.setLooseBBOXEnabled(loose == null || Boolean.TRUE.equals(loose)); // check the estimated extents Boolean estimated = (Boolean) ESTIMATED_EXTENTS.lookUp(params); dialect.setEstimatedExtentsEnabled(estimated == null || Boolean.TRUE.equals(estimated)); // check if we can encode functions in sql Boolean encodeFunctions = (Boolean) ENCODE_FUNCTIONS.lookUp(params); dialect.setFunctionEncodingEnabled(encodeFunctions != null && encodeFunctions); // setup the ps dialect if need be Boolean usePs = (Boolean) PREPARED_STATEMENTS.lookUp(params); if(Boolean.TRUE.equals(usePs)) { dataStore.setSQLDialect(new PostGISPSDialect(dataStore, dialect)); } return dataStore; }
public void verifyVersion(Map params) throws DaoException { JDBCDataStore dataStore = new JDBCDataStore(); SQLDialect dialect = createSQLDialect(dataStore); dataStore.setSQLDialect(dialect); DataSource ds; try { ds = super.createDataSource(params, dialect); } catch (IOException e) { throw new DaoException(e); } LOG.info("checking for postgis extension"); // First pass through loop may install extension. Second pass should work! for (int i = 0; i < 2; i++) { if (checkAndInstall(ds)) { return; } } throw new DaoException("Failed to create PostGIS extension for database. Is PostGIS 2.x installed?"); }
public void verifyVersion(Map params) throws DaoException { JDBCDataStore dataStore = new JDBCDataStore(); SQLDialect dialect = createSQLDialect(dataStore); dataStore.setSQLDialect(dialect); DataSource ds; try { ds = super.createDataSource(params, dialect); } catch (IOException e) { throw new DaoException(e); } LOG.info("checking for postgis extension"); // First pass through loop may install extension. Second pass should work! for (int i = 0; i < 2; i++) { if (checkAndInstall(ds)) { return; } } throw new DaoException("Failed to create PostGIS extension for database. Is PostGIS 2.x installed?"); }
dataStore.setSQLDialect(dialect);
dataStore.setSQLDialect(dialect);