fix: cursor over limit when sync
This commit is contained in:
parent
c1f7d1e99d
commit
203b2951fd
|
@ -169,6 +169,8 @@ public interface Routes {
|
|||
String CREATE = BASE + "/database_types";
|
||||
|
||||
String RESOLVE_DRIVER_CLASS_NAME = BASE + "/database_types/driver_class_name";
|
||||
|
||||
String UPLOAD_DRIVER = BASE + "/database_types/upload_driver";
|
||||
}
|
||||
|
||||
interface MockData {
|
||||
|
|
|
@ -36,9 +36,10 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
|
|||
columnsResult = connection.getMetaData()
|
||||
.getColumns(databaseName, tableCondition.getSchemaName(), tableName, null);
|
||||
} catch (SQLException e) {
|
||||
log.warn("warn: ignore columns in " + databaseName + "." + tableName);
|
||||
log.warn("warn: ignore columns in " + databaseName + "." + tableName + ", error: " + e.getMessage());
|
||||
return columnDocs;
|
||||
}
|
||||
try {
|
||||
while (columnsResult.next()) {
|
||||
String columnName = columnsResult.getString("COLUMN_NAME");
|
||||
if (tableCondition.columnIsIgnored(columnName)) {
|
||||
|
@ -83,6 +84,9 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
|
|||
columnDocs.add(columnMeta);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
columnsResult.close();
|
||||
}
|
||||
return columnDocs;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,12 @@ public class JdbcForeignKeyMetaRepository implements ForeignKeyMetaRepository {
|
|||
}
|
||||
} catch (SQLException e) {
|
||||
log.warn("warn: ignore foreign keys in " + databaseName + "." + tableName + ", " + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
keyResult.close();
|
||||
} catch (SQLException e) {
|
||||
log.warn("warn: close key result error " + databaseName + "." + tableName + ", " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return foreignKeys;
|
||||
}
|
||||
|
|
|
@ -31,11 +31,12 @@ public class JdbcIndexMetaRepository implements IndexMetaRepository {
|
|||
indexResults = connection.getMetaData()
|
||||
.getIndexInfo(databaseName, condition.getSchemaName(), tableName, false, false);
|
||||
} catch (SQLException e) {
|
||||
log.warn("warn: ignore " + databaseName + "." + tableName);
|
||||
log.warn("warn: ignore " + databaseName + "." + tableName + ", error=" + e.getMessage());
|
||||
return indexMetas;
|
||||
}
|
||||
|
||||
Map<String, IndexMeta> pojoGroupByName = new HashMap<>();
|
||||
try {
|
||||
while (indexResults.next()) {
|
||||
Boolean nonUnique = indexResults.getBoolean("NON_UNIQUE");
|
||||
String indexName = indexResults.getString("INDEX_NAME");
|
||||
|
@ -53,6 +54,9 @@ public class JdbcIndexMetaRepository implements IndexMetaRepository {
|
|||
pojoGroupByName.put(indexName, indexMeta);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
indexResults.close();
|
||||
}
|
||||
return new ArrayList<>(pojoGroupByName.values());
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public class JdbcTableMetaRepository implements TableMetaRepository {
|
|||
String databaseName = condition.getDatabaseName();
|
||||
ResultSet tablesResult = connection.getMetaData()
|
||||
.getTables(databaseName, condition.getSchemaName(), null, new String[]{"TABLE"});
|
||||
try {
|
||||
while (tablesResult.next()) {
|
||||
String tableName = tablesResult.getString("TABLE_NAME");
|
||||
if (condition.tableIsIgnored(tableName)) {
|
||||
|
@ -69,6 +70,9 @@ public class JdbcTableMetaRepository implements TableMetaRepository {
|
|||
tableMetas.add(tableMeta);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
tablesResult.close();
|
||||
}
|
||||
return tableMetas;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue