echo "\t\t\t</select>\n";
echo "\t\t</td>\n\t</tr>\n";
+ // ENCODING
echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strencoding']}</th>\n";
echo "\t\t<td class=\"data1\">\n";
echo "\t\t\t<select name=\"formEncoding\">\n";
echo "\t\t\t</select>\n";
echo "\t\t</td>\n\t</tr>\n";
+ if ($data->hasDatabaseCollation()) {
+ if (!isset($_POST['formCollate'])) $_POST['formCollate'] = '';
+ if (!isset($_POST['formCType'])) $_POST['formCType'] = '';
+
+ // LC_COLLATE
+ echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strcollation']}</th>\n";
+ echo "\t\t<td class=\"data1\">\n";
+ echo "\t\t\t<input name=\"formCollate\" value=\"", htmlspecialchars($_POST['formCollate']), "\" />\n";
+ echo "\t\t</td>\n\t</tr>\n";
+
+ // LC_CTYPE
+ echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strctype']}</th>\n";
+ echo "\t\t<td class=\"data1\">\n";
+ echo "\t\t\t<input name=\"formCType\" value=\"", htmlspecialchars($_POST['formCType']), "\" />\n";
+ echo "\t\t</td>\n\t</tr>\n";
+ }
+
// Tablespace (if there are any)
if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) {
echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strtablespace']}</th>\n";
// Check that they've given a name and a definition
if ($_POST['formName'] == '') doCreate($lang['strdatabaseneedsname']);
else {
- $status = $data->createDatabase($_POST['formName'], $_POST['formEncoding'], $_POST['formSpc'], $_POST['formComment'], $_POST['formTemplate']);
+ $status = $data->createDatabase($_POST['formName'], $_POST['formEncoding'], $_POST['formSpc'],
+ $_POST['formComment'], $_POST['formTemplate'], $_POST['formCollate'], $_POST['formCType']);
if ($status == 0) {
$_reload_browser = true;
doDefault($lang['strdatabasecreated']);
'title' => $lang['strencoding'],
'field' => field('datencoding'),
),
+ 'lc_collate' => array(
+ 'title' => $lang['strcollation'],
+ 'field' => field('datcollate'),
+ ),
+ 'lc_ctype' => array(
+ 'title' => $lang['strctype'],
+ 'field' => field('datctype'),
+ ),
'tablespace' => array(
'title' => $lang['strtablespace'],
'field' => field('tablespace'),
if (!$data->hasTablespaces()) unset($columns['tablespace']);
if (!$data->hasServerAdminFuncs()) unset($columns['dbsize']);
+ if (!$data->hasDatabaseCollation()) unset($columns['lc_collate'], $columns['lc_ctype']);
if (!isset($data->privlist['database'])) unset($actions['privileges']);
$misc->printTable($databases, $columns, $actions, $lang['strnodatabases']);
/**
* Return all database available on the server
+ * @param $currentdatabase database name that should be on top of the resultset
+ *
* @return A list of databases, sorted alphabetically
*/
function getDatabases($currentdatabase = NULL) {
else
$where = ' AND pdb.datallowconn';
- $sql = "SELECT pdb.datname AS datname, pr.rolname AS datowner, pg_encoding_to_char(encoding) AS datencoding,
- (SELECT description FROM pg_catalog.pg_shdescription pd WHERE pdb.oid=pd.objoid) AS datcomment,
- (SELECT spcname FROM pg_catalog.pg_tablespace pt WHERE pt.oid=pdb.dattablespace) AS tablespace,
- pg_catalog.pg_database_size(pdb.oid) as dbsize
- FROM pg_catalog.pg_database pdb LEFT JOIN pg_catalog.pg_roles pr ON (pdb.datdba = pr.oid)
- WHERE true
- {$where}
- {$clause}
- {$orderby}";
+ $sql = "
+ SELECT pdb.datname AS datname, pr.rolname AS datowner, pg_encoding_to_char(encoding) AS datencoding,
+ (SELECT description FROM pg_catalog.pg_shdescription pd WHERE pdb.oid=pd.objoid) AS datcomment,
+ (SELECT spcname FROM pg_catalog.pg_tablespace pt WHERE pt.oid=pdb.dattablespace) AS tablespace,
+ pg_catalog.pg_database_size(pdb.oid) as dbsize, pdb.datcollate, pdb.datctype
+ FROM pg_catalog.pg_database pdb
+ LEFT JOIN pg_catalog.pg_roles pr ON (pdb.datdba = pr.oid)
+ WHERE true
+ {$where}
+ {$clause}
+ {$orderby}";
return $this->selectSet($sql);
}
* @return -1 tablespace error
* @return -2 comment error
*/
- function createDatabase($database, $encoding, $tablespace = '', $comment = '', $template = 'template1') {
+ function createDatabase($database, $encoding, $tablespace = '', $comment = '', $template = 'template1',
+ $lc_collate = '', $lc_ctype = '')
+ {
$this->fieldClean($database);
$this->clean($encoding);
$this->fieldClean($tablespace);
- $this->fieldClean($comment);
$this->fieldClean($template);
+ $this->clean($lc_collate);
+ $this->clean($lc_ctype);
$sql = "CREATE DATABASE \"{$database}\" WITH TEMPLATE=\"{$template}\"";
if ($encoding != '') $sql .= " ENCODING='{$encoding}'";
+ if ($lc_collate != '') $sql .= " LC_COLLATE='{$lc_collate}'";
+ if ($lc_ctype != '') $sql .= " LC_CTYPE='{$lc_ctype}'";
if ($tablespace != '' && $this->hasTablespaces()) $sql .= " TABLESPACE \"{$tablespace}\"";
$status = $this->execute($sql);
if ($status != 0) return -1;
+ $this->fieldClean($comment);
if ($comment != '' && $this->hasSharedComments()) {
$status = $this->setComment('DATABASE',$database,'',$comment);
if ($status != 0) return -2;
function hasVirtualTransactionId() { return true; }
function hasWithoutOIDs() { return true; }
function hasAlterDatabase() { return $this->hasAlterDatabaseRename(); }
+ function hasDatabaseCollation() { return true; }
function hasMagicTypes() { return true; }
function hasQueryKill() { return true; }
function hasConcurrentIndexBuild() { return true; }
return $this->help_page;
}
+ // Databse functions
+
+ /**
+ * Return all database available on the server
+ * @param $currentdatabase database name that should be on top of the resultset
+ *
+ * @return A list of databases, sorted alphabetically
+ */
+ function getDatabases($currentdatabase = NULL) {
+ global $conf, $misc;
+
+ $server_info = $misc->getServerInfo();
+
+ if (isset($conf['owned_only']) && $conf['owned_only'] && !$this->isSuperUser($server_info['username'])) {
+ $username = $server_info['username'];
+ $this->clean($username);
+ $clause = " AND pr.rolname='{$username}'";
+ }
+ else $clause = '';
+
+ if ($currentdatabase != NULL)
+ $orderby = "ORDER BY pdb.datname = '{$currentdatabase}' DESC, pdb.datname";
+ else
+ $orderby = "ORDER BY pdb.datname";
+
+ if (!$conf['show_system'])
+ $where = ' AND NOT pdb.datistemplate';
+ else
+ $where = ' AND pdb.datallowconn';
+
+ $sql = "
+ SELECT pdb.datname AS datname, pr.rolname AS datowner, pg_encoding_to_char(encoding) AS datencoding,
+ (SELECT description FROM pg_catalog.pg_shdescription pd WHERE pdb.oid=pd.objoid) AS datcomment,
+ (SELECT spcname FROM pg_catalog.pg_tablespace pt WHERE pt.oid=pdb.dattablespace) AS tablespace,
+ pg_catalog.pg_database_size(pdb.oid) as dbsize
+ FROM pg_catalog.pg_database pdb LEFT JOIN pg_catalog.pg_roles pr ON (pdb.datdba = pr.oid)
+ WHERE true
+ {$where}
+ {$clause}
+ {$orderby}";
+
+ return $this->selectSet($sql);
+ }
+
function hasAutovacuumSysTable() { return true; }
function hasQueryKill() { return false; }
+ function hasDatabaseCollation() { return false; }
}
$lang['strselectall'] = 'Select all';
$lang['strunselectall'] = 'Unselect all';
$lang['strlocale'] = 'Locale';
+ $lang['strcollation'] = 'Collation';
+ $lang['strctype'] = 'Character Type';
// User-supplied SQL history
$lang['strhistory'] = 'History';
$lang['stralter'] = 'Modifier';
$lang['strok'] = 'OK';
$lang['strcancel'] = 'Annuler';
+$lang['strkill'] = 'Kill';
$lang['strac'] = 'Activer la complétion automatique';
$lang['strsave'] = 'Sauvegarder';
$lang['strreset'] = 'Réinitialiser';
$lang['strselectall'] = 'Sélectionner tout';
$lang['strunselectall'] = 'Desélectionner tout';
$lang['strlocale'] = 'Locale';
+ $lang['strcollation'] = 'Tri';
+ $lang['strctype'] = 'Type de cartactère';
// User-supplied SQL history
$lang['strhistory'] = 'Historique';
$lang['strcannotdumponwindows'] = 'La sauvegarde de table complexe et des noms de schémas n\'est pas supporté sur Windows.';
$lang['strinvalidserverparam'] = 'Tentative de connexion avec un serveur invalide, il est possible que quelqu\'un essai de pirater votre système.';
$lang['strnoserversupplied'] = 'Aucun serveur fournis !';
+$lang['strbadpgdumppath'] = 'Export error: Failed to execute pg_dump (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
+$lang['strbadpgdumpallpath'] = 'Export error: Failed to execute pg_dumpall (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
// Tables
$lang['strtable'] = 'Table';
$lang['strdatabasealtered'] = 'Base de données modifiée.';
$lang['strdatabasealteredbad'] = 'Échec lors de la modification de la base de données.';
$lang['strspecifydatabasetodrop'] = 'Vous devez spécifier au moins une base de données à supprimer';
+$lang['strtemplatedb'] = 'Template';
// Views
$lang['strview'] = 'Vue';
$lang['strconfcluster'] = 'Êtes-vous sur de vouloir mettre en cluster « %s » ?';
$lang['strclusteredgood'] = 'Cluster effectué.';
$lang['strclusteredbad'] = 'Échec du cluster.';
+$lang['strconcurrently'] = 'Concurrently';
// Rules
$lang['strrules'] = 'Règles';
$lang['strselectall'] = 'Select all';
$lang['strunselectall'] = 'Unselect all';
$lang['strlocale'] = 'Locale';
+ $lang['strcollation'] = 'Collation';
+ $lang['strctype'] = 'Character Type';
// User-supplied SQL history
$lang['strhistory'] = 'History';
$lang['stralter'] = 'Modifier';
$lang['strok'] = 'OK';
$lang['strcancel'] = 'Annuler';
+$lang['strkill'] = 'Kill';
$lang['strac'] = 'Activer la complétion automatique';
$lang['strsave'] = 'Sauvegarder';
$lang['strreset'] = 'Réinitialiser';
$lang['strfile'] = 'Fichier';
$lang['strfileimported'] = 'Fichier importé.';
$lang['strtrycred'] = 'Utilisez ces identifiants pour tous les serveurs';
+$lang['strconfdropcred'] = 'For security reason, disconnecting will destroy your shared login information. Are you sure you want to disconnect ?';
$lang['stractionsonmultiplelines'] = 'Actions sur plusieurs lignes';
$lang['strselectall'] = 'Sélectionner tout';
$lang['strunselectall'] = 'Desélectionner tout';
$lang['strlocale'] = 'Locale';
+ $lang['strcollation'] = 'Tri';
+ $lang['strctype'] = 'Type de cartactère';
// User-supplied SQL history
$lang['strhistory'] = 'Historique';
$lang['strcannotdumponwindows'] = 'La sauvegarde de table complexe et des noms de schémas n\'est pas supporté sur Windows.';
$lang['strinvalidserverparam'] = 'Tentative de connexion avec un serveur invalide, il est possible que quelqu\'un essai de pirater votre système.';
$lang['strnoserversupplied'] = 'Aucun serveur fournis !';
+$lang['strbadpgdumppath'] = 'Export error: Failed to execute pg_dump (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
+$lang['strbadpgdumpallpath'] = 'Export error: Failed to execute pg_dumpall (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
// Tables
$lang['strtable'] = 'Table';
$lang['strspecifytabletoempty'] = 'Vous devez spécifier au moins une table à vider';
$lang['strspecifytabletodrop'] = 'Vous devez spécifier au moins une table à supprimer';
$lang['strspecifytabletovacuum'] = 'Vous devez spécifier au moins une table sur laquelle effectuer le vacuum';
+ $lang['strnofieldsforinsert'] = 'Vous ne pouvez insérer de données dans une table sans champs.';
// Columns
$lang['strcolprop'] = 'Propriétés de la Colonne';
$lang['strdatabasealtered'] = 'Base de données modifiée.';
$lang['strdatabasealteredbad'] = 'Échec lors de la modification de la base de données.';
$lang['strspecifydatabasetodrop'] = 'Vous devez spécifier au moins une base de données à supprimer';
+$lang['strtemplatedb'] = 'Template';
// Views
$lang['strview'] = 'Vue';
$lang['strconfcluster'] = 'Êtes-vous sur de vouloir mettre en cluster « %s » ?';
$lang['strclusteredgood'] = 'Cluster effectué.';
$lang['strclusteredbad'] = 'Échec du cluster.';
+$lang['strconcurrently'] = 'Concurrently';
// Rules
$lang['strrules'] = 'Règles';