提早事务开始的位置
This commit is contained in:
@@ -9,6 +9,7 @@ class ENodeConfigure {
|
||||
) {}
|
||||
|
||||
function add_node() {
|
||||
pg_query($this -> dbconn, "BEGIN");
|
||||
$exists = pg_query($this -> dbconn, sprintf(
|
||||
"SELECT EXISTS(
|
||||
SELECT 1 FROM hf_mes_scada_data_capture_node_configure
|
||||
@@ -16,12 +17,13 @@ class ENodeConfigure {
|
||||
AND working_subclass = '%s'
|
||||
)", $this -> post -> code, $this -> post -> working_subclass
|
||||
));
|
||||
if (pg_fetch_assoc($exists)['exists'] == 't') {
|
||||
if (pg_fetch_assoc($exists)['exists'] === 't') {
|
||||
pg_query($this -> dbconn, "ROLLBACK");
|
||||
return "REPLICATED";
|
||||
}
|
||||
|
||||
$table_name = 'hf_mes_scada_data_capture_node_data_' . $this -> post -> working_subclass;
|
||||
pg_query($this -> dbconn, "BEGIN");
|
||||
// https://www.postgresql.org/docs/current/when-can-parallel-query-be-used.html
|
||||
$res[] = pg_query($this -> dbconn, sprintf(
|
||||
'CREATE TABLE IF NOT EXISTS "%s" (
|
||||
id serial8,
|
||||
|
||||
Reference in New Issue
Block a user