public function query($queryString, $suggestedClass = NULL)
    {
        if (!empty($this->log)) {
            $this->log->debug("Performing SQL: " . $queryString . '...', 'DATABASE');
        }

        $result = $this->mysqli->query($queryString);

        if (!empty($this->mysqli->error)) {
            throw new \Slab\Database\Exceptions\Query("Query error: " . $queryString . " with error " . $this->mysqli->error);
        }

        if (empty($result)) {
            throw new \Slab\Database\Exceptions\Query("Query Failed: " . $queryString . " with no error.");
        }

        $affectedRows = 0;
        $error = '';

        try
        {
            $affectedRows = $this->mysqli->affected_rows;
            $error = $this->mysqli->error;
        }
        catch (\Throwable $exception)
        {
            //This means we're in a test environment
        }

        $response = new Response();
        $response->initializeFromQueryResults(
            $result,
            $affectedRows,
            $error,
            $suggestedClass
        );

        return $response;
    }
public function query($queryString, $suggestedClass = NULL)
    {
        if (!empty($this->log)) {
            $this->log->debug("Performing SQL: " . $queryString . '...', 'DATABASE');
        }

        $result = $this->mysqli->query($queryString);

        if (!empty($this->mysqli->error)) {
            throw new \Slab\Database\Exceptions\Query("Query error: " . $queryString . " with error " . $this->mysqli->error);
        }

        if (empty($result)) {
            throw new \Slab\Database\Exceptions\Query("Query Failed: " . $queryString . " with no error.");
        }

        $affectedRows = 0;
        $error = '';

        try
        {
            $affectedRows = $this->mysqli->affected_rows;
            $error = $this->mysqli->error;
        }
        catch (\Throwable $exception)
        {
            //This means we're in a test environment
        }

        $response = new Response();
        $response->initializeFromQueryResults(
            $result,
            $affectedRows,
            $error,
            $suggestedClass
        );

        return $response;
    }
public function query ( $ queryString , $ suggestedClass = NULL ) { if ( ! empty ( $ this -> log ) ) { $ this -> log -> debug ( "Performing SQL: " . $ queryString . '...' , 'DATABASE' ) ; } $ result = $ this -> mysqli -> query ( $ queryString ) ; if ( ! empty ( $ this -> mysqli -> error ) ) { throw new \ Slab \ Database \ Exceptions \ Query ( "Query error: " . $ queryString . " with error " . $ this -> mysqli -> error ) ; } if ( empty ( $ result ) ) { throw new \ Slab \ Database \ Exceptions \ Query ( "Query Failed: " . $ queryString . " with no error." ) ; } $ affectedRows = 0 ; $ error = '' ; try { $ affectedRows = $ this -> mysqli -> affected_rows ; $ error = $ this -> mysqli -> error ; } catch ( \ Throwable $ exception ) { //This means we're in a test environment } $ response = new Response ( ) ; $ response -> initializeFromQueryResults ( $ result , $ affectedRows , $ error , $ suggestedClass ) ; return $ response ; }
Perform a standard query

@param string $queryString
@param string $suggestedClass
@throws \Slab\Database\Exceptions\Query
@return \Slab\Database\Providers\BaseResponse
Perform a standard query