| | |
| | | <?php |
| | | /* |
| | | #!/usr/bin/php |
| | | |
| | | +-----------------------------------------------------------------------+ |
| | | | bin/dumpschema.php | |
| | |
| | | 'quote_identifier' => true, |
| | | 'force_defaults' => 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; |
| | | |
| | | |
| | | |
| | | // send as text/xml when opened in browser |
| | | if ($_SERVER['REMOTE_ADDR']) |
| | | header('Content-Type: text/xml'); |
| | |
| | | ); |
| | | |
| | | $definition = $schema->getDefinitionFromDatabase(); |
| | | $definition['charset'] = 'utf8'; |
| | | |
| | | if (PEAR::isError($definition)) { |
| | | $error = $definition->getMessage() . ' ' . $definition->getUserInfo(); |
| | | } |
| | |
| | | |
| | | $schema->disconnect(); |
| | | |
| | | //if ($error) |
| | | // fputs(STDERR, $error); |
| | | if ($error && !$_SERVER['REMOTE_ADDR']) |
| | | fputs(STDERR, $error); |
| | | |
| | | ?> |