Remove bindings from the query builder.

@param  \Illuminate\Database\Query\Builder $query
@param  integer $key
@param  integer $count
@return void
169840
protected function removeBindings(Query $query, $key, $count)
    {
        $bindings = $query->getRawBindings()['where'];

        array_splice($bindings, $key, $count);

        $query->setBindings($bindings, 'where');
    }
1234475
public function compileDelete(Builder $query)
    {
        if (isset($query->joins) || isset($query->limit)) {
            $selectSql = parent::compileSelect($query->select("{$query->from}.rowid"));

            return "delete from {$this->wrapTable($query->from)} where {$this->wrap('rowid')} in ({$selectSql})";
        }

        $wheres = is_array($query->wheres) ? $this->compileWheres($query) : '';

        return trim("delete from {$this->wrapTable($query->from)} $wheres");
    }
164775
public function delete($key = NULL) {
		$ownerTransaction = FALSE;
		try {
			if ($this->database->getConnection()->getPdo()->inTransaction() === FALSE) {
				$this->database->beginTransaction();
				$ownerTransaction = TRUE;
			}
			if (is_array($key)) {
				$this->buildSql()->wherePrimary($key)->delete();
			} else if (is_int($key)) {
				$row = $this->get($key);
				if ($row) {
					$row->toRow()->delete();
					unset($this->rows[$key]);
				} else {
					throw new \PDOException("Item with primary key " . $key . " not found.");
				}
			} else if ($key === NULL) {
				if ($this->selection) {
					$this->selection->delete();
					$this->rows = array();
				}
			}
			if ($this->database->getConnection()->getPdo()->inTransaction() === TRUE && $ownerTransaction === TRUE) {
				$this->database->commit();
			}
		} catch (\PDOException $e) {
			if ($this->database->getConnection()->getPdo()->inTransaction() === TRUE && $ownerTransaction === TRUE) {
				$this->database->rollBack();
			}
			throw new \PDOException($e->getMessage());
		}
	}
853928
public function postDelete(Event $event, $id, $count) {
        if (!$this->getConfig('onDelete') || !$this->_deleteIndex) {
            return;
        }

        $this->_removeNode($id, $this->_deleteIndex);
        $this->_deleteIndex = null;
    }
789022
public function removeKey($key)
    {
        if (isset($this->values[$key])) {
            unset($this->values[$key]);
        }
        $this->stateChanged();
    }
457013
public static function removeContextDataByChildKey(string $key, string $child)
    {
        $coroutineId = self::getCoroutineId();
        unset(self::$context[$coroutineId][self::DATA_KEY][$key][$child]);
    }
357686
public function remove(Builder $builder, Model $model)
    {
        $query = $builder->getQuery();

        if (is_null($query->wheres)) {
            return;
        }

        $bindingKey = 0;

        $scopeConstraints = $this->getScopeConstraints($model);

        foreach ((array) $query->wheres as $key => $where) {
            $bindingsCount = $this->countBindings($where);

            if (in_array($where, $scopeConstraints)) {
                $this->removeWhere($query, $key);

                $this->removeBindings($query, $bindingKey, $bindingsCount);
            } else {
                $bindingKey += $bindingsCount;
            }
        }

        $query->wheres = array_values($query->wheres);
    }
364874
public function compileDelete(Builder $query)
    {
        // keyspace-ref:
        $table = $this->wrapTable($query->from);
        // use-keys-clause:
        $keyClause = null;
        if ($query->key) {
            $key = $this->wrapKey($query->key);
            $keyClause = "USE KEYS {$key}";
        }
        // returning-clause
        $returning = implode(', ', $query->returning);
        $where = is_array($query->wheres) ? $this->compileWheres($query) : '';

        return trim("delete from {$table} {$keyClause} {$where} RETURNING {$returning}");
    }
760231
public function searchTweets($query, $count = 10)
	{	
		if ($this->bearer_token == null) {
			throw new \Exception('Incorrect token. You need to obtain correct Bearer token in order to make calls to the API. Check if your API keys are correct.');
		}

		$this->makeRequest($query, $count);
	}
1277048
public function setCount( $count )
	{
		if ( $count == $this->getCount() ) { return; }

		$this->_values['count'] = (string) $count;
		$this->setModified();
	}
114169
public static function pluckOrLists(Builder $query, $column, $key = null)
	{
		if(\Illuminate\Foundation\Application::VERSION < '5.2') {
			$result = $query->lists($column, $key);
		} else {
			$result = $query->pluck($column, $key);
		}

		return $result;
	}
