From f8a049f5c67d1aa708159d3400b33f6d019382a0 Mon Sep 17 00:00:00 2001 From: chriskl Date: Sun, 12 Oct 2003 08:55:11 +0000 Subject: [PATCH] yay - first working version of table structure output --- HISTORY | 1 + dataexport.php | 15 ++++++----- lang/english.php | 6 ++++- lang/recoded/english.php | 6 ++++- tblproperties.php | 56 ++++++++++++++++++++++++++++++---------- 5 files changed, 62 insertions(+), 22 deletions(-) diff --git a/HISTORY b/HISTORY index f3467efe..948ad194 100644 --- a/HISTORY +++ b/HISTORY @@ -5,6 +5,7 @@ Version 3.2-dev --------------- Features +* Option to dump table structure, data or structure and data * Extra login security to prevent logging into servers as postgres and no password - a VERY common newbie error. * Cluster indexes and indexed constraints (with analyze) diff --git a/dataexport.php b/dataexport.php index c75626c5..59cb2848 100644 --- a/dataexport.php +++ b/dataexport.php @@ -3,7 +3,7 @@ /** * Does an export to the screen or as a download * - * $Id: dataexport.php,v 1.3 2003/10/12 05:46:32 chriskl Exp $ + * $Id: dataexport.php,v 1.4 2003/10/12 08:55:11 chriskl Exp $ */ $extensions = array( @@ -42,10 +42,10 @@ // Set up the dump transaction $status = $localData->beginDump(); - // If the dump is not dataonly then dump the structure prefix - if (isset($_REQUEST['what']) && $_REQUEST['what'] != 'dataonly') { + // If the dump is not dataonly then dump the structure prefix + if (isset($_REQUEST['what']) && $_REQUEST['what'] != 'dataonly') { echo $localData->getTableDefPrefix($_REQUEST['table'], isset($_REQUEST['clean'])); - } + } // If the dump is not structureonly then dump the actual data if (isset($_REQUEST['what']) && $_REQUEST['what'] != 'structureonly') { @@ -61,7 +61,8 @@ else $rs = $localData->conn->Execute($_REQUEST['query']); - if ($_REQUEST['format'] == 'copy') { + if (($_REQUEST['format'] == 'copy' && $_REQUEST['what'] == 'dataonly') || + ($_REQUEST['what'] != 'dataonly' && $_REQUEST['format2'] == 'copy')) { $data->fieldClean($_REQUEST['table']); echo "COPY \"{$_REQUEST['table']}\""; if (isset($_REQUEST['oids'])) echo " WITH OIDS"; @@ -155,7 +156,8 @@ echo "\t\n"; echo "\n"; } - elseif ($_REQUEST['format'] == 'sql') { + elseif (($_REQUEST['format'] == 'sql' && $_REQUEST['what'] == 'dataonly') || + ($_REQUEST['what'] != 'dataonly' && $_REQUEST['format2'] == 'sql')) { $data->fieldClean($_REQUEST['table']); while (!$rs->EOF) { echo "INSERT INTO \"{$_REQUEST['table']}\" ("; @@ -270,6 +272,7 @@ echo "\n"; echo "

\n"; + echo "\n"; if (isset($_REQUEST['table'])) { echo "\n"; } diff --git a/lang/english.php b/lang/english.php index 8a805efe..7c14f185 100755 --- a/lang/english.php +++ b/lang/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.112 2003/10/10 09:29:50 chriskl Exp $ + * $Id: english.php,v 1.113 2003/10/12 08:55:11 chriskl Exp $ */ // Language and character set @@ -108,6 +108,7 @@ $lang['strrefresh'] = 'Refresh'; $lang['strdownload'] = 'Download'; $lang['strinfo'] = 'Info'; + $lang['stroids'] = 'OIDs'; // Error handling $lang['strnoframes'] = 'You need a frames-enabled browser to use this application.'; @@ -173,6 +174,9 @@ $lang['strcascade'] = 'CASCADE'; $lang['strtablealtered'] = 'Table altered.'; $lang['strtablealteredbad'] = 'Table alteration failed.'; + $lang['strdataonly'] = 'Data only'; + $lang['strstructureonly'] = 'Structure only'; + $lang['strstructureanddata'] = 'Structure and data'; // Users $lang['struser'] = 'User'; diff --git a/lang/recoded/english.php b/lang/recoded/english.php index 60820df7..1276ddb7 100644 --- a/lang/recoded/english.php +++ b/lang/recoded/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.64 2003/10/10 09:29:50 chriskl Exp $ + * $Id: english.php,v 1.65 2003/10/12 08:55:11 chriskl Exp $ */ // Language and character set @@ -108,6 +108,7 @@ $lang['strrefresh'] = 'Refresh'; $lang['strdownload'] = 'Download'; $lang['strinfo'] = 'Info'; + $lang['stroids'] = 'OIDs'; // Error handling $lang['strnoframes'] = 'You need a frames-enabled browser to use this application.'; @@ -173,6 +174,9 @@ $lang['strcascade'] = 'CASCADE'; $lang['strtablealtered'] = 'Table altered.'; $lang['strtablealteredbad'] = 'Table alteration failed.'; + $lang['strdataonly'] = 'Data only'; + $lang['strstructureonly'] = 'Structure only'; + $lang['strstructureanddata'] = 'Structure and data'; // Users $lang['struser'] = 'User'; diff --git a/tblproperties.php b/tblproperties.php index 498c6833..12fc0627 100644 --- a/tblproperties.php +++ b/tblproperties.php @@ -3,7 +3,7 @@ /** * List tables in a database * - * $Id: tblproperties.php,v 1.26 2003/10/01 15:50:30 soranzo Exp $ + * $Id: tblproperties.php,v 1.27 2003/10/12 08:55:11 chriskl Exp $ */ // Include application functions @@ -90,25 +90,52 @@ global $data, $localData, $misc; global $PHP_SELF, $lang; + // Determine whether or not the table has an object ID + $hasID = $localData->hasObjectID($_REQUEST['table']); + $misc->printTableNav(); echo "

", $misc->printVal($_REQUEST['database']), ": ", $misc->printVal($_REQUEST['table']), ": {$lang['strexport']}

\n"; $misc->printMsg($msg); echo "
\n"; echo "\n"; - echo "\t\n\t\t\n"; - echo "\t\t\n\t\n"; - echo "\t\n\t\t\n"; - echo "\t\t\n\t\n"; - echo "\t\n\t\t\n"; - echo "\t\t\n\t\n"; + echo "\n"; + // Data only + echo "\n"; + echo "\n"; + echo "\n\n"; + if ($hasID) { + echo "\n\n"; + } + // Structure only + echo "\n"; + echo "\n\n"; + // Structure and data + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "\n\n"; + if ($hasID) { + echo "\n\n"; + } + echo "
{$lang['strformat']}\n\t\t\t\n\t\t
OIDS?
Download?
{$lang['strformat']}{$lang['stroptions']}
"; + echo "{$lang['strdataonly']}{$lang['strformat']}\n
{$lang['stroids']}
{$lang['strstructureonly']}{$lang['strdrop']}
"; + echo "{$lang['strstructureanddata']}{$lang['strformat']}\n
{$lang['strdrop']}
{$lang['stroids']}
\n"; + + echo "

{$lang['stroptions']}

\n"; + echo "\n"; + echo "\n\n"; + echo "\n\n"; echo "
{$lang['strdownload']}
\n"; echo "

\n"; @@ -259,6 +286,7 @@ $status = $localData->alterColumn($_REQUEST['table'], $_REQUEST['column'], $_REQUEST['field'], isset($_REQUEST['notnull']), $_REQUEST['default'], $_REQUEST['olddefault']); +echo "status: $status"; if ($status == 0) doDefault($lang['strcolumnaltered']); else { -- 2.39.5