Update cursors
Posted in 1991
Hello! I have a question about using cursors for update. I have an application using ESQL/C Version 4.0 trying to 'lock' a single record in a single table. I realize that I must use a cursor declared 'for update' in order to achieve the row-level lock. I would like to only have to declare the cursor once with parameters in the select statement that get filled in upon 'opening' the cursor using the 'using' clause. What I seem to need to do is to PREPARE my select statement as such: sprintf(buf, "select colx, coly, colz from tab1 where cola = ? and colb = ?"); $prepare stmt1 from buf; So far, so good. Now I try to declare my cursor for update: $declare curs1 for stmt1 for update; The problem is that the compiler squawks about a "Syntax error on keyword or symbol ';'. (sqlhost.y) "esqlc: internal error; sqlsetbuffer sql_buffer=3" Has anyone ever seen this before? My declare statment SHOULD work according to the documentation. I faked out the compiler by formatting my select statement with the 'for update' clause in it, but logically that doesn't make sense. The 'for update' clause is part of the cursor, not the select statement. Oh, yes - I also EXPLICTLY formatted my select statement with the correct values, which means I have to 'declare' the cursor EVERY TIME I want to use it. Does anyone have any helpful hints or insight? Any and all help is greatly appreciated! P.S. Please let me know if more information is needed. Joseph P. Tokarski Senior Software Engineer General DataComm, Inc. tokarski@nms.gdc.portal.com