| | |
| | | /** 工步层的共用读取窗口:足以覆盖一轮接收里工步与循环的连续调用,又不会压住新出现的工步行。 */ |
| | | private static final long CAP_STEP_CACHE_MS = 5000L; |
| | | private static final int SAMPLE_BATCH_LIMIT = 500; |
| | | /** |
| | | * 每条语句的查询截止时间。厂商库的服务端**没有**查询超时,客户端不设就是无限; |
| | | * JDBC URL 里的 {@code socketTimeout} 只管单次读,慢速滴流的查询仍可能长期占住连接。 |
| | | */ |
| | | private static final int QUERY_TIMEOUT_SECONDS = 10; |
| | | private static final Pattern SAFE_TABLE_NAME = Pattern.compile("[A-Za-z0-9_]{1,64}"); |
| | | /** 设备时间按适配器时区解释;来源列是秒精度 datetime,小数部分按需接受。 */ |
| | | private static final DateTimeFormatter DEVICE_TIME = new DateTimeFormatterBuilder() |
| | |
| | | Connection connection = dataSource.getConnection(); |
| | | try (PreparedStatement statement = connection.prepareStatement(sql)) |
| | | { |
| | | // 读取超时有两层:连接串的 socketTimeout 管单次读,这里给整条语句一个截止时间。 |
| | | statement.setQueryTimeout(QUERY_TIMEOUT_SECONDS); |
| | | for (int index = 0; index < parameters.length; index++) |
| | | statement.setObject(index + 1, parameters[index]); |
| | | try (ResultSet rows = statement.executeQuery()) |