2012-04-08 Junichi Satoh <junichi@rworks.jp>

* include/db/postgresql.php, include/functions_config.php,
	godmode/massive/massive_delete_modules.php,
	godmode/massive/massive_edit_modules.php: Fixed SQL error with
	PostgreSQL.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5910 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2012-04-08 12:43:18 +00:00
parent 5f6d61a6f9
commit 647ac2625a
5 changed files with 52 additions and 17 deletions

View File

@ -1,3 +1,10 @@
2012-04-08 Junichi Satoh <junichi@rworks.jp>
* include/db/postgresql.php, include/functions_config.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_edit_modules.php: Fixed SQL error with
PostgreSQL.
2012-04-08 Junichi Satoh <junichi@rworks.jp>
* godmode/admin_access_logs.php: Fixed SQL error with PostgreSQL.

View File

@ -170,13 +170,27 @@ if ($delete) {
$groups = users_get_groups ();
$agents = agents_get_group_agents (array_keys (users_get_groups ()), false, "none");
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
'id_agente' => array_keys ($agents),
'disabled' => 0,
'order' => 'ttipo_modulo.nombre'),
array ('DISTINCT(id_tipo)',
'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description'));
switch ($config["dbtype"]) {
case "mysql":
case "oracle":
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
'id_agente' => array_keys ($agents),
'disabled' => 0,
'order' => 'ttipo_modulo.nombre'),
array ('DISTINCT(id_tipo)',
'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description'));
break;
case "postgresql":
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
'id_agente' => array_keys ($agents),
'disabled' => 0,
'order' => 'description'),
array ('DISTINCT(id_tipo)',
'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description'));
break;
}
if ($module_types === false)
$module_types = array ();

View File

@ -233,13 +233,27 @@ if (! $module_type) {
$table->rowstyle['edit7'] = 'display: none';
}
$agents = agents_get_group_agents (array_keys (users_get_groups ()), false, "none");
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
'id_agente' => array_keys ($agents),
'disabled' => 0,
'order' => 'ttipo_modulo.nombre'),
array ('DISTINCT(id_tipo)',
'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description'));
switch ($config["dbtype"]) {
case "mysql":
case "oracle":
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
'id_agente' => array_keys ($agents),
'disabled' => 0,
'order' => 'ttipo_modulo.nombre'),
array ('DISTINCT(id_tipo)',
'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description'));
break;
case "postgresql":
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
'id_agente' => array_keys ($agents),
'disabled' => 0,
'order' => 'description'),
array ('DISTINCT(id_tipo)',
'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description'));
break;
}
if ($module_types === false)
$module_types = array ();

View File

@ -540,7 +540,7 @@ function postgresql_db_format_array_where_clause_sql ($values, $join = 'AND', $p
foreach ($values as $field => $value) {
if (is_numeric ($field)) {
/* User provide the exact operation to do */
$query .= sprintf ("%s = %d", $field, $value);
$query .= $value;
if ($i < $max) {
$query .= ' '.$join.' ';
@ -729,7 +729,7 @@ function postgresql_db_get_all_rows_filter ($table, $filter = array(), $fields =
$filter = '';
}
$sql = sprintf ('SELECT %s FROM "%s" %s', $fields, $table, $filter);
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
if ($returnSQL)
return $sql;

View File

@ -677,7 +677,7 @@ function config_check (){
$now = date("U");
// First action in order to know if it's a new installation or db maintenance never have been executed
$first_action = db_get_value_filter('utimestamp', 'tsesion', array('1' => '1', 'order' => 'id_sesion ASC'));
$first_action = db_get_value_filter('utimestamp', 'tsesion', array('1 = 1', 'order' => 'id_sesion ASC'));
$fresh_installation = $now - $first_action;
$resta = $now - $db_maintance;