Example #1
0
 public function queryIdsAction(&$actionsNameAndType)
 {
     $sql = $this->sqlActionId();
     $bind = array();
     $i = 0;
     foreach ($actionsNameAndType as $index => &$actionNameType) {
         list($name, $type, $urlPrefix) = $actionNameType;
         if (empty($name)) {
             continue;
         }
         if ($i > 0) {
             $sql .= ' OR (hash = ? AND name = ? AND type = ? )';
         }
         $bind[] = Common::getCrc32($name);
         $bind[] = $name;
         $bind[] = $type;
         ++$i;
     }
     // Case URL & Title are empty
     if (empty($bind)) {
         return false;
     }
     $actionIds = $this->db->fetchAll($sql, $bind);
     return $actionIds;
 }
Example #2
0
 /**
  *  add record
  *
  *  Adds a record to the log_action table and returns the id of the
  *  the inserted row.
  *
  *  @param string $name
  *  @param string $type
  *  @param int    $urlPrefix
  *  @returns int
  */
 public function add($name, $type, $urlPrefix)
 {
     $sql = 'INSERT INTO ' . $this->table . ' (name, hash, type, url_prefix) ' . 'VALUES (?, ?, ?, ?)';
     $this->db->query($sql, array($name, Common::getCrc32($name), $type, $urlPrefix));
     return $this->db->lastInsertId($this->table . '_idaction');
 }
Example #3
0
 protected function insertNewAction($name, $type, $urlPrefix)
 {
     $table = Common::prefixTable('log_action');
     $sql = "INSERT INTO {$table} (name, hash, type, url_prefix) VALUES (?,?,?,?)";
     $db = $this->getDb();
     $db->query($sql, array($name, Common::getCrc32($name), $type, $urlPrefix));
     $seq = $table . '_idaction';
     $actionId = $db->lastInsertId($seq);
     return $actionId;
 }