"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mrbs-1.9.4/web/lib/MRBS/DB_pgsql.php" between
mrbs-1.9.4.tar.gz and mrbs-1.10.0.tar.gz

About: MRBS is a web application for booking meeting rooms or other resources (using PHP and MySQL/pgsql).

DB_pgsql.php  (mrbs-1.9.4):DB_pgsql.php  (mrbs-1.10.0)
<?php <?php
namespace MRBS; namespace MRBS;
use PDO;
use PDOException; use PDOException;
// //
class DB_pgsql extends DB class DB_pgsql extends DB
{ {
const DB_DEFAULT_PORT = 5432; const DB_DEFAULT_PORT = 5432;
const DB_DBO_DRIVER = "pgsql"; const DB_DBO_DRIVER = "pgsql";
public function __construct($db_host, $db_username, $db_password, $db_name, $p ersist=false, $db_port=null) public function __construct($db_host, $db_username, $db_password, $db_name, $p ersist=false, $db_port=null)
{ {
skipping to change at line 294 skipping to change at line 293
// Generate non-standard SQL for LIMIT clauses: // Generate non-standard SQL for LIMIT clauses:
public function syntax_limit($count, $offset) public function syntax_limit($count, $offset)
{ {
return " LIMIT $count OFFSET $offset "; return " LIMIT $count OFFSET $offset ";
} }
// Generate non-standard SQL to output a TIMESTAMP as a Unix-time: // Generate non-standard SQL to output a TIMESTAMP as a Unix-time:
public function syntax_timestamp_to_unix($fieldname) public function syntax_timestamp_to_unix($fieldname)
{ {
return " DATE_PART('epoch', $fieldname) "; // A PostgreSQL timestamp can be a float. We need to round it
// to the nearest integer.
return " ROUND(DATE_PART('epoch', $fieldname)) ";
} }
// Returns the syntax for a case sensitive string "equals" function // Returns the syntax for a case sensitive string "equals" function
// //
// Also takes a required pass-by-reference parameter to modify the SQL // Also takes a required pass-by-reference parameter to modify the SQL
// parameters appropriately. // parameters appropriately.
// //
// NB: This function is also assumed to do a strict comparison, ie // NB: This function is also assumed to do a strict comparison, ie
// take account of training spaces. (The '=' comparison in MySQL allows // take account of training spaces. (The '=' comparison in MySQL allows
// trailing spaces, eg 'john' = 'john '). // trailing spaces, eg 'john' = 'john ').
skipping to change at line 362 skipping to change at line 363
break; break;
default: default:
throw new Exception("Invalid value ($part) given for " . '$part.'); throw new Exception("Invalid value ($part) given for " . '$part.');
break; break;
} }
$params[] = $delimiter; $params[] = $delimiter;
return "SPLIT_PART($fieldname, ?, $count)"; return "SPLIT_PART($fieldname, ?, $count)";
} }
// Returns the syntax for aggregating a number of rows as a delimited string
public function syntax_group_array_as_string($fieldname, $delimiter=',')
{
// array_agg introduced in PostgreSQL version 8.4
//
// Use DISTINCT to eliminate duplicates which can arise when the query
// has joins on two or more junction tables. Maybe a different query
// would eliminate the duplicates and the need for DISTINCT, and it may
// or may not be more efficient.
return "array_to_string(array_agg(DISTINCT $fieldname), '$delimiter')";
}
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)