From 1b247a3682dfdab23e980e548cfb5b5397cdd34b Mon Sep 17 00:00:00 2001 From: genoa Date: Sun, 6 Dec 1992 19:40:58 +0000 Subject: [PATCH] Checkin prior to adding optimize_sql_stmt() --- server/qrtn.dc | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/server/qrtn.dc b/server/qrtn.dc index 57d44c37..4944c856 100644 --- a/server/qrtn.dc +++ b/server/qrtn.dc @@ -38,12 +38,10 @@ EXEC SQL END DECLARE SECTION; extern char *whoami; extern FILE *journal; -/** Maybe this should be replaced by something like tytso's sql_error */ - #define INGRES_BAD_DATE1 40206 #define INGRES_BAD_DATE2 40207 #define INGRES_DEADLOCK 49900 - +#define INGRES_TIMEOUT 39100 #define INGRES_BAD_COLUMN 30110 #define INGRES_ASGN_ERR 40204 #define INGRES_NO_CURSOR 30120 @@ -69,32 +67,31 @@ void ingerr() mr_errcode = MR_DEADLOCK; com_err(whoami, 0, "INGRES deadlock detected"); break; -/* I just don't know what the equivalent to this is, yet. - * case INGRES_TIMEOUT: - * mr_errcode = MR_BUSY; - * com_err(whoami, 0, "timed out getting lock"); - * break; - */ - case INGRES_NO_CURSOR: + case INGRES_TIMEOUT: +/* May be something other than timeout! #39100 is "Unknown error" + * Really should parse the error message enough to decide if it's a timeout */ + mr_errcode = MR_BUSY; + com_err(whoami, 0, "timed out getting lock"); + break; +/* These should never come up unless someone breaks the query table */ + case INGRES_NO_CURSOR: mr_errcode = MR_INTERNAL; com_err(whoami, 0, "Cursor not opened"); break; - case INGRES_NO_STMT: + case INGRES_NO_STMT: mr_errcode = MR_INTERNAL; com_err(whoami, 0, "Statement not declared"); break; -#if 0 - /* Taking these out during development lets default: give me the INGRES text */ - case INGRES_BAD_COLUMN: + case INGRES_BAD_COLUMN: mr_errcode = MR_INTERNAL; com_err(whoami, 0, "Bad column name in query table"); break; - case INGRES_ASGN_ERR: + case INGRES_ASGN_ERR: mr_errcode = MR_INTERNAL; com_err(whoami, 0, "Error in SQL assignment statement"); break; -#endif - default: +/* Others ??? */ + default: mr_errcode = MR_INGRES_ERR; com_err(whoami, MR_INGRES_ERR, " code %d\n", ingres_errno); EXEC SQL INQUIRE_SQL(:err_msg = errortext); @@ -321,16 +318,6 @@ mr_process_query(cl, name, argc, argv_ro, action, actarg) if (status != MR_NO_MATCH) break; } -#ifdef NEVER - /* This is now done by a valobj, which also fetches the id value */ - - /* increment id number if necessary */ - if (v->object_id) { - status = set_next_object_id(v->object_id, q->rtable, 0); - if (status != MR_SUCCESS) break; - } -#endif - /* build "where" clause if needed */ if (q->qual) { build_qual(q->qual, q->argc, Argv, qual); @@ -346,7 +333,7 @@ mr_process_query(cl, name, argc, argv_ro, action, actarg) status = do_append(q, &Argv[q->argc], pqual, action, actarg); if (status != MR_SUCCESS) break; if (v && v->object_id) { - sprintf(qual, "%s.%s = %s",q->rtable, v->object_id, + sprintf(qual, "%s.%s = %s",q->rvar, v->object_id, Argv[q->argc+q->vcnt]); incremental_after(q->rtable, qual, argv_ro); } else -- 2.45.2