queries the database for count
@param  string $sql
@param  array $vars the query to search for
@return int a count
353304
public function findCountRaw($sql, $vars) {
        $sth = $this->connection_manager->executeWithReconnect(function($mysql_dbh) use ($sql, $vars) {
            $sth = $mysql_dbh->prepare($sql);
            $sth->execute(array_values($vars));
            return $sth;
        });

        return $sth->rowCount();
    }
1277492
public function execute($sql, array $params=array())
	{
		if ($params) {
			$stmt = $this->prepare($sql);
			if (!$stmt) { return false; }

			$flag = $stmt->execute($params);
			if (!$flag) { return false; }
		} else {
			$stmt = $this->query($sql);
			if (!$stmt) { return false; }
		}

		return $stmt->rowCount();
	}
761022
protected function query ( $sql )
	{
		$sql = $this->sql_printf(func_get_args());
		try
		{
			$this->lastaffectedrows = $this->conn->exec($sql);
			if ($this->lastaffectedrows === FALSE) {
				$this->sql_errcheck($sql);
			}
		}
		catch (PDOException $e) 
		{
			$this->sql_errcheck($sql);
		}
	}
170953
protected function query_one ( $sql )
	{
		$sql = $this->sql_printf(func_get_args());
		if (!($res = mysql_query($sql, $this->conn)))
		{
			$this->sql_errcheck($sql);
		}
		$val = @mysql_result($res, 0, 0);
		mysql_free_result($res);
		return $val;
	}
253560
public function query($sql, $bindings = array())
		{
			list($statement, $result) = $this->execute($sql, $bindings);
			return $statement->fetchAll(PDO::FETCH_CLASS, 'stdClass');
		}
871761
protected function get_row( $query, $vars = '' ) {
		$query = $this->make_query( func_get_args() );
		return $this->db->get_row( $query );
	}
288558
function query($sql)
    {
        $res = false;

        for ($i = 0; $i < 2; $i++)
        {
            $res = mysql_query($sql, $this->conn);
            if ($res === false)
            {
                if (mysql_errno($this->conn) == 2006 or mysql_errno($this->conn) == 2013 or (mysql_errno($this->conn) == 0 and !$this->ping()))
                {
                    $r = $this->checkConnection();
                    if ($r === true)
                    {
                        continue;
                    }
                }
                \Swoole\Error::info(__CLASS__." SQL Error", $this->errorMessage($sql));
                return false;
            }
            break;
        }

        if (!$res)
        {
            Swoole\Error::info(__CLASS__." SQL Error", $this->errorMessage($sql));
            return false;
        }
        if (is_bool($res))
        {
            return $res;
        }
        return new MySQLRecord($res);
    }
216856
protected function query ( $sql )
	{
		list($sql, $args) = $this->sql_args(func_get_args());
		any_db_query($sql, $args);
	}
412692
public function fetchRows($sql, array $parameters = [], $indexedKeys = false)
    {
        $statement = $this->executeQuery($sql, $parameters);

        return $statement->fetchAll($indexedKeys ? PDO::FETCH_NUM : PDO::FETCH_ASSOC);
    }
894618
final public function query (string $sql)
	{
		static::$lastQuery 	= $sql;
		$result 			= mysqli_query($this->connection, $sql);
		$this->confirmQuery($result);
		return $result;
	}
913484
public function count( $conditions = array() )
	{
		$conditions	= $this->getConditionQuery( $conditions, FALSE, TRUE, TRUE );					//  render WHERE clause if needed, foreign cursored, allow functions
		$conditions	= $conditions ? ' WHERE '.$conditions : '';
		$query	= 'SELECT COUNT(`%s`) as count FROM %s%s';
		$query	= sprintf( $query, $this->primaryKey, $this->getTableName(), $conditions );
		return (int) $this->dbc->query( $query )->fetch( \PDO::FETCH_OBJ )->count;
	}
541384
public function countResult($wheres = [], $selectField = '*')
    {
        if (is_array($wheres) && count($wheres) > 0) {
            foreach ($wheres as $field => $value) {
                if (is_array($value)) {
                    $this->db->where($field, $value, self::OPERATOR_IS_IN);
                } else {
                    $this->db->where($field, $value, self::OPERATOR_EQUAL_TO);
                }
            }
        } else {
            $this->db->where($this->primaryKey, $wheres, self::OPERATOR_EQUAL_TO);
        }
        $result = $this->db->get($this->table, NULL, $selectField);
        $this->debug->debug(__FUNCTION__, 'Total Item Result => ' . json_encode($result));
        if ($this->db->count > 0) {
            return (int) $this->db->count;
        }

        return 0;
    }
166783
public function fetch_array($sql)
    {
        $rs   = $this->query($sql);
        $data = $rs->fetchArray(SQLITE3_ASSOC);
        $GLOBALS['__$DB_QUERY_COUNT']++;

        $rs->finalize();
        return $data;
    }
802758
public final function count(string $query = null, array $queryParams = null): ?int
    {
        $queryBuilder = new QueryBuilder($this->db->getLink());
        $queryBuilder->setTable($this->table);

        if ($query || $queryParams) {
            $queryBuilder->where($query, $queryParams);
        }

        return $queryBuilder->count();
    }
421718
protected function query_row_assoc ( $sql )
	{
		list($sql, $args) = $this->sql_args(func_get_args());
		return any_db_query_row_assoc($sql, $args);
	}
918362
public function countSoft($conditions = null, $values = [])
    {
        $res = $this->executeQuerySoft('COUNT(' . $this->key . ') AS num', $conditions, $values)
            ->fetch();
        return (isset($res->num) ? (int)$res->num : 0);
    }
1177010
public function query($sql, array $params = array())
    {
        //$helper = $this->getHelper();
        $con = $this->establishConnection();
        $sth = $con->prepare($sql, array(Connection::ATTR_CURSOR => Connection::CURSOR_SCROLL));

        // bind params
        foreach($params as $key => $value){
            $type = Connection::PARAM_STR;
            if ( is_null($value) ) {
                $type = Connection::PARAM_NULL;
            } elseif ( is_int($value) ) {
                $type = Connection::PARAM_INT;
            } elseif ( is_bool($value) ) {
                $type = Connection::PARAM_BOOL;
            } elseif ( is_resource($value) ) {
                $type = Connection::PARAM_LOB;
            }
            if ( is_int($key) ) {
                $sth->bindValue($key + 1, $value, $type);
            } else {
                $sth->bindValue($key, $value, $type);
            }
        }

        $result = $sth->execute();
        return $sth;
    }