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

Bug: insertBatch generates an incorrect SQL query if the fields differ only in number at the end #4345

Closed
ZlPredator opened this issue Feb 25, 2021 · 2 comments · Fixed by #4350
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@ZlPredator
Copy link

Example:

CREATE TABLE `ip_list` (`ip` VARCHAR(100),`ip2` VARCHAR(100))

Code:

$data = [
  [ 'ip' => '1.1.1.0', 'ip2' => '1.1.1.2' ],
  [ 'ip' => '2.2.2.0', 'ip2' => '2.2.2.2' ],
  [ 'ip' => '3.3.3.0', 'ip2' => '3.3.3.2' ],
  [ 'ip' => '4.4.4.0', 'ip2' => '4.4.4.2' ]
];
$db->table('ip_list')->insertBatch($data);

Generating incorrect SQL query:

INSERT INTO `ip_list` (`ip`,`ip2`) VALUES ('1.1.1.0','4.4.4.0'), ('2.2.2.0','2.2.2.2'), ('3.3.3.0','3.3.3.2'), ('4.4.4.0','4.4.4.2')

Seems error in setBind $this->binds[$key . $count] ...

Context

  • CodeIgniter: 4.0.4
  • PHP: 7.2.24
@ZlPredator ZlPredator added the bug Verified issues on the current code behavior or pull requests that will fix them label Feb 25, 2021
@paulbalandan
Copy link
Member

Can you try the latest release version or the latest develop branch if this is still an issue?

@paulbalandan
Copy link
Member

Confirming this issue on latest develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants