10 defined(
'JPATH_PLATFORM') or die;
29 protected function buildXml()
33 $buffer[] =
'<?xml version="1.0"?>';
34 $buffer[] =
'<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
35 $buffer[] =
' <database name="">';
37 $buffer = array_merge($buffer, $this->buildXmlStructure());
39 $buffer[] =
' </database>';
40 $buffer[] =
'</mysqldump>';
42 return implode(
"\n", $buffer);
53 protected function buildXmlStructure()
57 foreach ($this->from as $table)
60 $table = $this->getGenericTableName($table);
63 $fields = $this->db->getTableColumns($table,
false);
64 $keys = $this->db->getTableKeys($table);
66 $buffer[] =
' <table_structure name="' . $table .
'">';
68 foreach ($fields as $field)
70 $buffer[] =
' <field Field="' . $field->Field .
'"' .
' Type="' . $field->Type .
'"' .
' Null="' . $field->Null .
'"' .
' Key="' .
71 $field->Key .
'"' . (isset($field->Default) ?
' Default="' . $field->Default .
'"' :
'') .
' Extra="' . $field->Extra .
'"' .
75 foreach ($keys as $key)
77 $buffer[] =
' <key Table="' . $table .
'"' .
' Non_unique="' . $key->Non_unique .
'"' .
' Key_name="' . $key->Key_name .
'"' .
78 ' Seq_in_index="' . $key->Seq_in_index .
'"' .
' Column_name="' . $key->Column_name .
'"' .
' Collation="' . $key->Collation .
'"' .
79 ' Null="' . $key->Null .
'"' .
' Index_type="' . $key->Index_type .
'"' .
' Comment="' . htmlspecialchars($key->Comment) .
'"' .
83 $buffer[] =
' </table_structure>';
97 public function check()
102 throw new Exception(
'JPLATFORM_ERROR_DATABASE_CONNECTOR_WRONG_TYPE');
106 if (empty($this->from))
108 throw new Exception(
'JPLATFORM_ERROR_NO_TABLES_SPECIFIED');