Ejemplo n.º 1
0
 function formatError($ex)
 {
     $xml = new XMLBuilder();
     $xml->element("result");
     $xml->forward();
     $xml->element("error", $ex->getMessage());
     $xml->attribute("type", $ex->getException());
     $xml->back();
     $xml->back();
     echo $xml->getXML();
 }
 public function export_data($table)
 {
     if (!$table) {
         throw new InvalidParameterException("Il nome della tabella è nullo!");
     }
     $table_desc = new __MysqlTableFieldsDescription($table);
     $all_fields = $table_desc->getAllFields();
     $ss = new __MysqlSelect($table);
     $all_rows = $ss->exec_fetch_assoc_all();
     $xml_builder = new XMLBuilder();
     $xml_builder->element("table");
     $xml_builder->attribute("name", $table);
     $xml_builder->forward();
     foreach ($all_rows as $row) {
         $xml_builder->element("row");
         $xml_builder->forward();
         foreach ($all_fields as $k => $v) {
             $xml_builder->element("field", $row[$k], true);
             $xml_builder->attribute("name", $k);
         }
         $xml_builder->back();
     }
     return $xml_builder->getXML();
 }