示例#1
0
 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param string $export_mode 'create_table', 'triggers', 'create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  *                                export types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false)
 {
     $dump = '';
     switch ($export_mode) {
         case 'create_table':
             $dump .= '<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
             break;
         case 'triggers':
             $dump = '';
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $dump .= '<h2>' . __('Triggers') . ' ' . htmlspecialchars($table) . '</h2>';
                 $dump .= PMA_getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $dump .= '<h2>' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
             break;
         case 'stand_in':
             $dump .= '<h2>' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             // export a stand-in definition to resolve view dependencies
             $dump .= PMA_getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     return PMA_exportOutputHandler($dump);
 }
示例#2
0
 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param string $export_mode 'create_table', 'triggers', 'create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false)
 {
     switch ($export_mode) {
         case 'create_table':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</text:h>';
             PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
             break;
         case 'triggers':
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Triggers') . ' ' . htmlspecialchars($table) . '</text:h>';
                 PMA_getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</text:h>';
             PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
             break;
         case 'stand_in':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</text:h>';
             // export a stand-in definition to resolve view dependencies
             PMA_getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     return true;
 }