| | |
| | | import org.apache.commons.collections.OrderedMap; |
| | | import org.apache.commons.collections.OrderedMapIterator; |
| | | import org.apache.commons.collections.map.LinkedMap; |
| | | import org.apache.commons.dbcp.DelegatingConnection; |
| | | import org.apache.commons.dbcp.PoolingConnection; |
| | | import org.apache.commons.dbcp.PoolingDataSource; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.data.DataStore; |
| | |
| | | long tStepEnd = System.currentTimeMillis(); |
| | | logTimeDiff("Profile-convertOtherDesignFile", tStep, tStepEnd); |
| | | } |
| | | |
| | | } |
| | | |
| | | OracleConvertPostGISJobContext jobContext = null; |
| | |
| | | updateRepoStatusToReady(targetSchemaName); |
| | | |
| | | if (checkConvertPWThemes()) { |
| | | jobContext = (OracleConvertPostGISJobContext) prepareJobContext(targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | | jobContext.setExecutionContext(context); |
| | | |
| | | long tStep = System.currentTimeMillis(); |
| | | if (!convertPowerOwnerThemeWithCopyAPI(jobContext, targetThemeTable)) { |
| | | convertPowerOwnerTheme(jobContext, targetThemeTable); |
| | |
| | | long tStepEnd = System.currentTimeMillis(); |
| | | logTimeDiff("Profile-convertFeatureDesignFile", tStep, tStepEnd); |
| | | } |
| | | jobContext.closeOracleConnection(); |
| | | } |
| | | |
| | | updatePWThemeStatusToReady(targetThemeTable); |
| | |
| | | } |
| | | |
| | | public String encodeSchemaTableName(String schemaName, String tableName) { |
| | | if (schemaName == null) |
| | | return "\"" + tableName + "\""; |
| | | return "\"" + schemaName + "\".\"" + tableName + "\""; |
| | | } |
| | | |
| | |
| | | sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); |
| | | sbSQL.append(" SET vptstatus = "); |
| | | sbSQL.append(DataReposVersionManager.VSSTATUS_READY); |
| | | sbSQL.append(" , vstimestamp = CURRENT_TIMESTAMP WHERE vptname = '"); |
| | | sbSQL.append(" , vpttimestamp = CURRENT_TIMESTAMP WHERE vptname = '"); |
| | | sbSQL.append(targetSchema).append("'"); |
| | | |
| | | connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); |
| | |
| | | } |
| | | Connection connection = context.getOracleConnection(); |
| | | Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); |
| | | while (connectionPG instanceof DelegatingConnection) { |
| | | connectionPG = ((DelegatingConnection) connectionPG).getDelegate(); |
| | | } |
| | | |
| | | if (!(connectionPG instanceof PGConnection)) { |
| | | return false; |
| | | } |
| | | |
| | | final int MAX_BATCHSIZE = 250; |
| | | ResultSet rs = null; |
| | | Statement stmt = null; |
| | | try { |
| | | |
| | | // connectionPG.setAutoCommit(false); |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | String targetTableName = targetTableBaseName + FDYNCOLOR_SUFFIX; |
| | | String targetTempName = "tmp_" + targetTableName; |
| | | logger.info("target table:" + targetTableName); |
| | | stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); |
| | | rs = stmt.executeQuery(FETCH_COLORTAB); |
| | | rs.setFetchSize(50); |
| | | rs.setFetchSize(MAX_BATCHSIZE); |
| | | |
| | | createOrClearTempTargetTable(connectionPG, targetTempName, |
| | | "(tid smallint not null, oid int not null, dyncolor varchar(10) not null)"); |
| | | StringBuilder sb = new StringBuilder(); |
| | | |
| | | CopyManager cpMgr = ((PGConnection) connectionPG).getCopyAPI(); |
| | | PushbackReader reader = new PushbackReader(new StringReader(""), 4096); |
| | | PushbackReader reader = new PushbackReader(new StringReader(""), 10240); |
| | | |
| | | final int MAX_BATCHSIZE = 50; |
| | | int count = 0; |
| | | while (rs.next()) { |
| | | int cid = rs.getInt(1); |
| | |
| | | } |
| | | Connection connection = context.getOracleConnection(); |
| | | Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); |
| | | while (connectionPG instanceof DelegatingConnection) { |
| | | connectionPG = ((DelegatingConnection) connectionPG).getDelegate(); |
| | | } |
| | | |
| | | boolean found = false; |
| | | if (!(connectionPG instanceof PGConnection)) { |
| | | return false; |
| | | } |
| | | |
| | | final int MAX_BATCHSIZE = 250; |
| | | ResultSet rs = null; |
| | | Statement stmt = null; |
| | | try { |
| | | connectionPG.setAutoCommit(false); |
| | | // connectionPG.setAutoCommit(false); |
| | | String targetTableName = targetTableBaseName + FOWNER_SUFFIX; |
| | | String targetTempName = "tmp_" + targetTableName; |
| | | logger.info("target table:" + targetTableName); |
| | | stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); |
| | | rs = stmt.executeQuery(FETCH_CONNFDR); |
| | | rs.setFetchSize(50); |
| | | rs.setFetchSize(MAX_BATCHSIZE); |
| | | |
| | | createOrClearTempTargetTable(connectionPG, targetTempName, |
| | | "(tid smallint not null, oid int not null, fowner smallint not null)"); |
| | |
| | | StringBuilder sb = new StringBuilder(); |
| | | |
| | | CopyManager cpMgr = ((PGConnection) connectionPG).getCopyAPI(); |
| | | PushbackReader reader = new PushbackReader(new StringReader(""), 4096); |
| | | PushbackReader reader = new PushbackReader(new StringReader(""), 10240); |
| | | |
| | | final int MAX_BATCHSIZE = 50; |
| | | int count = 0; |
| | | while (rs.next()) { |
| | | int cid = rs.getInt(1); |
| | |
| | | Statement stmt = connection.createStatement(); |
| | | ResultSet rs = null; |
| | | try { |
| | | rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); |
| | | rs = connection.getMetaData().getTables(null, null, tableName, new String[]{"TABLE"}); |
| | | if (rs.next()) { |
| | | stmt.execute("DROP TABLE " + encodeSchemaTableName(_pgSchema, tableName) + "CASCADE"); |
| | | stmt.execute("DROP TABLE " + encodeSchemaTableName(null, tableName) + "CASCADE"); |
| | | } |
| | | |
| | | stmt.executeUpdate("CREATE TEMP TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " " + sql); |
| | | stmt.executeUpdate("CREATE TEMP TABLE " + encodeSchemaTableName(null, tableName) + " " + sql); |
| | | } finally { |
| | | JDBCUtils.close(rs); |
| | | JDBCUtils.close(stmt); |