src/DB_Table.php
public function getStatement($sql, $args = false)
    {
        // The parsed sql statement
        $query = $this->buildQuery($sql, $args);

        if ($connection = $this->db->getConnection()) {
            //Prepare the statement
            if ($stmt = $connection->prepare($query)) {
                //Log the SQL Query first
                $this->log->report("SQL Statement: {$query}");

                // When fetched return an object
                $stmt->setFetchMode(\PDO::FETCH_INTO, new Collection());

                // If arguments were passed execute the statement
                if ($args) {
                    $this->log->report("SQL Data Sent: [" . implode(', ', $args) . "]");
                    $stmt->execute($args);
                }

                // Handles any error during execution
                if ($stmt->errorCode() > 0) {
                    $error = $stmt->errorInfo();
                    $this->log->error("PDO({$error[0]})[{$error[1]}] {$error[2]}");
                    return false;
                }

                return $stmt;
            } else {
                $this->log->error('Failed to create a PDO statement with: ' . $query);
                return false;
            }
        } else {
            // Failed to connect to the database
            return false;
        }
    }
public function getStatement($sql, $args = false)
    {
        // The parsed sql statement
        $query = $this->buildQuery($sql, $args);

        if ($connection = $this->db->getConnection()) {
            //Prepare the statement
            if ($stmt = $connection->prepare($query)) {
                //Log the SQL Query first
                $this->log->report("SQL Statement: {$query}");

                // When fetched return an object
                $stmt->setFetchMode(\PDO::FETCH_INTO, new Collection());

                // If arguments were passed execute the statement
                if ($args) {
                    $this->log->report("SQL Data Sent: [" . implode(', ', $args) . "]");
                    $stmt->execute($args);
                }

                // Handles any error during execution
                if ($stmt->errorCode() > 0) {
                    $error = $stmt->errorInfo();
                    $this->log->error("PDO({$error[0]})[{$error[1]}] {$error[2]}");
                    return false;
                }

                return $stmt;
            } else {
                $this->log->error('Failed to create a PDO statement with: ' . $query);
                return false;
            }
        } else {
            // Failed to connect to the database
            return false;
        }
    }
Get a PDO statement

@param string       $sql  SQL query string
@param bool|mixed[] $args argument to execute the statement with

@return bool|\PDOStatement