Skip to content

mysqli IN support - dynamic number of placeholders #299

Open
@staabm

Description

@staabm

mysqli requires some crazy gymnastics to support IN statements with an arbitrary number of elements.
we should figure out whether this can somehow be protected/covered by phpstan-dba

from the php.net docs

<?php

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'world');

// XXX numer of "?" depends on number of elements passed into "bind_param"
$stmt = $mysqli->prepare("SELECT Language FROM CountryLanguage WHERE CountryCode IN (?, ?)"); 

/* Using ... to provide arguments */
$stmt->bind_param('ss', ...['DEU', 'POL']);
$stmt->execute();
$stmt->store_result();

printf("%d rows found.\n", $stmt->num_rows());

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions