SQLSTATE[HY093]: Invalid parameter number

Open
#458 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
50/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
mysql, php, sql
Domain
databases

Research direction

Start in yiisoft/db-mysql/src/Schema.php at loadTableForeignKeys and inspect the SQL query and its parameter bindings. Ensure the two schema-name placeholders are distinct and that the bindings match; the issue is done when PDO no longer reports SQLSTATE[HY093].

Written by the indexing model from the issue text.

Description

status:to be verified type:bug
Description

yiisoft/db-mysql/src/Schema.php 文件的 loadTableForeignKeys 方法中,SQL 查询使用了同一个参数名 :schemaName 两次,一次在 WHEN 子句中,一次在 WHERE 子句中。这导致PDO在参数绑定时出现错误

yiisoft/db-mysql/src/Schema.php 文件中重复使用了同一个参数名 :schemaName
修改了SQL查询,将重复的参数名改为不同的名称 :schemaName1 和 :schemaName2
更新了参数绑定代码以匹配修改后的查询

Package version

No response

PHP version

No response

Dominant language
PHP
Stars
42
Forks
21
Avg merge
1d 23h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yiisoft/db-mysql

All issues in yiisoft/db-mysql

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.