From e4ac6834b633d7cc9a88dd7438610cd88b950579 Mon Sep 17 00:00:00 2001 From: jsatoh Date: Sat, 24 Mar 2012 14:31:23 +0000 Subject: [PATCH] 2012-03-24 Junichi Satoh * include/db/postgresql.php: Fixed SQL error with PostgreSQL. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5828 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 4 ++++ pandora_console/include/db/postgresql.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e468762221..c138b0e19a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,7 @@ +2012-03-24 Junichi Satoh + + * include/db/postgresql.php: Fixed SQL error with PostgreSQL. + 2012-03-24 Junichi Satoh * operation/agentes/status_monitor.php: Fixed SQL error with PostgreSQL. diff --git a/pandora_console/include/db/postgresql.php b/pandora_console/include/db/postgresql.php index 2d3c2628d6..25c294c801 100644 --- a/pandora_console/include/db/postgresql.php +++ b/pandora_console/include/db/postgresql.php @@ -57,6 +57,9 @@ function postgresql_connect_db($host = null, $db = null, $user = null, $pass = n * @return mixed Value of first column of the first row. False if there were no row. */ function postgresql_db_get_value ($field, $table, $field_search = 1, $condition = 1, $search_history_db = false) { + if ($field_search[0] == '`') + $field_search = str_replace ('`', '', $field_search); + if (is_int ($condition)) { $sql = sprintf ("SELECT %s FROM %s WHERE %s = %d LIMIT 1", $field, $table, $field_search, $condition);