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 Procedure with standard database/sql interface? #145

Open
asaf opened this issue Jan 5, 2017 · 10 comments
Open

Stored Procedure with standard database/sql interface? #145

asaf opened this issue Jan 5, 2017 · 10 comments

Comments

@asaf
Copy link

asaf commented Jan 5, 2017

Hey,

Is there any way to return values from stored procedures using the standard database/sql API?

We're using packages such sqlx that expects the standard sql interface,

Thanks.

@tgulacsi
Copy link
Collaborator

tgulacsi commented Jan 6, 2017

AFAIK no. database/sql has very strict rules about the values drivers can return.

Please weigh in in golang/go#18415 and golang/go#18417 !

@asaf
Copy link
Author

asaf commented Jan 6, 2017

@tgulacsi yea I know, I was wondering if I have an instance of sql.DB I can cast it back or use its underline connection to use this package's API without re-opening another session / connection to perform the PrepAndExe call,

Another question, I have a map of fields, is it possible to bind fields by name instead of by position ?

Thanks.

@tgulacsi
Copy link
Collaborator

tgulacsi commented Jan 6, 2017 via email

@asaf
Copy link
Author

asaf commented Jan 6, 2017

@tgulacsi Thanks,

I'll try 1.8beta2, should it support fields by name in with the OUT parameters of a stored procedure call?
if I bind an output parameter by name, would I expect the corresponding key of the provided map to be overridden with the OUT param value?

Thanks,
Asaf/

@tgulacsi
Copy link
Collaborator

tgulacsi commented Jan 6, 2017 via email

@asaf
Copy link
Author

asaf commented Jan 6, 2017

@tgulacsi many thanks,

I guess we'll have to wait for go1.9 to for a more robust, enterprise-ready SQL API :-)

@tgulacsi
Copy link
Collaborator

tgulacsi commented Jan 6, 2017 via email

@asaf
Copy link
Author

asaf commented Jan 6, 2017

Will do, thanks!

@kardianos
Copy link

Support for OUTPUT params and custom types, and passing options into queries will be supported in go1.9 (already merged into master).

@tgulacsi
Copy link
Collaborator

tgulacsi commented Jun 7, 2017

@kardianos where shall we discuss how to use those sql.Out NamedArg Values? It's not clear from the docs yet.

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

No branches or pull requests

3 participants