增加对大写字母的表名的适配

This commit is contained in:
Yu Sun
2022-07-14 00:13:57 +08:00
parent 0258d6bb9d
commit cea11228cd
2 changed files with 14 additions and 15 deletions

View File

@@ -56,8 +56,8 @@ class EDataCapture {
foreach ($this -> data as $code => $value) {
foreach (array_chunk($value, 6710885, true) as $chunk) {
$sql_head = sprintf(
"INSERT INTO hf_mes_scada_data_capture_node_data_%s (code, v_%s, device_code, batch)
VALUES",
'INSERT INTO "hf_mes_scada_data_capture_node_data_%s" (code, v_%s, device_code, batch)
VALUES',
$this -> working_subclass,
$this -> code_type[$code]
);
@@ -101,9 +101,9 @@ class EDataCapture {
});
$sql_cmd = sprintf(
"SELECT id, code, COALESCE(v_string, v_int::text, v_float::text, v_bool::text) AS value, device_code, batch, capture_time
FROM hf_mes_scada_data_capture_node_data_%s
WHERE capture_time >= '%s' AND capture_time <= '%s'",
'SELECT id, code, COALESCE(v_string, v_int::text, v_float::text, v_bool::text) AS value, device_code, batch, capture_time
FROM "hf_mes_scada_data_capture_node_data_%s"
WHERE capture_time >= \'%s\' AND capture_time <= \'%s\'',
$this -> get['working_subclass'],
date("Y-m-d H:i:s", $this -> get['start_time'] / 1000),
date("Y-m-d H:i:s", $this -> get['end_time'] / 1000)
@@ -111,7 +111,7 @@ class EDataCapture {
if (isset($this -> get['code']))
$sql_cmd .= sprintf(" AND code = '%s'", $this -> get['code']);
$res = pg_fetch_all(pg_query($this -> dbconn, $sql_cmd));
if (count($res) > 2e6)