| 54 | # code must run when the method is invoked, not just when it is accessed. |
| 55 | |
| 56 | def callproc(self, procname, params=None, kparams=None): |
| 57 | # Keyword parameters for callproc aren't supported in PEP 249, but the |
| 58 | # database driver may support them (e.g. oracledb). |
| 59 | if kparams is not None and not self.db.features.supports_callproc_kwargs: |
| 60 | raise NotSupportedError( |
| 61 | "Keyword parameters for callproc are not supported on this " |
| 62 | "database backend." |
| 63 | ) |
| 64 | # Raise a warning during app initialization (stored_app_configs is only |
| 65 | # ever set during testing). |
| 66 | if not apps.ready and not apps.stored_app_configs: |
| 67 | warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning) |
| 68 | self.db.validate_no_broken_transaction() |
| 69 | with self.db.wrap_database_errors: |
| 70 | if params is None and kparams is None: |
| 71 | return self.cursor.callproc(procname) |
| 72 | elif kparams is None: |
| 73 | return self.cursor.callproc(procname, params) |
| 74 | else: |
| 75 | params = params or () |
| 76 | return self.cursor.callproc(procname, params, kparams) |
| 77 | |
| 78 | def execute(self, sql, params=None): |
| 79 | return self._execute_with_wrappers( |