sqlupdrow() — Update Row at Open Cursor

Updates the row at the current position of an open cursor. This function supports the EXEC SQL UPDATE...WHERE CURRENT OF... (positioned UPDATE) statement. If you precompile the statement, the preprocessor generates the r-code file to run it.

This function returns normalized values. For more information, see the function return values in the "General Diagnostics" section in this chapter:

SYNTAX
int
sqlupdrow ( sqln, flag, prequest, pvformat, psqlv )
  SQLRQHDL    *sqln;    /* INPUT */
  int         flag;          /* INPUT */
  char        *prequest;     /* INPUT */
  char        *pvformat;    /* INPUT */
  char         *psqlv[];     /* INPUT */ 

sqln

A pointer to the request handle for the open cursor. For more information on request handles, see the "SQL Request Handles" section.

flag

An execution flag that ESQL initializes.

prequest

A pointer to the text of the statement. If you precompile the statement, the text contains the name of the r-code file associated with the statement.

pvformat

A pointer to a format string that describes the types and lengths of the embedded host variables.

psqlv

A pointer to the host variables to which the current SQL request refers.

EXAMPLE

This example updates the row at the position of cursor x (associated with request handle sql0), adding 100 to the value of column max-credit:

#include "proesql.h"
static SQLRQHDL *sql0 = (SQLRQHDL *) 0;
            .
            .
            .
    /* EXEC SQL UPDATE CUSTOMER
       SET max\-credit = max\-credit + 100.0
       WHERE CURRENT OF x; */
   {
static char sqltxt[] = {
’U’,’P’,’D’,’A’,’T’,’E’,’,’C’,’U’,’S’,’T’,’O’,’M’,’E’,’R’,’,’S’,’E’,’T’,’,’m
’,’a’,’x’,’-’,’c’,’r’,’e,’d’,’i’,’t’,’,’=’,’,’m’,’a’,’x’,’-’,’c’,’r’,’e’,’d,
’i’,’t’,’,’+’,’,’1’,’0’,’0’,’.’,’0’,’,’W’,’H’,’E’,’R’,’E’,’,’C’,’U’,’R’,’R’,
’E’,’N’,’T’,’ ’,’O’,’F’,’,’x’,’.’,0};
static char sqlfmt[] = {0};
       sqlcdbind(&SQLCODE, (char *)0);
       sqlupdrow(sql0,(int)0x0100,sqltxt,sqlfmt, (char **) 0);
       if (SQLCODE < 0) goto err;
    } 

SEE ALSO

sqldelrow() — Delete Row at Open Cursor for executing positioned DELETE statements, sqldynrq() — Execute a Dynamic Non-SELECT Statement for updating rows of dynamic cursors, sqlrequest() — Execute a Static ESQL Statement for executing non-positioned static ESQL statements.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095