diff --git a/config/db_schema.pgsql b/config/db_schema.pgsql index b7a556bd..11bf6d56 100644 --- a/config/db_schema.pgsql +++ b/config/db_schema.pgsql @@ -94,10 +94,11 @@ INSERT INTO ocp_system_config (assoc_id, name, "desc") values (1,'System 0','Def CREATE SEQUENCE ocp_tools_config_id_seq; CREATE TABLE ocp_tools_config ( id integer Primary KEY DEFAULT nextval('ocp_tools_config_id_seq'), - module text NOT NULL UNIQUE, - param text NOT NULL UNIQUE, + module text NOT NULL, + param text NOT NULL, value text DEFAULT NULL, - box_id text DEFAULT '' UNIQUE + box_id text DEFAULT '', + UNIQUE(module, param, box_id) ); -- -------------------------------------------------------- diff --git a/web/tools/admin/tools_config/tools_config.php b/web/tools/admin/tools_config/tools_config.php index a423f6a6..c868903a 100644 --- a/web/tools/admin/tools_config/tools_config.php +++ b/web/tools/admin/tools_config/tools_config.php @@ -80,7 +80,13 @@ } continue; } - $sql = "INSERT INTO ".$table." (module, param, value) VALUES (?,?,?) ON DUPLICATE KEY UPDATE module=?,param=?,value=?"; + + if ($config->db_driver == "mysql") { + $sql = "INSERT INTO ".$table." (module, param, value) VALUES (?,?,?) ON DUPLICATE KEY UPDATE module=?,param=?,value=?"; + } else if ($config->db_driver == "pgsql") { + $sql = "INSERT INTO ".$table." (module, param, value) VALUES (?,?,?) ON CONFLICT(module, param, box_id) DO UPDATE SET module=?,param=?,value=?"; + } + $stm = $link->prepare($sql); if ($stm === false) { die('Failed to issue query ['.$sql.'], error message : ' . print_r($link->errorInfo(), true));