当前位置: 首页>>代码示例>>PHP>>正文


PHP DBUtils::MySQLTypeMapping2Java方法代码示例

本文整理汇总了PHP中DBUtils::MySQLTypeMapping2Java方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils::MySQLTypeMapping2Java方法的具体用法?PHP DBUtils::MySQLTypeMapping2Java怎么用?PHP DBUtils::MySQLTypeMapping2Java使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBUtils的用法示例。


在下文中一共展示了DBUtils::MySQLTypeMapping2Java方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gwt_igniter

 function gwt_igniter($option)
 {
     if (!isset($option)) {
         echo "Please add your option jso or ci_model";
         return;
     }
     // Configuration
     $host = 'localhost:3306';
     $user = 'trieu';
     $pass = '1234';
     $database = 'demo';
     // Connect to the MySQL database
     $conn = mysql_connect($host, $user, $pass) or die("Could not connect to database\n");
     mysql_select_db($database, $conn) or die("Could not connect to {$database}\n");
     // Query to get list of tables
     $result = mysql_query("SHOW TABLES FROM {$database}", $conn);
     if ($result) {
         $output = array();
         while ($row = mysql_fetch_array($result)) {
             $tableName = $row[0];
             if ($tableName == "metadata" || $tableName == "xe") {
                 echo $tableName . " <b>Skipped</b><br>";
                 continue;
             } else {
                 if (!$this->isInMetadata($tableName) && $option == "create") {
                     $this->metadata->tablename = $tableName;
                     $this->metadata->use_scaffolding = 0;
                     $this->metadata->save();
                 } else {
                     if (!$this->use_scaffolding($tableName)) {
                         echo $tableName . " <b>Skipped</b><br>";
                         continue;
                     }
                 }
             }
             $table_object = new Table($tableName);
             //create table object
             if ($this->lang->line($tableName)) {
                 $table_object->table_fullname = $this->lang->line($tableName);
             } else {
                 $table_object->table_fullname = $tableName;
             }
             echo "<h1>" . $table_object->table_fullname . "</h1>";
             // Get meta data
             $cols = mysql_query("SHOW COLUMNS FROM {$tableName}", $conn);
             if ($cols) {
                 while ($col = mysql_fetch_assoc($cols)) {
                     // Add this table to our associative array
                     if (!array_key_exists($tableName, $output)) {
                         $output[$tableName] = array();
                     }
                     // Add the column definition to our associative array
                     $output[$tableName][$col['Field']] = $col['Type'];
                     // add field for table object
                     $field_object = new TableField();
                     $field_object->name = $col['Field'];
                     $lan_key = $tableName . "." . $col['Field'];
                     if ($this->lang->line($lan_key)) {
                         $field_object->fullname = $this->lang->line($lan_key);
                     } else {
                         $field_object->fullname = $col['Field'];
                     }
                     $field_object->type = DBUtils::MySQLTypeMapping2Java($col['Type']);
                     $field_object->isNumber = DBUtils::isNumber($col['Type']);
                     $field_object->isDate = DBUtils::isDate($col['Type']);
                     $field_object->isString = DBUtils::isString($col['Type']);
                     if ($col["Key"] == "PRI") {
                         $field_object->setIsKey(true);
                     } else {
                         if ($col['Key'] == "MUL") {
                             $field_object->setIsForeignKey(true);
                         } else {
                             if ($col['Key'] == "UNI") {
                                 $field_object->setIsUnique(true);
                             }
                         }
                     }
                     if ($col['Extra'] == "auto_increment") {
                         $field_object->isAutoIncrement = true;
                     }
                     if ($col['Null'] == "NO") {
                         $field_object->isRequire = true;
                     }
                     if ($col['Default']) {
                         $field_object->default = $col['Default'];
                     }
                     //add max length
                     $l = DBUtils::StringLength($col['Type']);
                     if ($l > 0) {
                         $field_object->maxLength = $l;
                     }
                     $table_object->addField1($field_object);
                 }
                 mysql_free_result($cols);
                 //   $this->createJSO($table_object);
                 $this->createCIModel($table_object);
                 $this->createCIController($table_object);
                 $this->createCIView($table_object);
                 // $this->createCI_Language($table_object);
                 //                    $this->createMenu($table_object);
//.........这里部分代码省略.........
开发者ID:samarulrajt,项目名称:codeigniter-smartgwt,代码行数:101,代码来源:metadatabase.php


注:本文中的DBUtils::MySQLTypeMapping2Java方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。