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

Fix batchInsert() with associative arrays #242

Merged
merged 3 commits into from
Nov 12, 2023

Conversation

Tigrov
Copy link
Member

@Tigrov Tigrov commented Nov 4, 2023

Related with yiisoft/db#769

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues yiisoft/db#61

Copy link

what-the-diff bot commented Nov 4, 2023

PR Summary

  • Improvements to Query Building Process

In the DMLQueryBuilder.php file, we've made some key changes to improve how we generate and execute queries. By initializing a new variable ($columnKeys), we improve the efficiency of our loops and allow more accurate determination of column names. Moreover, the logic for building place-holders and adding them to $placeholders has been updated alongside the overall SQL query development, leading to more functional and streamlined queries.

  • Enhancements to Command Provision

In the CommandProvider.php file, we introduced the array_merge function to merge arrays, and a new array called $replaceParams to restyle information structure to meet certain needs more efficiently. We have also updated our $batchInsert array. Its keys are now paired with the expectedParams array values, allowing for a more accurate reflection of anticipated variables. The $replaceParams array's purpose is to iterate and update the $expectedParams array values within the $batchInsert array, offering more dynamic and efficient data updating.

Copy link

codecov bot commented Nov 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e0bd00d) 98.39% compared to head (40c1712) 98.45%.

❗ Current head 40c1712 differs from pull request most recent head d833bd3. Consider uploading reports for the commit d833bd3 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #242      +/-   ##
============================================
+ Coverage     98.39%   98.45%   +0.06%     
- Complexity      174      185      +11     
============================================
  Files            16       16              
  Lines           561      583      +22     
============================================
+ Hits            552      574      +22     
  Misses            9        9              
Files Coverage Δ
src/DMLQueryBuilder.php 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Tigrov Tigrov marked this pull request as ready for review November 4, 2023 07:58
Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Need line in changelog only.

@vjik vjik merged commit 700e6ea into yiisoft:master Nov 12, 2023
14 of 15 checks passed
@Tigrov Tigrov deleted the fix_batch_insert_with_associative_arrays branch December 6, 2023 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants