コード例 #1
0
 function _updateDayCountersRecord($stamp, $hits_today, $hosts_today, $is_new_host, &$stats_request)
 {
     $home_hit = $stats_request->isHomeHit() ? 1 : 0;
     $audience = $is_new_host && $stats_request->isAudienceHit() ? 1 : 0;
     $sql = new SimpleUpdateSQL($this->day_counters_db_table->getTableName());
     $sql->addField('hosts = ' . $hosts_today);
     $sql->addField('hits = ' . $hits_today);
     $sql->addField('home_hits = home_hits + ' . $home_hit);
     $sql->addField('audience = audience + ' . $audience);
     $sql->addCondition('time =' . $this->makeDayStamp($stamp));
     $toolkit =& Limb::toolkit();
     $conn =& $toolkit->getDBConnection();
     $stmt =& $conn->newStatement($sql->toString());
     $stmt->execute();
 }
コード例 #2
0
  function update($table, $values, $conditions = array())
  {
    include_once(LIMB_DIR . '/core/db/SimpleUpdateSQL.class.php');

    $sql = new SimpleUpdateSQL($table);

    $prefixed_values = array();
    foreach($values as $key => $value)
    {
      $sql->addField($key . '=:_' . $key . ':');
      $prefixed_values['_' . $key] = $value;
    }

    $this->_addConditions($sql, $conditions);

    $stmt =& $this->conn->newStatement($sql->toString());

    $this->_fillStatementVariables($stmt, $prefixed_values);
    $this->_fillStatementVariables($stmt, $conditions);

    $stmt->execute();

    return $stmt->getAffectedRowCount();
  }
コード例 #3
0
  function update($row, $conditions = array())
  {
    $row = $this->_filterRow($row);
    $conditions = $this->_filterRow($conditions);

    include_once(LIMB_DIR . '/core/db/SimpleUpdateSQL.class.php');

    $sql = new SimpleUpdateSQL($this->_db_table_name);

    $prefixed_row = array();
    foreach($row as $key => $value)
    {
      $sql->addField($key . '=:_' . $key . ':');
      $prefixed_row['_' . $key] = $value;
    }

    $this->_addConditions($sql, $conditions);

    $this->_stmt =& $this->_conn->newStatement($sql->toString());

    $this->_fillStatementVariables($prefixed_row);
    $this->_fillStatementVariables($conditions);

    return $this->_stmt->execute();
  }