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


PHP ResultSet::setColumnTableAliases方法代码示例

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


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

示例1: parseResultSetFromFileForAppend

 function parseResultSetFromFileForAppend($fd)
 {
     $start = getmicrotime();
     $rs = new ResultSet();
     // COLUMN NAMES
     // read with a maximum of 1000 bytes, until there is a newline included (or eof)
     $buf = "";
     while (is_false(strstr($buf, "\n"))) {
         $buf .= fgets($fd, 1000);
         if (feof($fd)) {
             print_error_msg("Invalid Table File!<br>");
             return null;
         }
     }
     // remove newline
     remove_last_char($buf);
     $rec = $this->parseRowFromLine($buf);
     $rs->setColumnNames($rec);
     // COLUMN TYPES
     // read with a maximum of 1000 bytes, until there is a newline included (or eof)
     $buf = "";
     while (is_false(strstr($buf, "\n"))) {
         $buf .= fgets($fd, 1000);
         if (feof($fd)) {
             print_error_msg("Invalid Table File!<br>");
             return null;
         }
     }
     // remove newline
     remove_last_char($buf);
     $rec = $this->parseRowFromLine($buf);
     $rs->setColumnTypes($rec);
     // COLUMN DEFAULT VALUES
     // read with a maximum of 1000 bytes, until there is a newline included (or eof)
     $buf = "";
     while (is_false(strstr($buf, "\n"))) {
         $buf .= fgets($fd, 1000);
         if (feof($fd)) {
             break;
             // there's no newline after the colum types => empty table
         }
     }
     // remove newline
     if (last_char($buf) == "\n") {
         remove_last_char($buf);
     }
     $rec = $this->parseRowFromLine($buf);
     $rs->setColumnDefaultValues($rec);
     // get file size
     fseek($fd, 0, SEEK_END);
     $size = ftell($fd);
     $lastRecSize = min($size, ASSUMED_RECORD_SIZE);
     $lastRecPos = false;
     while (is_false($lastRecPos)) {
         fseek($fd, -$lastRecSize, SEEK_END);
         $buf = fread($fd, $lastRecSize);
         $lastRecSize = $lastRecSize * 2;
         $lastRecSize = min($size, $lastRecSize);
         if ($lastRecSize < 1) {
             print_error_message("lastRecSize should not be 0! Contact developer please!");
         }
         $lastRecPos = $this->getLastRecordPosInString($buf);
         if (TXTDBAPI_VERBOSE_DEBUG) {
             echo "<hr>pass! <br>";
             echo "lastRecPos: " . $lastRecPos . "<br>";
             echo "buf: " . $buf . "<br>";
         }
     }
     $buf = trim(substr($buf, $lastRecPos));
     verbose_debug_print("buf after substr() and trim(): " . $buf . "<br>");
     $rs->reset();
     $row = $this->parseRowFromLine($buf);
     if (TXTDBAPI_VERBOSE_DEBUG) {
         echo "parseResultSetFromFileForAppend(): last Row:<br>";
         print_r($row);
         echo "<br>";
     }
     $rs->appendRow($row);
     $rs->setColumnAliases(create_array_fill(count($rs->colNames), ""));
     $rs->setColumnTables(create_array_fill(count($rs->colNames), ""));
     $rs->setColumnTableAliases(create_array_fill(count($rs->colNames), ""));
     $rs->setColumnFunctions(create_array_fill(count($rs->colNames), ""));
     $rs->colFuncsExecuted = create_array_fill(count($rs->colNames), false);
     debug_print("<i>III: parseResultSetFromFileForAppend: " . (getmicrotime() - $start) . " seconds elapsed</i><br>");
     return $rs;
 }
开发者ID:Giannos99,项目名称:HC_Interaction,代码行数:86,代码来源:resultset.php

示例2: unset

 $rowCount = $_POST['rowCount'];
 $colCount = $_POST['colCount'];
 if (isset($_POST['abort'])) {
     echo "<br>";
     echo "Aborted, klick <a href='" . $_SERVER['PHP_SELF'] . "'> here </a> to continue";
     $_SESSION['mode'] = 'choose_table';
     unset($_SESSION['table_file']);
     echo "<meta http-equiv='refresh' content='0;URL=" . $_SERVER['PHP_SELF'] . "'>";
     exit;
 }
 $rs->setColumnNames(prep_val_save_arr($colName));
 $rs->setColumnTypes(prep_val_save_arr($colType));
 $rs->setColumnDefaultValues(prep_val_save_arr($colDefVal));
 $rs->setColumnAliases(create_array_fill(count($rs->colNames), ""));
 $rs->setColumnTables(create_array_fill(count($rs->colNames), ""));
 $rs->setColumnTableAliases(create_array_fill(count($rs->colNames), ""));
 $rs->setColumnFunctions(create_array_fill(count($rs->colNames), ""));
 $rs->colFuncsExecuted = create_array_fill(count($rs->colNames), false);
 $rowsSaved = 0;
 for ($i = 0; $i < $rowCount; ++$i) {
     if (isset($_POST['delete' . $i])) {
         echo "Row {$i} deleted!<br>";
     } else {
         if (isset($_POST['dup' . $i])) {
             echo "Row {$i} duplicated!<br>";
             $rowsSaved++;
             $rs->appendRow(prep_val_save_arr($vals[$i]));
         }
         $rowsSaved++;
         $rs->appendRow(prep_val_save_arr($vals[$i]));
     }
开发者ID:Giannos99,项目名称:HC_Interaction,代码行数:31,代码来源:tbedit.php


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