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

Add convenience method DoArray() to Kernel::System::DB #2447

Closed
bschmalhofer opened this issue Aug 8, 2023 · 3 comments
Closed

Add convenience method DoArray() to Kernel::System::DB #2447

bschmalhofer opened this issue Aug 8, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bschmalhofer
Copy link
Contributor

Sometimes it is convenient to insert, update or delete several rows in on statement. For that purpose, DBI provides the method execute_array(). This method accepts arrrayrefs as bind variables. This functionality can be made available to OTOBO via the new method Kernel::System::DB::DoArray().

@bschmalhofer bschmalhofer added the enhancement New feature or request label Aug 8, 2023
@bschmalhofer bschmalhofer added this to the OTOBO 11.0 milestone Aug 8, 2023
@bschmalhofer bschmalhofer self-assigned this Aug 8, 2023
bschmalhofer added a commit that referenced this issue Aug 8, 2023
@bschmalhofer bschmalhofer changed the title Add convenience metho DoArray() to Kernel::System::DB Add convenience method DoArray() to Kernel::System::DB Aug 8, 2023
@bschmalhofer
Copy link
Contributor Author

PR is merged, but let's keep this issue open in case the implementation needs to be enhanced.

bschmalhofer added a commit that referenced this issue Aug 10, 2023
The scalar will be used for all relevant rows.
bschmalhofer added a commit that referenced this issue Aug 10, 2023
bschmalhofer added a commit that referenced this issue Aug 10, 2023
@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Aug 10, 2023

TODO:

  • allow a non-ref scalar as bind variable
  • add test for DoArray() with ArrayTupleFetch
  • go over the documentation, mention how to handle errors

bschmalhofer added a commit that referenced this issue Aug 11, 2023
that is, force scalar context when calling execute_array()
bschmalhofer added a commit that referenced this issue Aug 11, 2023
@bschmalhofer
Copy link
Contributor Author

ArrayTupleFetch is now working too. Closing this issue.

bschmalhofer added a commit that referenced this issue Sep 22, 2023
where Execute => 0 was passed
bschmalhofer added a commit that referenced this issue Sep 22, 2023
There is no need to call Prepar() in list context,
even for the 'Execute => 0' case.
Change because strange effects have been reported.
bschmalhofer added a commit that referenced this issue Sep 22, 2023
There is no need to call Prepare() in list context,
even in the 'Execute => 0' case.
Changed because strange effects have been reported.
bschmalhofer added a commit that referenced this issue Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant