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


PHP DatabaseManager::hasEstablishTable方法代码示例

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


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

示例1: loadDbSNPTable

 static function loadDbSNPTable($con, $dbSNPPath)
 {
     REDLog::writeInfoLog("Start loading dbSNP file into database");
     $dbSNPTable = "dbsnp_database";
     try {
         if (!DatabaseManager::hasEstablishTable($con, $dbSNPTable)) {
             self::createDBSNPTable($con, $dbSNPTable);
             $count = 0;
             $fp = fopen($dbSNPPath, 'r');
             while ($line = fgets($fp) != null) {
                 if (strpos($line, "#") === 0) {
                     $count++;
                 } else {
                     break;
                 }
             }
             fclose($fp);
             $sqlClause = "load data local infile '{$dbSNPPath}' into table {$dbSNPTable} IGNORE {$count} LINES";
             //fields terminated by '\t' lines terminated by '\n'
             echo $sqlClause;
             $v = mysqli_query($con, $sqlClause);
             if (!$v) {
                 throw new Exception("Error execute sql clause in loadDbSNPTable()");
             }
         }
     } catch (Exception $e) {
         REDLog::writeErrLog($e->getMessage());
     }
     REDLog::writeInfoLog("End loading dbSNP file into database");
 }
开发者ID:Taruca,项目名称:lib,代码行数:30,代码来源:DBSNPParser.php

示例2: loadRepeatTable

 static function loadRepeatTable($con, $repeatPath)
 {
     REDLog::writeInfoLog("Start loading RepeatMasker file into database");
     $repeatTable = "repeat_masker";
     try {
         if (!DatabaseManager::hasEstablishTable($con, $repeatTable)) {
             self::createRepeatRegionsTable($con, $repeatTable);
             DatabaseManager::setAutoCommit($con, false);
             $count = 0;
             $fp = fopen($repeatPath, 'r');
             fgets($fp);
             fgets($fp);
             fgets($fp);
             while (($line = fgets($fp)) != null) {
                 $line1 = trim($line);
                 $section = explode(" ", preg_replace("/\\s(?=\\s)/", "\\1", $line1));
                 # /[\s]+/
                 $sqlClause = "insert into {$repeatTable}(chrom,begin,end,type) values('{$section['4']}','{$section['5']}','{$section['6']}','{$section['10']}')";
                 $v = mysqli_query($con, $sqlClause);
                 if (++$count % 10000 == 0) {
                     DatabaseManager::commit($con);
                 }
             }
             DatabaseManager::commit($con);
             DatabaseManager::setAutoCommit($con, true);
             if (!$v) {
                 throw new Exception("Error execute sql clause in loadRepeatTable()\n");
             }
         }
     } catch (Exception $e) {
         REDLog::writeErrLog($e->getMessage());
     }
     fclose($fp);
     REDLog::writeInfoLog("End loading RepeatMasker file into database");
 }
开发者ID:Taruca,项目名称:lib,代码行数:35,代码来源:RepeatMaskerParser.php

示例3: loadDarnedTable

 static function loadDarnedTable($con, $darnedPath)
 {
     REDLog::writeInfoLog("Start loading DARNED file into database");
     $darnedTable = "darned_database";
     if (!DatabaseManager::hasEstablishTable($con, $darnedTable)) {
         self::createDARNEDTable($con, $darnedTable);
         try {
             $count = 0;
             DatabaseManager::setAutoCommit($con, false);
             $fp = fopen($darnedPath, 'r');
             fgets($fp);
             while (($line = fgets($fp)) != null) {
                 $line1 = trim($line);
                 $section = explode("\t", $line1);
                 $stringBulider = "insert into " . $darnedTable . "(chrom,coordinate,strand,inchr,inrna) values(";
                 for ($i = 0; $i < 5; $i++) {
                     if ($i == 0) {
                         $stringBulider = $stringBulider . "'chr" . $section[$i] . "',";
                     } else {
                         if ($i == 4) {
                             $sec = str_replace("I", "G", $section[$i]);
                             $stringBulider = $stringBulider . "'" . $sec . "'";
                         } else {
                             if ($i == 1) {
                                 $stringBulider = $stringBulider . $section[$i] . ",";
                             } else {
                                 $stringBulider = $stringBulider . "'" . $section[$i] . "',";
                             }
                         }
                     }
                 }
                 $stringBulider = $stringBulider . ")";
                 $v = mysqli_query($con, $stringBulider);
                 if (!$v) {
                     throw new Exception("Error execute sql clause in loadDarnedTable()");
                 }
                 if (++$count % 10000 == 0) {
                     DatabaseManager::commit($con);
                 }
                 DatabaseManager::commit($con);
                 DatabaseManager::setAutoCommit($con, true);
             }
         } catch (Exception $e) {
             REDLog::writeErrLog($e->getMessage());
         }
     }
     REDLog::writeInfoLog("End loading DARNED file into database");
 }
开发者ID:Taruca,项目名称:lib,代码行数:48,代码来源:DARNEDParser.php

示例4: loadSpliceJunctionTable

 static function loadSpliceJunctionTable($con, $spliceJunctionPath)
 {
     REDLog::writeInfoLog("Start loading Gene Annotation File into database");
     $spliceJunctionTable = "splice_junction";
     if (!DatabaseManager::hasEstablishTable($con, $spliceJunctionTable)) {
         self::createSpliceJunctionTable($con, $spliceJunctionTable);
         try {
             $sqlClause = "load data local infile '{$spliceJunctionPath}' into table {$spliceJunctionTable}";
             /*fields terminated by '\t' lines terminated by '\n'*/
             $v = mysqli_query($con, $sqlClause);
             if (!$v) {
                 throw new Exception("Error execute sql clause in loadSpliceJunctionTable()");
             }
         } catch (Exception $e) {
             REDLog::writeErrLog($e->getMessage());
         }
     }
     REDLog::writeInfoLog("End loading Gene Annotation File into database");
 }
开发者ID:Taruca,项目名称:lib,代码行数:19,代码来源:GTFParser.php

示例5: loadRefSeqGeneTable

 static function loadRefSeqGeneTable($con, $refSeqGenePath)
 {
     REDLog::writeInfoLog("Start loading Ref Seq Gene File into database");
     $refseqGeneTableName = "reference_gene";
     if (!DatabaseManager::hasEstablishTable($con, $refseqGeneTableName)) {
         self::createRefSeqGeneTable($con, $refseqGeneTableName);
         try {
             $sqlClause = "load data local infile '" . $refSeqGenePath . "' into table " . $refseqGeneTableName;
             /*." fields terminated"
               ."by '\t' lines terminated by '\n'";*/
             /*echo $sqlClause;*/
             $v = mysqli_query($con, $sqlClause);
             if (!$v) {
                 throw new Exception("Error execute sql clause in loadRefSeqGeneTable()");
             }
         } catch (Exception $e) {
             REDLog::writeErrLog($e->getMessage());
         }
     }
     REDLog::writeInfoLog("End loading Ref Seq Gene File into database");
 }
开发者ID:Taruca,项目名称:lib,代码行数:21,代码来源:RefGeneParser.php


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