36179
public static function delete($query)
    {
        static::applySchema();

        $key = static::getPrimaryKeyOrMainField();

        if ($key && !is_array($query)) {
            $query = [$key => $query];
        }

        $whereArray = [];
        if (isset($query['where'])) {
            $whereArray[] = $query['where'];
            unset($query['where']);
        }

        $params = [];

        foreach ($query as $field => $value) {
            $token = ':'.$field;
            $whereArray[] = "`{$field}` = {$token}";
            $params[$token] = $value;
        }

        $where = $whereArray
               ? 'WHERE '.implode(' AND ', $whereArray)
               : '';

        $table = static::getTable();
        $sql = "DELETE FROM {$table} {$where}";

        static::getDatabase()->execute($sql, $params);
    }
1228275
public function filterQuery(QueryBuilder &$query, &$selects = null)
    {
        //run the parent method
        parent::filterQuery($query, $selects);

        //if there is no value, return
        if (!$this->getOption('value')) {
            return;
        }

        $query->where($this->getOption('foreign_key'), '=', $this->getOption('value'));
    }
450416
public function spop($key, $count = 1)
    {
        $this->init();
        if ($count == 1 || $count === null) {
            $result = $this->driver->spop($key);
            return $this->convertFalseToNull($result);
        }

        $members = [];
        for ($i = 0; $i < $count; ++$i) {
            $member = $this->driver->spop($key);
            if (!$member) {
                break;
            }
            $members[] = $member;
        }
        return empty($members) ? null : $members;
    }
493313
public function makeRequest($query, $count)
	{

		try { 
 			
 			$response = $this->client->request('GET', self::$api_base.'1.1/search/tweets.json', [
			    'query' => ['q' => $query, 'count' => $count],
			    'headers' => [
			        'Authorization' => 'Bearer ' . $this->bearer_token
			    ]
			]);
  			
			$this->setStatusCode($response->getStatusCode());

			$response_body = json_decode($response->getBody());
 			$this->response = $response_body->statuses;
 
 		} catch (\Exception $e) {

			$this->setStatusCode($e->getCode());
			$this->setResponse($e->getMessage());

		}
	}
471715
public function executeSQL($key, $query, $disable_foreign_key_checks = true, $entity=null)
    {
        if ($entity !== null && $entity != $this->last_entity) {
            $this->log("------------------------------------------------------");
            $this->log("Entity: '$entity'");
            $this->log("------------------------------------------------------");
            $this->last_entity = $entity;
        }

        $this->log(" * Sync::executeSQL '$key'...");

        $total_time_start = microtime(true);

        if ($disable_foreign_key_checks) {
            $this->adapter->query('set foreign_key_checks=0');
            $this->log("  * FK : Foreign key check disabled");
        }

        try {
            $time_start = microtime(true);
            $result = $this->adapter->query($query, ZendDb::QUERY_MODE_EXECUTE);
            $affected_rows = $result->getAffectedRows();

            // Log stuffs
            $time_stop = microtime(true);
            $time = number_format(($time_stop - $time_start), 2);
            $formatted_query = preg_replace('/(\n)|(\r)|(\t)/', ' ', $query);
            $formatted_query = preg_replace('/(\ )+/', ' ', $formatted_query);
            $this->log("  * SQL: " . substr(trim($formatted_query), 0, 70) . '...') ;
            $this->log("  * SQL: Query time $time sec(s))");
        } catch (\Exception $e) {
            $err = $e->getMessage();
            $msg = "Error running query ({$err}) : \n--------------------\n$query\n------------------\n";
            $this->log("[+] $msg\n");
            if ($disable_foreign_key_checks) {
                $this->log("[Error] Error restoring foreign key checks");
                $this->adapter->query('set foreign_key_checks=1');
            }
            throw new \Exception($msg);
        }

        if ($disable_foreign_key_checks) {
            $time_start = microtime(true);
            $this->adapter->query('set foreign_key_checks=1');
            $time_stop = microtime(true);
            $time = number_format(($time_stop - $time_start), 2);
            $this->log("  * FK : Foreign keys restored");
        }
        $time_stop = microtime(true);
        $time = number_format(($time_stop - $total_time_start), 2);
        $this->log(" * Time: $time secs, affected rows $affected_rows.");
    }
1159643
public function remove( $selector, $key ){
		$rule	= $this->getRuleBySelector( $selector );
		if( !$rule )
			return FALSE;
		if( $rule->removePropertyByKey( $key ) ){
			if( !$rule->getProperties() )
				$this->removeRuleBySelector( $selector );
			return TRUE;
		}
		return FALSE;
	}