Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query 4th attribute can also be null #62

Closed
istaveren opened this issue Apr 18, 2019 · 1 comment
Closed

query 4th attribute can also be null #62

istaveren opened this issue Apr 18, 2019 · 1 comment

Comments

@istaveren
Copy link
Contributor

Summary of problem or feature request

pdo->query has multiple implementations. But the 4th parameter can be null.
See https://www.php.net/manual/en/pdo.query.php

With the current solution I get this error when I passing in null:

TypeError: Argument 4 passed to Yajra\Pdo\Oci8::query() must be of the type array, null given,

Code snippet of problem

$con->query('SELECT table_name FROM user_tables', null, null, null);

Solution

Match the docblock that tells it can be array|null
Also see setFetchMode.

    /**
     * Executes an SQL statement, returning the results as a
     * Yajra\Pdo\Oci8\Statement object.
     *
     * @param string $statement The SQL statement to prepare and execute.
     * @param int|null $fetchMode The fetch mode must be one of the
     *   PDO::FETCH_* constants.
     * @param mixed|null $modeArg Column number, class name or object.
     * @param array|null $ctorArgs Constructor arguments.
     * @return Statement
     */
    public function query($statement, $fetchMode = null, $modeArg = null, $ctorArgs = null)
istaveren added a commit to istaveren/pdo-via-oci8 that referenced this issue Apr 18, 2019
yajra added a commit that referenced this issue May 9, 2019
@yajra
Copy link
Owner

yajra commented May 9, 2019

Fixed via #62.

@yajra yajra closed this as completed May 9, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants