2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Abstract class for the export plugins
8 if (! defined('PHPMYADMIN')) {
12 /* This class extends the PluginObserver class */
13 require_once 'PluginObserver.class.php';
16 * Provides a common interface that will have to be implemented by all of the
17 * export plugins. Some of the plugins will also implement other public
18 * methods, but those are not declared here, because they are not implemented
19 * by all export plugins.
23 abstract class ExportPlugin
extends PluginObserver
26 * Array containing the specific export plugin type properties
30 protected $properties;
33 * Common methods, must be overwritten by all export plugins
38 * Outputs export header
40 * @return bool Whether it succeeded
42 abstract public function exportHeader ();
45 * Outputs export footer
47 * @return bool Whether it succeeded
49 abstract public function exportFooter ();
52 * Outputs database header
54 * @param string $db Database name
56 * @return bool Whether it succeeded
58 abstract public function exportDBHeader ($db);
61 * Outputs database footer
63 * @param string $db Database name
65 * @return bool Whether it succeeded
67 abstract public function exportDBFooter ($db);
70 * Outputs CREATE DATABASE statement
72 * @param string $db Database name
74 * @return bool Whether it succeeded
76 abstract public function exportDBCreate($db);
79 * Outputs the content of a table
81 * @param string $db database name
82 * @param string $table table name
83 * @param string $crlf the end of line sequence
84 * @param string $error_url the url to go back in case of error
85 * @param string $sql_query SQL query for obtaining data
87 * @return bool Whether it succeeded
89 abstract public function exportData ($db, $table, $crlf, $error_url, $sql_query);
93 * The following methods are used in export.php or in db_operations.php,
94 * but they are not implemented by all export plugins
99 * Exports routines (procedures and functions)
101 * @param string $db Database
103 * @return bool Whether it succeeded
105 public function exportRoutines($db)
111 * Outputs table's structure
113 * @param string $db database name
114 * @param string $table table name
115 * @param string $crlf the end of line sequence
116 * @param string $error_url the url to go back in case of error
117 * @param string $export_mode 'create_table','triggers','create_view',
119 * @param string $export_type 'server', 'database', 'table'
120 * @param bool $relation whether to include relation comments
121 * @param bool $comments whether to include the pmadb-style column comments
122 * as comments in the structure; this is deprecated
123 * but the parameter is left here because export.php
124 * calls exportStructure() also for other export
125 * types which use this parameter
126 * @param bool $mime whether to include mime comments
127 * @param bool $dates whether to include creation/update/check dates
129 * @return bool Whether it succeeded
131 public function exportStructure(
147 * Returns a stand-in CREATE definition to resolve view dependencies
149 * @param string $db the database name
150 * @param string $view the view name
151 * @param string $crlf the end of line sequence
153 * @return string resulting definition
155 public function getTableDefStandIn($db, $view, $crlf)
163 * @param string $db database name
164 * @param string $table table name
166 * @return string Formatted triggers list
168 protected function getTriggers($db, $table)
174 * Initialize the specific variables for each export plugin
178 protected function initSpecificVariables()
184 /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
188 * Gets the export specific format plugin properties
192 public function getProperties()
194 return $this->properties
;
198 * Sets the export plugins properties and is implemented by each export
203 abstract protected function setProperties();