コード例 #1
0
 /**
  * @desc count the number of rows from the <code>$table_name</code> table matching the
  * <code>$condition</code> condition
  * @param string $table_name the name of the table on which work will be done
  * @param string $condition the update condition beginning just after the where clause.
  * For example, <code>"length > 50 and weight < 100"</code>
  * @param string $count_column the column name on which count or * if all
  * @param string[string] $parameters the query_var map
  * @return int the number of rows returned
  */
 public function count($table_name, $condition = 'WHERE 1', $parameters = array(), $count_column = '*')
 {
     $query = 'SELECT COUNT(' . $count_column . ') FROM ' . $table_name;
     if (!empty($condition)) {
         $query .= ' ' . $condition;
     }
     $row = $this->querier->select($query, $parameters, SelectQueryResult::FETCH_NUM)->fetch();
     return (int) $row[0];
 }
コード例 #2
0
 public function parse_file(File $file, $prefix = '')
 {
     $reader = new BufferedFileReader($file);
     $query = '';
     while (($line = $reader->read_line()) !== null) {
         if (!empty($line) && substr($line, 0, 2) !== '--') {
             if (substr($line, -1) == ';') {
                 if (empty($query)) {
                     $query = $line;
                 } else {
                     $query .= ' ' . $line;
                 }
                 if (!empty($tableprefix)) {
                     $query = str_replace('phpboost_', $tableprefix, $query);
                 }
                 $this->querier->inject($query);
                 $query = '';
             } else {
                 $query .= ' ' . $line;
             }
         }
     }
 }
コード例 #3
0
 public function tearDown()
 {
     self::$dbms_utils = null;
     self::$querier->inject("DROP TABLE IF EXISTS `" . self::$test_table1 . "`");
     self::$querier->inject("DROP TABLE IF EXISTS `" . self::$test_table2 . "`");
 }
コード例 #4
0
ファイル: SQLDAOTest.php プロジェクト: AroundPBT/PHPBoost
 public function tearDown()
 {
     $this->querier->inject("DROP TABLE IF EXISTS " . $this->model->get_table_name() . ";");
 }