Fix DB connection get resource, needed for escaping

Some connection returned null as resource if the database was not connected yet. This gives problems when escaping these as it check the required resource e.g pdo  / pgsql etc to use the correct escaping.

It would always trigger notices when trying to build a query before database connection.
only IBM didn't needed this as it checks for a function not pdo.

```php
    /**
     * Quote value
     *
     * @param  string $value
     * @return string
     */
    public function quoteValue($value)
    {
        if (is_resource($this->resource)) {
            return '\'' . pg_escape_string($this->resource, $value) . '\'';
        }
        if ($this->resource instanceof \PDO) {
            return $this->resource->quote($value);
        }
        trigger_error(
            'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support '
                . 'can introduce security vulnerabilities in a production environment.'
        );
        return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
    }
```