FAQ
Hi guys,
Does anyone know how to execute mysql stored procedure with output
parameters?

I use github.com/go-sql-driver/mysql


email:= v.Get("email")

pss:= v.Get("pss")


var userId string

var errorCode int


// Execute the query

rows, err := db.Query("CALL User_Register(?,?,?,?)", email,pss,errorCode, userId)

if err != nil {

      panic(err.Error())

}


I do know how to pass regular params and how to get the field's value from select in one row\rows



in my case, errorCode and userId will be output.



thanks in advance

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Arne Hormann at May 7, 2014 at 2:08 pm
    Stored procedures are unsupported in github.com/go-sql-driver/mysql.

    The reasoning: database/sql does not support retrieving multiple result
    sets, it would need a connection.NextResult().
    The driver tries to follow database/sql as close as possible and does not
    support multiple results either.
    Stored procedures might return multiple results, so support for them must
    be signalled with a flag on connection.
    The driver doesn't do that because it could not support it in all cases.

    Ergo, no stored procedures.

    Am Mittwoch, 7. Mai 2014 15:29:48 UTC+2 schrieb Kiril Skliar:
    Hi guys,
    Does anyone know how to execute mysql stored procedure with output
    parameters?

    I use github.com/go-sql-driver/mysql


    email:= v.Get("email")

    pss:= v.Get("pss")


    var userId string

    var errorCode int


    // Execute the query

    rows, err := db.Query("CALL User_Register(?,?,?,?)", email,pss,errorCode, userId)

    if err != nil {

    panic(err.Error())

    }


    I do know how to pass regular params and how to get the field's value from select in one row\rows



    in my case, errorCode and userId will be output.



    thanks in advance
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Daniel Theophanes at May 7, 2014 at 6:08 pm
    I am creating a more powerful database interface that supports output
    parameters.
    http://godoc.org/bitbucket.org/kardianos/rdb

    I am creating it tandem with a ms sql driver, and will start on a
    postgresql driver next. The api is still changing though and doesn't have a
    mysql driver yet.
    On Wednesday, May 7, 2014 6:29:48 AM UTC-7, Kiril Skliar wrote:

    Hi guys,
    Does anyone know how to execute mysql stored procedure with output
    parameters?

    I use github.com/go-sql-driver/mysql


    email:= v.Get("email")

    pss:= v.Get("pss")


    var userId string

    var errorCode int


    // Execute the query

    rows, err := db.Query("CALL User_Register(?,?,?,?)", email,pss,errorCode, userId)

    if err != nil {

    panic(err.Error())

    }


    I do know how to pass regular params and how to get the field's value from select in one row\rows



    in my case, errorCode and userId will be output.



    thanks in advance
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Kiril Skliar at May 7, 2014 at 7:33 pm
    I need a package for mysql that supports:
    1. Stored procedure
    2. Output parameter

    Do you know?

    On 7 במאי 2014, at 21:08, Daniel Theophanes wrote:

    I am creating a more powerful database interface that supports output parameters.
    http://godoc.org/bitbucket.org/kardianos/rdb

    I am creating it tandem with a ms sql driver, and will start on a postgresql driver next. The api is still changing though and doesn't have a mysql driver yet.
    On Wednesday, May 7, 2014 6:29:48 AM UTC-7, Kiril Skliar wrote:
    Hi guys,
    Does anyone know how to execute mysql stored procedure with output parameters?

    I use github.com/go-sql-driver/mysql


    email:= v.Get("email")
    pss:= v.Get("pss")

    var userId string
    var errorCode int

    // Execute the query
    rows, err := db.Query("CALL User_Register(?,?,?,?)", email,pss,errorCode, userId)
    if err != nil {
    panic(err.Error())
    }

    I do know how to pass regular params and how to get the field's value from select in one row\rows


    in my case, errorCode and userId will be output.


    thanks in advance
    --
    You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/5AJyGW9d9Wg/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 7, '14 at 1:29p
activeMay 7, '14 at 7:33p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase