This is a discussion on [Info-ingres] II_EMBED_SET dbmserror and SET_SQL within the Ingres forums, part of the Database Server Software category; --> Hi Dudes, I may have hold of the wrong end of the stick here but.... I have an ESQLC ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi Dudes, I may have hold of the wrong end of the stick here but.... I have an ESQLC program in which I want to use dbmserrors and not generic errors. I have II_EMBED_SET set globally as programquit;dbmserror According to the manual.... dbmserror”Makes local (DBMS) error numbers the default error numbers returned to the application in errorno and the SQLCA™s sqlcode. genericerror”Makes generic error numbers the default error numbers returned to the application in errorno and the SQLCA™s sqlcode. Ergo I would have thought that when my program called a database procedure: EXEC SQL execute procedure get_next_id (id=byref(:returned_id)) into :status; And during the execution of this procedure, it raised an error: raise error 999999 :errortext; The errornumber is considered a local DBMS error and, by default, is returned to SQLCA variable sqlerrd(1) and to dbmserror, which is accessible using inquire_sql. The generic error number corresponding to a raise error is 41300. This number is returned, by default, to errorno, which is accessible using inquire_sql, and to sqlcode, another SQLCA variable. The number in sqlcode will be negative (-41300). If you have specified that local errors are returned to errorno and sqlcode (by issuing the set_sql(dbmserror) statement), then the locations described above for the errornumber and its generic error number are reversed also. Which means that if dbmserror is in effect that the local (dbms) error is returned to errorno and the generic error returned to dbmserror.... Now that's seems a little weird/confusing to me! But the manual is fairly explicit on this and testing confirms that this is what occurs. Is this really what people want? Hence. my programs subsequent (to the procedure call) usage of: EXEC SQL inquire_sql(:errorno=dbmserror, :errortext=errortext); will return the generic error (41300) in errorno and not the local dbmserror of 999999. If I unset II_EMBED_SET program will return errorno=999999 and sqlca.sqlcode=-41300. Confusion reigned supreme for quite some time! But there may be some reason that the II_EMBED_SET is set on one host and not on others. I honestly don't know if this was deliberate, or as a misinterpretation of the dbmserror setting. So I thought, the best way of making the program transportable is to use the set_sql to specify dbmserror=0 and thus override the settings of II_EMBED_SET. According to the Manual: Set_sql can be used to override II_EMBED_SET. However, I find that the local setting of II_EMBED_SET beats the set_sql. Am I doing the right thing? Is setting dbmserror=0 the correct way to turn off the II_EMBED_SET setting? Is there a better way? Martin Bowes -- Random Farscape Quote #14: Rygel - I've learnt to make allowances for stress on this ship. |