-
Notifications
You must be signed in to change notification settings - Fork 66
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
Comments
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 ! |
@tgulacsi yea I know, I was wondering if I have an instance of Another question, I have a map of fields, is it possible to bind fields by name instead of by position ? Thanks. |
I've investigated this topic thoroughly, and database/sql protects the
underlying connection through two levels of unexported indirection - so
only unsafe methods could surface the underlying connection.
Fields by name: check out Go 1.8, the "v4" branch should work with Go
1.8beta2 (or master), and should provide that functionality - if not,
please report as bug!
Asaf Shakarzy <[email protected]> ezt írta (időpont: 2017. jan. 6.,
P, 10:53):
… @tgulacsi <https://github.com/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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#145 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPoSjvRrt22sNYKoNFAYXzpjk9zOY0uks5rPg76gaJpZM4LcP5z>
.
|
@tgulacsi Thanks, I'll try 1.8beta2, should it support fields by name in with the OUT parameters of a stored procedure call? Thanks, |
No, OUT parameters are restricted just the same.
If you want to ease your queries with lots of parameters, you can try
https://godoc.org/github.com/tgulacsi/go/orahlp#MapToSlice
Asaf Shakarzy <[email protected]> ezt írta (időpont: 2017. jan. 6.,
P, 11:31):
… @tgulacsi <https://github.com/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/
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#145 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPoSndlQhviDO84mCVvShefHlLjPU2Rks5rPhgFgaJpZM4LcP5z>
.
|
@tgulacsi many thanks, I guess we'll have to wait for go1.9 to for a more robust, enterprise-ready SQL API :-) |
Thats just 8 months!
So please contact @kardianos and write on those issues, as these are the
forums and now is the time to form that future API!
Asaf Shakarzy <[email protected]> ezt írta (időpont: 2017. jan. 6.,
P 12:07):
… @tgulacsi <https://github.com/tgulacsi> many thanks,
I guess we'll have to wait for go1.9 to for a more robust,
enterprise-ready SQL API :-)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#145 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPoSj7XF3xiQ6oT07-F8ByCeMeeIOhoks5rPiBqgaJpZM4LcP5z>
.
|
Will do, thanks! |
Support for OUTPUT params and custom types, and passing options into queries will be supported in go1.9 (already merged into master). |
@kardianos where shall we discuss how to use those sql.Out NamedArg Values? It's not clear from the docs yet. |
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.
The text was updated successfully, but these errors were encountered: