Support for calling stored prcoedure with array parameter#1048
Merged
bimalkjha merged 2 commits intoibmdb:masterfrom Feb 27, 2026
Merged
Support for calling stored prcoedure with array parameter#1048bimalkjha merged 2 commits intoibmdb:masterfrom
bimalkjha merged 2 commits intoibmdb:masterfrom
Conversation
Signed-off-by: Earamma K <ek@rocketsoftware.com>
Signed-off-by: Earamma K <ek@rocketsoftware.com>
bimalkjha
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented a new API to fetch the results of a stored procedure call using the prepare → bind → execute flow, with support for both scalar and array parameters.
Scalar support:
For procedures with single‑value arguments, ibm_db.fetch_callproc works seamlessly with ibm_db.callproc.
Scalars are bound using ibm_db.bind_param() with SQL_PARAM_INPUT, SQL_PARAM_OUTPUT, or SQL_PARAM_INOUT.
Python values are mapped directly to SQL types.
Array support:
For procedures with array arguments, the implementation applies correct cardinality and buffer allocation using SQLSetDescField() with SQL_DESC_CARDINALITY and SQL_DESC_CARDINALITY_PTR.
INPUT arguments use the Implementation Parameter Descriptor (hIPD).
OUTPUT arguments use the Application Parameter Descriptor (hAPD).
INOUT arguments configure both hIPD and hAPD.
This logic is executed internally after SQLBindParameter, ensuring that both scalar and array parameters are properly bound before execution.
After execution, ibm_db.fetch_callproc retrieves updated parameter values.
For input parameters return the same values passed in and for OUT/INOUT parameters return the modified values produced by the stored procedure.
This enhancement allows to pass either Python lists (for arrays) or scalars (for single values) as parameters and receive the updated values after execution as a tuple containing the statement object followed by the parameters passed to the procedure.