Set postgres-specific schema options + fix indentation

release-0.6
thomascube 16 years ago
parent 871ca9adfe
commit e905db1305

@ -1,5 +1,6 @@
<?php <?php
/* /*
#!/usr/bin/php
+-----------------------------------------------------------------------+ +-----------------------------------------------------------------------+
| bin/dumpschema.php | | bin/dumpschema.php |
@ -45,11 +46,18 @@ $options = array(
'quote_identifier' => true, 'quote_identifier' => true,
'force_defaults' => false, 'force_defaults' => false,
'portability' => false, 'portability' => false,
'disable_smart_seqname' => true,
'seqname_format' => '%s'
); );
$schema =& MDB2_Schema::factory($config->get('db_dsnw'), $options); $dsnw = $config->get('db_dsnw');
$dsn_array = MDB2::parseDSN($dsnw);
// set options for postgres databases
if ($dsn_array['phptype'] == 'pgsql') {
$options['disable_smart_seqname'] = true;
$options['seqname_format'] = '%s';
}
$schema =& MDB2_Schema::factory($dsnw, $options);
$schema->db->supported['transactions'] = false; $schema->db->supported['transactions'] = false;
@ -68,6 +76,8 @@ else {
); );
$definition = $schema->getDefinitionFromDatabase(); $definition = $schema->getDefinitionFromDatabase();
$definition['charset'] = 'utf8';
if (PEAR::isError($definition)) { if (PEAR::isError($definition)) {
$error = $definition->getMessage() . ' ' . $definition->getUserInfo(); $error = $definition->getMessage() . ' ' . $definition->getUserInfo();
} }
@ -81,7 +91,7 @@ else {
$schema->disconnect(); $schema->disconnect();
//if ($error) if ($error && !$_SERVER['REMOTE_ADDR'])
// fputs(STDERR, $error); fputs(STDERR, $error);
?> ?>

@ -86,9 +86,9 @@ class rcube_mdb2
'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL); 'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
if ($this->db_provider == 'pgsql') { if ($this->db_provider == 'pgsql') {
$db_options['disable_smart_seqname'] = true; $db_options['disable_smart_seqname'] = true;
$db_options['seqname_format'] = '%s'; $db_options['seqname_format'] = '%s';
} }
$dbh = MDB2::connect($dsn, $db_options); $dbh = MDB2::connect($dsn, $db_options);

Loading…
Cancel
Save