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


PHP Vtiger_Utils::IsCreateSql方法代码示例

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


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

示例1: import_Tables

 /**
  * Import Tables of the module
  * @access private
  */
 function import_Tables($modulenode)
 {
     if (empty($modulenode->tables) || empty($modulenode->tables->table)) {
         return;
     }
     $adb = PearDatabase::getInstance();
     $adb->query('SET FOREIGN_KEY_CHECKS = 0;');
     /**
      * Record the changes in schema file
      */
     if (file_exists("modules/{$modulenode->name}")) {
         $fileToOpen = "modules/{$modulenode->name}/schema.xml";
     } else {
         if (file_exists("modules/Settings/{$modulenode->name}")) {
             $fileToOpen = "modules/Settings/{$modulenode->name}/schema.xml";
         }
     }
     $schemafile = fopen($fileToOpen, 'w');
     if ($schemafile) {
         fwrite($schemafile, "<?xml version='1.0'?>\n");
         fwrite($schemafile, "<schema>\n");
         fwrite($schemafile, "\t<tables>\n");
     }
     // Import the table via queries
     foreach ($modulenode->tables->table as $tablenode) {
         $tablename = $tablenode->name;
         $tablesql = "{$tablenode->sql}";
         // Convert to string format
         // Save the information in the schema file.
         fwrite($schemafile, "\t\t<table>\n");
         fwrite($schemafile, "\t\t\t<name>{$tablename}</name>\n");
         fwrite($schemafile, "\t\t\t<sql><![CDATA[{$tablesql}]]></sql>\n");
         fwrite($schemafile, "\t\t</table>\n");
         // Avoid executing SQL that will DELETE or DROP table data
         if (Vtiger_Utils::IsCreateSql($tablesql)) {
             if (!Vtiger_Utils::checkTable($tablename)) {
                 self::log("SQL: {$tablesql} ... ", false);
                 Vtiger_Utils::ExecuteQuery($tablesql);
                 self::log("DONE");
             }
         } else {
             if (Vtiger_Utils::IsDestructiveSql($tablesql)) {
                 self::log("SQL: {$tablesql} ... SKIPPED");
             } else {
                 self::log("SQL: {$tablesql} ... ", false);
                 Vtiger_Utils::ExecuteQuery($tablesql);
                 self::log("DONE");
             }
         }
     }
     if ($schemafile) {
         fwrite($schemafile, "\t</tables>\n");
         fwrite($schemafile, "</schema>\n");
         fclose($schemafile);
     }
     $adb->query('SET FOREIGN_KEY_CHECKS = 1;');
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:61,代码来源:PackageImport.php

示例2: import_Tables

 /**
  * Import Tables of the module
  * @access private
  */
 function import_Tables($modulenode)
 {
     if (empty($modulenode->tables) || empty($modulenode->tables->table)) {
         return;
     }
     /**
      * Record the changes in schema file
      */
     $schemafile = @fopen("modules/{$modulenode->name}/schema.xml", 'w');
     if ($schemafile) {
         fwrite($schemafile, "<?xml version='1.0'?>\n");
         fwrite($schemafile, "<schema>\n");
         fwrite($schemafile, "\t<tables>\n");
     }
     // Import the table via queries
     foreach ($modulenode->tables->table as $tablenode) {
         $tablename = $tablenode->name;
         $tablesql = "{$tablenode->sql}";
         // Convert to string format
         // Save the information in the schema file.
         if ($schemafile) {
             fwrite($schemafile, "\t\t<table>\n");
             fwrite($schemafile, "\t\t\t<name>{$tablename}</name>\n");
             fwrite($schemafile, "\t\t\t<sql><![CDATA[{$tablesql}]]></sql>\n");
             fwrite($schemafile, "\t\t</table>\n");
         }
         // Avoid executing SQL that will DELETE or DROP table data
         if (Vtiger_Utils::IsCreateSql($tablesql)) {
             if (!Vtiger_Utils::checkTable($tablename)) {
                 self::log("SQL: {$tablesql} ... ", false);
                 Vtiger_Utils::ExecuteQuery($tablesql);
                 self::log("DONE");
             }
         } else {
             if (Vtiger_Utils::IsDestructiveSql($tablesql)) {
                 self::log("SQL: {$tablesql} ... SKIPPED");
             } else {
                 self::log("SQL: {$tablesql} ... ", false);
                 Vtiger_Utils::ExecuteQuery($tablesql);
                 self::log("DONE");
             }
         }
     }
     if ($schemafile) {
         fwrite($schemafile, "\t</tables>\n");
         fwrite($schemafile, "</schema>\n");
         fclose($schemafile);
     }
 }
开发者ID:jaimeaga84,项目名称:corebos,代码行数:53,代码来源:PackageImport.php


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