* Rearrange frame layout to suit multi-server support
* New browser tree with dynamically loading branches
(Using XLoadTree2 from http://webfx.eae.net/)
+* Avoid getting and setting encoding queries if possible
* Allow language change from the intro page at any time
Bugs
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.261 2005/05/02 15:47:26 chriskl Exp $
+ * $Id: Postgres.php,v 1.262 2005/06/02 11:31:02 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
* @return The encoding. eg. SQL_ASCII, UTF-8, etc.
*/
function getDatabaseEncoding() {
+ // Try to avoid a query if at all possible (5)
+ if (function_exists('pg_parameter_status')) {
+ $encoding = pg_parameter_status($this->conn->_connectionID, 'server_encoding');
+ if ($encoding !== false) return $encoding;
+ }
+
$sql = "SELECT getdatabaseencoding() AS encoding";
return $this->selectField($sql, 'encoding');
/**
* Function library read in upon startup
*
- * $Id: lib.inc.php,v 1.94 2005/05/02 15:47:28 chriskl Exp $
+ * $Id: lib.inc.php,v 1.95 2005/06/02 11:31:03 chriskl Exp $
*/
include_once('decorator.inc.php');
include_once('./lang/translations.php');
// Set client encoding to database encoding
if ($dbEncoding != '') {
- $status = $data->setClientEncoding($dbEncoding);
- if ($status != 0 && $status != -99) {
- echo $lang['strbadencoding'];
- exit;
+ // Explicitly change client encoding if it's different to server encoding.
+ if (pg_client_encoding($data->conn->_connectionID) != $dbEncoding) {
+ $status = $data->setClientEncoding($dbEncoding);
+ if ($status != 0 && $status != -99) {
+ echo $lang['strbadencoding'];
+ exit;
+ }
}
-
+
// Override $lang['appcharset']
if (isset($data->codemap[$dbEncoding]))
$lang['appcharset'] = $data->codemap[$dbEncoding];