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

feat: add foundRows option for MySQLi config #8979

Merged
merged 6 commits into from
Jun 25, 2024
Merged

feat: add foundRows option for MySQLi config #8979

merged 6 commits into from
Jun 25, 2024

Conversation

ducng99
Copy link
Contributor

@ducng99 ducng99 commented Jun 20, 2024

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

@kenjis kenjis 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
Contributor Author

ducng99 commented Jun 20, 2024

Update: fixed the CS issue in the test file

@ddevsr
Copy link
Collaborator

ddevsr commented Jun 21, 2024

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.

@kenjis
Copy link
Member

kenjis commented Jun 21, 2024

I think better skipped in setUp?

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

ducng99 added 2 commits June 21, 2024 21:13
Also add an ignore in phpstan to ignore missing foundRows in
BaseConnection
@ducng99
Copy link
Contributor Author

ducng99 commented Jun 21, 2024

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

Copy link
Member

@michalsn michalsn 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!

Copy link
Member

@kenjis kenjis left a comment

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.6 Jun 25, 2024
42 checks passed
@ducng99
Copy link
Contributor Author

ducng99 commented Jun 26, 2024

Thanks everyone!

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

caranya biar bsa debuging instalasi pada codelnigter gimana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Issues or pull requests that affect the database layer enhancement PRs that improve existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants