RaiseError (PERL, DBI) equivalent for unixODBC C API?

All that RaiseError in Perl does is say that when a DBD, like DBD::ODBC sees an error DBI will call any registered error handlers and call die with that error (depending on what the error handler returned). It is still up to the DBD to signal the error to DBI via set_err method I presume your Perl was using DBD::ODBC. DBD::ODBC will simply check the return status of every ODBC API it calls and if it is SQL_SUCCESS_WITH_INFO it calls DBIs set_err saying it is a warning and if it is!

SQL_SUCCEEDED it calls set_err saying there is an error (there are some exceptions like SQL_NO_DATA which is not always an error) If you are saying your Perl dies with the error you are expecting but your C code does not then you must not be checking an ODBC API return or perhaps (since you mention procedures) you are not ensuring you call SQLMoreResults in a loop after SQLExecute on the SQL to call the procedure. Bear in mind some databases execute each insert/select/update in a procedure one at a time and in ODBC you need to call SQLMoreResults to move through each one. If you don't do that your procedure had not completed and hence you may not have hit the error.

All that RaiseError in Perl does is say that when a DBD, like DBD::ODBC sees an error DBI will call any registered error handlers and call die with that error (depending on what the error handler returned). It is still up to the DBD to signal the error to DBI via set_err method. I presume your Perl was using DBD::ODBC.

DBD::ODBC will simply check the return status of every ODBC API it calls and if it is SQL_SUCCESS_WITH_INFO it calls DBIs set_err saying it is a warning and if it is! SQL_SUCCEEDED it calls set_err saying there is an error (there are some exceptions like SQL_NO_DATA which is not always an error). If you are saying your Perl dies with the error you are expecting but your C code does not then you must not be checking an ODBC API return or perhaps (since you mention procedures) you are not ensuring you call SQLMoreResults in a loop after SQLExecute on the SQL to call the procedure.

Bear in mind some databases execute each insert/select/update in a procedure one at a time and in ODBC you need to call SQLMoreResults to move through each one. If you don't do that your procedure had not completed and hence you may not have hit the error.

Well, I tried with SQLExecDirect and SQLExecute and both return SQL_SUCCESS :( So, respectively, SQL_SUCCEEDED(SQLExecute( stmt )) returns true :\ That's what worries me, But I haven't tried SQLMoreResults yet. – Kiril Kirov Jul 13 at 13:53 It's interesting, that executing the same with isql does not give me any errors, again. So, I guess it could be some configurable option?

– Kiril Kirov Jul 13 at 13:56 1 isql does not call SQLMoreResults – bohica Jul 13 at 14:53 If you want I could show you what DBD::ODBC does ODBC-wise. Just set DBI_TRACE=15=x. Log and export it then rerun your Perl.

You'll get loads out that will give you a clue. Alternatively, assuming you are using unixODBC driver manager you can enable tracing of all ODBC calls in that. – bohica Jul 13 at 14:54 "isql does not call SQLMoreResults" - Yes it does – Nick Gorham Jul 13 at 17:23.

I have a problem executing some stored procedures/functions in INFORMIX DB. I tried with different clients and they were all the same - no one detects errors on executing, instead of this - return empty responses. And this does not work for me.

And this works perfect. But is there such equivalent (I couldn't find anything, unfortunately) for the unixODBC C API lib? In addition: I tried the same query with isql and it's the same!

No errors, just empty result :\ Maybe it could be some option, that should be configured (in odbc. Ini, I guess..)? And the results from isql and ODBC C API are the same.

All calls to SQLMoreResults return SQL_NO_DATA, all SQLFetch return SQL_ERROR. Summary - all calls to wrong procedures are fine - error is returned. But if this error is in stored function - no error is detected; instead of this - EMPTY string is returned.

SQL_SUCCESS_WITH_INFO is not returned anywhere. And even more! I'll accept bohica'S answer, as it's correct and it answers right about the PERL DBI part.

Also, he really helped me (the hit with strace). Anyway, the real solution is not here.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions