Passing a descriptor to a function in ESQL/C?
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hello! I am trying to write a function in ESQL/C 5.00 that accepts/returns a cursor and/or a descriptor, so that this function can be used to work with several tables/databases within a program. Unfortunately, I can't get it to work. Here is what I have tried: /* --- Example --- */ main() { struct sqlda *desc; $char cursor[19]; ... sql_func(cursor, desc); ... } int sql_func(cursor, desc) $PARAMETER char *cursor; struct sqlda *desc; { ... $SET DESCRIPTOR desc COUNT = 1; ... } /* ---------------- */ esql complains with the message Error -33040: Object 'desc' was not declared. When I use $PARAMETER struct *sqlda; in the above example I get: Error -33200: Invalid statement on symbol 'sqlda'. Error -33006: Type of 'desc' is not appropriate for this use. What am I doing wrong? It must be either something very stupid or what I am trying to do is not possible in ESQL/C. (unlikely) Also, do I have to $ALLOCATE DESCRIPTOR before calling sql_func()? (tried it, but also got an error message at compile time.) -Walter