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

Stored Procedures Support #287

Open
neogenie opened this issue Feb 19, 2021 · 8 comments
Open

Stored Procedures Support #287

neogenie opened this issue Feb 19, 2021 · 8 comments
Labels

Comments

@neogenie
Copy link
Contributor

What about Stored Procedures support in library? How to call & how to pass IN/OUT/INOUT parameters?

@thed636
Copy link
Contributor

thed636 commented Feb 19, 2021

Hi, Neo!

They should be called via query as described in the PostgreSQL documentation. Nothing special is needed. Any problem with the approach?

Best regards.

@neogenie
Copy link
Contributor Author

neogenie commented Feb 19, 2021

  1. I mean exactly Stored Procedures, not Functions.
  2. How to get OUT/INOUT parameters. SP return nothing and is it possible to receive any values only through parameters. Does query params bindings work by reference and will allow you to get values from Postgres?

@thed636
Copy link
Contributor

thed636 commented Feb 19, 2021

Well, there is CALL statement for this. Still, nothing special is needed, just a query.

@neogenie
Copy link
Contributor Author

Thanks, apparently need to ask more specific questions!

@neogenie neogenie reopened this Apr 19, 2021
@neogenie
Copy link
Contributor Author

Can you give an example of calling a stored procedure that has an INOUT parameter? In other words: how to use a call of ozo::execute to get the value returned by the stored procedure through the INOUT parameter? @thed636

@thed636
Copy link
Contributor

thed636 commented Apr 21, 2021

Hi, Neo!

As far as I understand the PostgreSQL documentation the out (or output part of INOUT) parameters may be obtained as a query result.

If the procedure has any output parameters, then a result row will be returned, 
containing the values of those parameters.

To get a query result ozo::request should be used.

Hope that helps.

@thed636
Copy link
Contributor

thed636 commented Apr 21, 2021

PS if you have any trouble with that please let me know. We didn't use a procedure call, the only function calls, but had no problem with that.

@neogenie
Copy link
Contributor Author

@thed636 thanks, i already found this workaround. This works as expected but need to pass really unused parameter in call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants