esql/c
Posted in 2005
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
Hello all, I'd need a little assistance at the client API: For our application I created an interface-module esql.ec, which is the only module using embedded sql, all SQL-requests are passed through that module making the rest of the application as independend as possible (except the sql-statements ). Now I'd need a little enhancement, which I'm not pretty shure how to manage. I'd like to set up a function: SQL_Prepare(char* id, char* sql) which should issue a prepare of the given id. unfortunately the statement-id can't be a host-variable. I would not hesitate to use the basic function-calls, which are generated by esqle.g. int SQL_Prepare(char* id, char* sql) { /* $ prepare id from :sql */ sqli_prep(ESQLINTVERSION, id, sql,(ifx_literal_t *) 0, (ifx_namelist_t *) 0, -1, 0,0 ); return sqlca.sqlcode; } But when executing that statement, there are some cryptic numbers in the sqli_curs_locate() function: (creation of sqlda is one level above, in a printf-like manner) int SQL_ExecId(char* id, struct sqlda* p_da) { /* * $execute id_exec using descriptor p_da; */ sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, id, 769), p_da, (char *) 0, (struct value *) 0, (ifx_sqlda_t *) 0, (char *) 0, (struct value *) 0, 0); return sqlca.sqlcode; } That Number representing the last argument should be a type (as of sqliapi.h) MI_EXT_DECL ifx_cursor_t *sqli_curs_locate(int4 version, const char *name, mint type); But how to determine the correct type ? thanks for assistance Peter Weigert PS: I'm actually using esql 9.53.UC3 PPS: I'll care for the FreeId() function as well...
Peter Weigert wrote: > Hello all, > > I'd need a little assistance at the client API: > > For our application I created an interface-module esql.ec, which is the only > module using embedded sql, all SQL-requests are passed through that module > making the rest of the application as independend as possible (except the > sql-statements ). > > Now I'd need a little enhancement, which I'm not pretty shure how to manage. > I'd like to set up a function: > SQL_Prepare(char* id, char* sql) which should issue a prepare of the given > id. > unfortunately the statement-id can't be a host-variable. Yes it can, as can cursor names. It is a char* type containing the stmt name. We use that facility all the time. Just know that it reduces portability since noone elses ESQL/C can let you do that. Art S. Kagel <SNIP>