Skip to content

feat: add foundRows option for MySQLi config - #8979

Merged
kenjis merged 6 commits into
codeigniter4:4.6from
ducng99:feat/add_foundrows_mysqli_config
Jun 25, 2024
Merged

feat: add foundRows option for MySQLi config#8979
kenjis merged 6 commits into
codeigniter4:4.6from
ducng99:feat/add_foundrows_mysqli_config

Conversation

@ducng99

Copy link
Copy Markdown
Contributor

Description
Added a new database config foundRows for MySQLi. Enabling this adds the flag MYSQLI_CLIENT_FOUND_ROWS when connecting to a MySQL database.

The flag changes the behaviour of affectedRows() for UPDATE or INSERT ... ON DUPLICATE KEY UPDATE, where the number of rows updated to the same value will also be returned. By default, it only returns the number rows with a value changed.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjiskenjis added enhancement PRs that improve existing functionalities database Issues or pull requests that affect the database layer 4.6 labels Jun 20, 2024
@ducng99

Copy link
Copy Markdown
ContributorAuthor

Update: fixed the CS issue in the test file

@ddevsr

Copy link
Copy Markdown
Collaborator

Looks good, by the way i see unit test in Database Live many skipped after connection to database. @kenjis I think better skipped in setUp? i can make PR later.

Comment threadsystem/Database/BaseConnection.php Outdated
Comment threadsystem/Database/MySQLi/Connection.php Outdated
Comment threaduser_guide_src/source/changelogs/v4.6.0.rst Outdated
@kenjis

Copy link
Copy Markdown
Member

I think better skipped in setUp?

Yes, it should be in the setUp() method.

Also add an ignore in phpstan to ignore missing foundRows in
BaseConnection
@ducng99

Copy link
Copy Markdown
ContributorAuthor

I have moved the DBDriver checks to setUp() but it would still make the connection to DB each time.
I can of course create a property like $testsSkipped and check it in each test, let me know if that's what you prefer.

Other suggested changes are applied

Comment threadtests/system/Database/Live/MySQLi/FoundRowsTest.php Outdated
Comment threadtests/system/Database/Live/MySQLi/FoundRowsTest.php Outdated

@michalsnmichalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@kenjiskenjis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@kenjis
kenjis merged commit ab71e4f into codeigniter4:4.6Jun 25, 2024
@ducng99

Copy link
Copy Markdown
ContributorAuthor

Thanks everyone!

@ducng99
ducng99 deleted the feat/add_foundrows_mysqli_config branch June 26, 2024 00:35
@alirahman99

Copy link
Copy Markdown

caranya biar bsa debuging instalasi pada codelnigter gimana

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

databaseIssues or pull requests that affect the database layerenhancementPRs that improve existing functionalities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@ducng99@ddevsr@kenjis@alirahman99@michalsn