[Phpmyadmin-git] [SCM] phpMyAdmin branch, QA_3_4, updated. RELEASE_3_4_3_1-31-g40d7c3b

Rouslan Placella roccivic at users.sourceforge.net
Fri Jul 15 17:14:37 CEST 2011


The branch, QA_3_4 has been updated
       via  40d7c3b8baa84c474af5f710e60351b05330f3c6 (commit)
      from  b185ca88f7c8241804cff13a2b315fc3d1222a38 (commit)


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 libraries/export/codegen.php |  294 +++++++++++++++++++++---------------------
 1 files changed, 147 insertions(+), 147 deletions(-)

diff --git a/libraries/export/codegen.php b/libraries/export/codegen.php
index 7160122..7c06d79 100644
--- a/libraries/export/codegen.php
+++ b/libraries/export/codegen.php
@@ -152,70 +152,70 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
  */
 class TableProperty
 {
-	public $name;
-	public $type;
-	public $nullable;
-	public $key;
-	public $defaultValue;
-	public $ext;
-	function __construct($row)
-	{
-		$this->name = trim($row[0]);
-		$this->type = trim($row[1]);
-		$this->nullable = trim($row[2]);
-		$this->key = trim($row[3]);
-		$this->defaultValue = trim($row[4]);
-		$this->ext = trim($row[5]);
-	}
-	function getPureType()
-	{
-		$pos=strpos($this->type, "(");
-		if ($pos > 0)
-			return substr($this->type, 0, $pos);
-		return $this->type;
-	}
-	function isNotNull()
-	{
-		return $this->nullable == "NO" ? "true" : "false";
-	}
-	function isUnique()
-	{
-		return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
-	}
-	function getDotNetPrimitiveType()
-	{
-		if (strpos($this->type, "int") === 0) return "int";
-		if (strpos($this->type, "long") === 0) return "long";
-		if (strpos($this->type, "char") === 0) return "string";
-		if (strpos($this->type, "varchar") === 0) return "string";
-		if (strpos($this->type, "text") === 0) return "string";
-		if (strpos($this->type, "longtext") === 0) return "string";
-		if (strpos($this->type, "tinyint") === 0) return "bool";
-		if (strpos($this->type, "datetime") === 0) return "DateTime";
-		return "unknown";
-	}
-	function getDotNetObjectType()
-	{
-		if (strpos($this->type, "int") === 0) return "Int32";
-		if (strpos($this->type, "long") === 0) return "Long";
-		if (strpos($this->type, "char") === 0) return "String";
-		if (strpos($this->type, "varchar") === 0) return "String";
-		if (strpos($this->type, "text") === 0) return "String";
-		if (strpos($this->type, "longtext") === 0) return "String";
-		if (strpos($this->type, "tinyint") === 0) return "Boolean";
-		if (strpos($this->type, "datetime") === 0) return "DateTime";
-		return "Unknown";
-	}
-	function getIndexName()
-	{
-		if (strlen($this->key)>0)
-			return "index=\"" . htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8') . "\"";
-		return "";
-	}
-	function isPK()
-	{
-		return $this->key=="PRI";
-	}
+    public $name;
+    public $type;
+    public $nullable;
+    public $key;
+    public $defaultValue;
+    public $ext;
+    function __construct($row)
+    {
+        $this->name = trim($row[0]);
+        $this->type = trim($row[1]);
+        $this->nullable = trim($row[2]);
+        $this->key = trim($row[3]);
+        $this->defaultValue = trim($row[4]);
+        $this->ext = trim($row[5]);
+    }
+    function getPureType()
+    {
+        $pos=strpos($this->type, "(");
+        if ($pos > 0)
+            return substr($this->type, 0, $pos);
+        return $this->type;
+    }
+    function isNotNull()
+    {
+        return $this->nullable == "NO" ? "true" : "false";
+    }
+    function isUnique()
+    {
+        return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
+    }
+    function getDotNetPrimitiveType()
+    {
+        if (strpos($this->type, "int") === 0) return "int";
+        if (strpos($this->type, "long") === 0) return "long";
+        if (strpos($this->type, "char") === 0) return "string";
+        if (strpos($this->type, "varchar") === 0) return "string";
+        if (strpos($this->type, "text") === 0) return "string";
+        if (strpos($this->type, "longtext") === 0) return "string";
+        if (strpos($this->type, "tinyint") === 0) return "bool";
+        if (strpos($this->type, "datetime") === 0) return "DateTime";
+        return "unknown";
+    }
+    function getDotNetObjectType()
+    {
+        if (strpos($this->type, "int") === 0) return "Int32";
+        if (strpos($this->type, "long") === 0) return "Long";
+        if (strpos($this->type, "char") === 0) return "String";
+        if (strpos($this->type, "varchar") === 0) return "String";
+        if (strpos($this->type, "text") === 0) return "String";
+        if (strpos($this->type, "longtext") === 0) return "String";
+        if (strpos($this->type, "tinyint") === 0) return "Boolean";
+        if (strpos($this->type, "datetime") === 0) return "DateTime";
+        return "Unknown";
+    }
+    function getIndexName()
+    {
+        if (strlen($this->key)>0)
+            return "index=\"" . htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8') . "\"";
+        return "";
+    }
+    function isPK()
+    {
+        return $this->key=="PRI";
+    }
     function formatCs($text)
     {
         $text=str_replace("#name#", cgMakeIdentifier($this->name, false), $text);
@@ -227,16 +227,16 @@ class TableProperty
         $text=str_replace("#indexName#", $this->getIndexName(), $text);
         return $this->format($text);
     }
-	function format($text)
-	{
+    function format($text)
+    {
         $text=str_replace("#ucfirstName#", cgMakeIdentifier($this->name), $text);
         $text=str_replace("#dotNetPrimitiveType#", $this->getDotNetPrimitiveType(), $text);
         $text=str_replace("#dotNetObjectType#", $this->getDotNetObjectType(), $text);
-		$text=str_replace("#type#", $this->getPureType(), $text);
-		$text=str_replace("#notNull#", $this->isNotNull(), $text);
-		$text=str_replace("#unique#", $this->isUnique(), $text);
-		return $text;
-	}
+        $text=str_replace("#type#", $this->getPureType(), $text);
+        $text=str_replace("#notNull#", $this->isNotNull(), $text);
+        $text=str_replace("#unique#", $this->isUnique(), $text);
+        return $text;
+    }
 }
 
     function cgMakeIdentifier($str, $ucfirst = true)
@@ -253,83 +253,83 @@ class TableProperty
         return $str;
     }
 
-	function handleNHibernateCSBody($db, $table, $crlf)
-	{
-		$lines=array();
-		$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);
-			$lines[] = "using System;";
-			$lines[] = "using System.Collections;";
-			$lines[] = "using System.Collections.Generic;";
-			$lines[] = "using System.Text;";
-			$lines[] = "namespace ".cgMakeIdentifier($db);
-			$lines[] = "{";
-			$lines[] = "	#region ".cgMakeIdentifier($table);
-			$lines[] = "	public class ".cgMakeIdentifier($table);
-			$lines[] = "	{";
-			$lines[] = "		#region Member Variables";
-			foreach ($tableProperties as $tablePropertie)
-				$lines[] = $tablePropertie->formatCs("		protected #dotNetPrimitiveType# _#name#;");
-			$lines[] = "		#endregion";
-			$lines[] = "		#region Constructors";
-			$lines[] = "		public ".cgMakeIdentifier($table)."() { }";
-			$temp = array();
-			foreach ($tableProperties as $tablePropertie)
-				if (! $tablePropertie->isPK())
-					$temp[] = $tablePropertie->formatCs("#dotNetPrimitiveType# #name#");
-			$lines[] = "		public ".cgMakeIdentifier($table)."(".implode(", ", $temp).")";
-			$lines[] = "		{";
-			foreach ($tableProperties as $tablePropertie)
-				if (! $tablePropertie->isPK())
-					$lines[] = $tablePropertie->formatCs("			this._#name#=#name#;");
-			$lines[] = "		}";
-			$lines[] = "		#endregion";
-			$lines[] = "		#region Public Properties";
-			foreach ($tableProperties as $tablePropertie)
-				$lines[] = $tablePropertie->formatCs("		public virtual #dotNetPrimitiveType# #ucfirstName#\n		{\n			get {return _#name#;}\n			set {_#name#=value;}\n		}");
-			$lines[] = "		#endregion";
-			$lines[] = "	}";
-			$lines[] = "	#endregion";
-			$lines[] = "}";
-			PMA_DBI_free_result($result);
-		}
-		return implode("\n", $lines);
-	}
+    function handleNHibernateCSBody($db, $table, $crlf)
+    {
+        $lines=array();
+        $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);
+            $lines[] = "using System;";
+            $lines[] = "using System.Collections;";
+            $lines[] = "using System.Collections.Generic;";
+            $lines[] = "using System.Text;";
+            $lines[] = "namespace ".cgMakeIdentifier($db);
+            $lines[] = "{";
+            $lines[] = "    #region ".cgMakeIdentifier($table);
+            $lines[] = "    public class ".cgMakeIdentifier($table);
+            $lines[] = "    {";
+            $lines[] = "        #region Member Variables";
+            foreach ($tableProperties as $tablePropertie)
+                $lines[] = $tablePropertie->formatCs("        protected #dotNetPrimitiveType# _#name#;");
+            $lines[] = "        #endregion";
+            $lines[] = "        #region Constructors";
+            $lines[] = "        public ".cgMakeIdentifier($table)."() { }";
+            $temp = array();
+            foreach ($tableProperties as $tablePropertie)
+                if (! $tablePropertie->isPK())
+                    $temp[] = $tablePropertie->formatCs("#dotNetPrimitiveType# #name#");
+            $lines[] = "        public ".cgMakeIdentifier($table)."(".implode(", ", $temp).")";
+            $lines[] = "        {";
+            foreach ($tableProperties as $tablePropertie)
+                if (! $tablePropertie->isPK())
+                    $lines[] = $tablePropertie->formatCs("            this._#name#=#name#;");
+            $lines[] = "        }";
+            $lines[] = "        #endregion";
+            $lines[] = "        #region Public Properties";
+            foreach ($tableProperties as $tablePropertie)
+                $lines[] = $tablePropertie->formatCs("        public virtual #dotNetPrimitiveType# #ucfirstName#\n        {\n            get {return _#name#;}\n            set {_#name#=value;}\n        }");
+            $lines[] = "        #endregion";
+            $lines[] = "    }";
+            $lines[] = "    #endregion";
+            $lines[] = "}";
+            PMA_DBI_free_result($result);
+        }
+        return implode("\n", $lines);
+    }
 
-	function handleNHibernateXMLBody($db, $table, $crlf)
-	{
-		$lines=array();
-		$lines[] = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
-		$lines[] = "<hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\" namespace=\"".cgMakeIdentifier($db)."\" assembly=\"".cgMakeIdentifier($db)."\">";
-		$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)
-			{
-				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>");
-				else
-					$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>";
-		return implode("\n", $lines);
-	}
+    function handleNHibernateXMLBody($db, $table, $crlf)
+    {
+        $lines=array();
+        $lines[] = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
+        $lines[] = "<hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\" namespace=\"".cgMakeIdentifier($db)."\" assembly=\"".cgMakeIdentifier($db)."\">";
+        $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)
+            {
+                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>");
+                else
+                    $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>";
+        return implode("\n", $lines);
+    }
 
-	function cgGetOption($optionName)
-	{
-		global $what;
-		return $GLOBALS[$what . "_" . $optionName];
-	}
+    function cgGetOption($optionName)
+    {
+        global $what;
+        return $GLOBALS[$what . "_" . $optionName];
+    }
 }
 ?>


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list