The branch, master has been updated via c03c7bbc69d7b05ad3290d3378d48f3debb80745 (commit) via 7f629c66ff17ecfe5502fdf3fdc389d4c4bb5851 (commit) via b349356a83ad44bfc657101337f08c760e3bdd75 (commit) via 79af2a937435c04ab04ec2c0540d01fd27d7e0a8 (commit) from 73bb9302b6dec3befea195cfdd9c95614281a639 (commit)
- Log ----------------------------------------------------------------- commit c03c7bbc69d7b05ad3290d3378d48f3debb80745 Author: Michal Čihař mcihar@suse.cz Date: Thu Jul 21 14:25:31 2011 +0200
Better formatting for code
commit 7f629c66ff17ecfe5502fdf3fdc389d4c4bb5851 Author: Michal Čihař mcihar@suse.cz Date: Thu Jul 21 14:22:01 2011 +0200
Remove method used only in single place as a function
commit b349356a83ad44bfc657101337f08c760e3bdd75 Author: Michal Čihař mcihar@suse.cz Date: Thu Jul 21 14:20:11 2011 +0200
Avoid storing table data when we don't need it
commit 79af2a937435c04ab04ec2c0540d01fd27d7e0a8 Author: Michal Čihař mcihar@suse.cz Date: Thu Jul 21 14:19:07 2011 +0200
Minimize need for escaping by using single quotes
-----------------------------------------------------------------------
Summary of changes: libraries/export/codegen.php | 33 ++++++++++++++++----------------- 1 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/libraries/export/codegen.php b/libraries/export/codegen.php index bc0dada..94971e8 100644 --- a/libraries/export/codegen.php +++ b/libraries/export/codegen.php @@ -123,8 +123,8 @@ function PMA_exportDBCreate($db) */ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { - global $CG_FORMATS, $CG_HANDLERS; - $format = cgGetOption("format"); + global $CG_FORMATS, $CG_HANDLERS, $what; + $format = $GLOBALS[$what . '_format']; if (isset($CG_FORMATS[$format])) { return PMA_exportOutputHandler($CG_HANDLERS[$format]($db, $table, $crlf)); } @@ -287,7 +287,7 @@ class TableProperty
function handleNHibernateXMLBody($db, $table, $crlf) { - $lines=array(); + $lines = array(); $lines[] = '<?xml version="1.0" encoding="utf-8" ?' . '>'; $lines[] = '<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" ' . 'namespace="' . cgMakeIdentifier($db) . '" ' @@ -295,26 +295,25 @@ class TableProperty $lines[] = ' <class name="' . cgMakeIdentifier($table) . '" table="' . cgMakeIdentifier($table) . '">'; $result = PMA_DBI_query(sprintf("DESC %s.%s", PMA_backquote($db), PMA_backquote($table))); if ($result) { - $tableProperties = array(); - while ($row = PMA_DBI_fetch_row($result)) - $tableProperties[] = new TableProperty($row); - foreach ($tableProperties as $tablePropertie) { + while ($row = PMA_DBI_fetch_row($result)) { + $tablePropertie = new TableProperty($row); if ($tablePropertie->isPK()) - $lines[] = $tablePropertie->formatXml(" <id name=\"#ucfirstName#\" type=\"#dotNetObjectType#\" unsaved-value=\"0\">\n <column name=\"#name#\" sql-type=\"#type#\" not-null=\"#notNull#\" unique=\"#unique#\" index=\"PRIMARY\"/>\n <generator class=\"native\" />\n </id>"); + $lines[] = $tablePropertie->formatXml('' + . ' <id name="#ucfirstName#" type="#dotNetObjectType#" unsaved-value="0">' . "\n" + . ' <column name="#name#" sql-type="#type#" not-null="#notNull#" unique="#unique#" index="PRIMARY"/>' . "\n" + . ' <generator class="native" />' . "\n" + . ' </id>'); else - $lines[] = $tablePropertie->formatXml(" <property name=\"#ucfirstName#\" type=\"#dotNetObjectType#\">\n <column name=\"#name#\" sql-type=\"#type#\" not-null=\"#notNull#\" #indexName#/>\n </property>"); + $lines[] = $tablePropertie->formatXml('' + . ' <property name="#ucfirstName#" type="#dotNetObjectType#">' . "\n" + . ' <column name="#name#" sql-type="#type#" not-null="#notNull#" #indexName#/>' . "\n" + . ' </property>'); } PMA_DBI_free_result($result); } - $lines[]=" </class>"; - $lines[]="</hibernate-mapping>"; + $lines[] = ' </class>'; + $lines[] = '</hibernate-mapping>'; return implode("\n", $lines); } - - function cgGetOption($optionName) - { - global $what; - return $GLOBALS[$what . "_" . $optionName]; - } } ?>
hooks/post-receive