Unix Technical Forum

[Info-ingres] II_EMBED_SET dbmserror and SET_SQL

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 ...


Go Back   Unix Technical Forum > Database Server Software > Ingres

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 08:11 PM
martin.bowes@ctsu.ox.ac.uk
 
Posts: n/a
Default [Info-ingres] II_EMBED_SET dbmserror and SET_SQL

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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:39 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com