nakagami / firebirdsql

Firebird RDBMS sql driver for Go (golang)
MIT License
224 stars 60 forks source link

Procedure exception doesn't work #96

Closed winex888 closed 4 years ago

winex888 commented 4 years ago

Hi! I have the following firebird procedure code create or alter procedure MY_SPCOUNTRY_EDIT ( CID_IN integer, CNAME R_NAME, CFULLNAME R_FULLNAME, USERID integer) returns ( CID integer) as begin if (condition) then begin exception exc_ur_common 'Error_text'; end other code

end next call row, err = db.Query("select cid from my_spcountry_edit(?,?,?,?)", cid, name, fullName, user)

I expect err that err contains 'Error_text' from firebird procedure, but err = nil How to get exeption text from firebird procedure?

nakagami commented 4 years ago

Error not occured when db.Query() But error occured on row.Scan() after row.Next()

winex888 commented 4 years ago

Thanks! rows.Next() return false I replaced db.Query with db.QueryRow, then row.Scan() return right error. In my case it’s ok. What to do when need multiple select?

nakagami commented 4 years ago

I have no good idea. Error occured on op_fetch_resoponse not op_execute

winex888 commented 4 years ago

Sorry, I don't see test for issue! Many thanks!

winex888 commented 4 years ago

may be use op_execute2 for stored procedure?

nakagami commented 4 years ago

The driver does not know stored procedure call or not, and seems example select statment needs op_execute.