{"action":"created","issue":{"url":"https://api.github.com/repos/rana/ora/issues/99","repository_url":"https://api.github.com/repos/rana/ora","labels_url":"https://api.github.com/repos/rana/ora/issues/99/labels{/name}","comments_url":"https://api.github.com/repos/rana/ora/issues/99/comments","events_url":"https://api.github.com/repos/rana/ora/issues/99/events","html_url":"https://github.com/rana/ora/issues/99","id":161919302,"number":99,"title":"srvCfg.StmtCfg.Rset.SetNumberBigFloat(ora.F64) does not work","user":{"login":"maliutin","id":10669340,"avatar_url":"https://avatars.githubusercontent.com/u/10669340?v=3","gravatar_id":"","url":"https://api.github.com/users/maliutin","html_url":"https://github.com/maliutin","followers_url":"https://api.github.com/users/maliutin/followers","following_url":"https://api.github.com/users/maliutin/following{/other_user}","gists_url":"https://api.github.com/users/maliutin/gists{/gist_id}","starred_url":"https://api.github.com/users/maliutin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maliutin/subscriptions","organizations_url":"https://api.github.com/users/maliutin/orgs","repos_url":"https://api.github.com/users/maliutin/repos","events_url":"https://api.github.com/users/maliutin/events{/privacy}","received_events_url":"https://api.github.com/users/maliutin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-23T13:12:02Z","updated_at":"2016-06-23T18:30:00Z","closed_at":null,"body":"go version: go1.6.2 windows/amd64\r\nora commit: 157b7bb2f6ff142e3885412eaaf5eb4a7993b9e7\r\n\r\nWe have AVAILABLE_BALANCE column of ACCOUNT table. Its type is NUMBER(10, 2)\r\n\r\n```SQL\r\nCREATE TABLE ACCOUNT(\r\n...\r\n  AVAILABLE_BALANCE NUMBER(10, 2) NOT NULL,\r\n...\r\n)\r\n```\r\n\r\nNow I need that ora provider returns values of AVAILABLE_BALANCE as float64.\r\n\r\nI used following code:\r\n\r\n```GO\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\r\n\tora \"gopkg.in/rana/ora.v3\"\r\n)\r\n\r\nfunc main() {\r\n\tvar err error\r\n\tvar env *ora.Env\r\n\r\n\tenv, err = ora.OpenEnv(nil)\r\n    if err != nil { panic(err) }\r\n\tdefer env.Close()\r\n\r\n\tvar srvCfg = ora.NewSrvCfg()\r\n\tsrvCfg.Dblink = \"host.com/ORCL\"\r\n\r\n\t// srvCfg.StmtCfg.Rset.SetNumberBigFloat(ora.F64) // does not work.\r\n\r\n\tvar srv *ora.Srv\r\n\tsrv, err = env.OpenSrv(srvCfg)\r\n\tif err != nil { panic(err) }\r\n\tdefer srv.Close()\r\n\r\n\tvar sesCfg *ora.SesCfg = ora.NewSesCfg()\r\n       sesCfg.Username = \"branch\"\r\n       sesCfg.Password = \"*****\"\r\n\r\n\tvar ses *ora.Ses\r\n\tses, err = srv.OpenSes(sesCfg)\r\n\tif err != nil { panic(err) }\r\n\tdefer ses.Close()\r\n\r\n\tvar stmt *ora.Stmt\r\n\tstmt, err = ses.Prep(\"CALL pkg_account.get_account(:1, :2)\")\r\n\tif err != nil { panic(err) }\r\n\r\n\tstmt.Cfg().Rset.SetNumberBigFloat(ora.F64)\r\n\r\n\trset := &ora.Rset{}\r\n\taccountId := int64(100005222)\r\n\r\n\t_, err = stmt.Exe(rset, accountId)\r\n\tif err != nil { panic(err) }\r\n\r\n\tcolumnNames := rset.ColumnNames\r\n\r\n\trow := rset.NextRow()\r\n\r\n\tfor i, name := range columnNames  {\r\n\t\tfmt.Printf(\"%d, %q, %T, %v\\n\", i, name, row[i], row[i])\r\n\t}\r\n\r\n\tfmt.Println(\"successful\")\r\n}\r\n```\r\n\r\nI wanted to set this option for all request but following does not it\r\n```GO\r\nsrvCfg.StmtCfg.Rset.SetNumberBigFloat(ora.F64)\r\n```\r\nOutput:\r\n```\r\n...\r\n10, \"AVAILABLE_BALANCE\", ora.OCINum, -326300\r\n...\r\nsuccessful\r\n```\r\n\r\nIf we set the option for the specified statement then we receive value as float64: \r\n```GO\r\nstmt.Cfg().Rset.SetNumberBigFloat(ora.F64)\r\n```\r\nOutput:\r\n```\r\n...\r\n10, \"AVAILABLE_BALANCE\", float64, -326300\r\n...\r\nsuccessful\r\n```"},"comment":{"url":"https://api.github.com/repos/rana/ora/issues/comments/228141563","html_url":"https://github.com/rana/ora/issues/99#issuecomment-228141563","issue_url":"https://api.github.com/repos/rana/ora/issues/99","id":228141563,"user":{"login":"tgulacsi","id":256074,"avatar_url":"https://avatars.githubusercontent.com/u/256074?v=3","gravatar_id":"","url":"https://api.github.com/users/tgulacsi","html_url":"https://github.com/tgulacsi","followers_url":"https://api.github.com/users/tgulacsi/followers","following_url":"https://api.github.com/users/tgulacsi/following{/other_user}","gists_url":"https://api.github.com/users/tgulacsi/gists{/gist_id}","starred_url":"https://api.github.com/users/tgulacsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgulacsi/subscriptions","organizations_url":"https://api.github.com/users/tgulacsi/orgs","repos_url":"https://api.github.com/users/tgulacsi/repos","events_url":"https://api.github.com/users/tgulacsi/events{/privacy}","received_events_url":"https://api.github.com/users/tgulacsi/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T18:29:59Z","updated_at":"2016-06-23T18:29:59Z","body":"TL;DR; OpenEnv does not use ora.Cfg().\n\nAs Far As I See,\n1. rset uses rset.stmt.cfg,\n2. which is from ses.cfg.StmtCfg,\n3. which is from srv.OpenSes(sesCfg),\n4. but if sesCfg.StmtCfg == nil, then (srv.go L252) ses.srv.cfg.StmtCfg is\nused;\n5. srv.cfg is from env.OpenSrv(srvCfg),\n6. but if srvCfg.StmtCfg == nil, then (env.go L167) srv.env.cfg.StmtCfg is\nused;\n7. env.cfg is from ora.OpenEnv(envCfg).\n\nPossible solutions:\na) put the same logic (if envCfg.StmtCfg == nil, then use\n_srv.sqlPkgEnv.cfg.StmtCfg) with envCfg,\nb) export _drv.sqlPkgEnv as ora.GetDrvEnv()\nc) both.\n\nWhat's your opinion?\n\nLeonid Maliutin <notifications@github.com> ezt írta (időpont: 2016. jún.\n23., Cs, 15:12):\n\n> go version: go1.6.2 windows/amd64\n> ora commit: 157b7bb\n> <https://github.com/rana/ora/commit/157b7bb2f6ff142e3885412eaaf5eb4a7993b9e7>\n>\n> We have AVAILABLE_BALANCE column of ACCOUNT table. Its type is NUMBER(10,\n> 2)\n>\n> CREATE TABLE ACCOUNT(\n> ...\n>   AVAILABLE_BALANCE NUMBER(10, 2) NOT NULL,\n> ...\n> )\n>\n> Now I need that ora provider returns values of AVAILABLE_BALANCE as\n> float64.\n>\n> I used following code:\n>\n> package main\n> import (\n>     \"fmt\"\n>\n>     ora \"gopkg.in/rana/ora.v3\"\n> )\n> func main() {\n>     var err error\n>     var env *ora.Env\n>\n>     env, err = ora.OpenEnv(nil)\n>     if err != nil { panic(err) }\n>     defer env.Close()\n>\n>     var srvCfg = ora.NewSrvCfg()\n>     srvCfg.Dblink = \"host.com/ORCL\"\n>\n>     // srvCfg.StmtCfg.Rset.SetNumberBigFloat(ora.F64) // does not work.\n>\n>     var srv *ora.Srv\n>     srv, err = env.OpenSrv(srvCfg)\n>     if err != nil { panic(err) }\n>     defer srv.Close()\n>\n>     var sesCfg *ora.SesCfg = ora.NewSesCfg()\n>        sesCfg.Username = \"branch\"\n>        sesCfg.Password = \"*****\"\n>\n>     var ses *ora.Ses\n>     ses, err = srv.OpenSes(sesCfg)\n>     if err != nil { panic(err) }\n>     defer ses.Close()\n>\n>     var stmt *ora.Stmt\n>     stmt, err = ses.Prep(\"CALL pkg_account.get_account(:1, :2)\")\n>     if err != nil { panic(err) }\n>\n>     stmt.Cfg().Rset.SetNumberBigFloat(ora.F64)\n>\n>     rset := &ora.Rset{}\n>     accountId := int64(100005222)\n>\n>     _, err = stmt.Exe(rset, accountId)\n>     if err != nil { panic(err) }\n>\n>     columnNames := rset.ColumnNames\n>\n>     row := rset.NextRow()\n>\n>     for i, name := range columnNames  {\n>         fmt.Printf(\"%d, %q, %T, %v\\n\", i, name, row[i], row[i])\n>     }\n>\n>     fmt.Println(\"successful\")\n> }\n>\n> I wanted to set this option for all request but following does not it\n>\n> srvCfg.StmtCfg.Rset.SetNumberBigFloat(ora.F64)\n>\n> Output:\n>\n> ...\n> 10, \"AVAILABLE_BALANCE\", ora.OCINum, -326300\n> ...\n> successful\n>\n> If we set the option for the specified statement then we receive value as\n> float64:\n>\n> stmt.Cfg().Rset.SetNumberBigFloat(ora.F64)\n>\n> Output:\n>\n> ...\n> 10, \"AVAILABLE_BALANCE\", float64, -326300\n> ...\n> successful\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/rana/ora/issues/99>, or mute the thread\n> <https://github.com/notifications/unsubscribe/AAPoShbM3UAyw0m63lUMtN1tGS3ZVK_Eks5qOoYigaJpZM4I8yyG>\n> .\n>\n"}}
{"actor":{"display_login":"tgulacsi"}}