Hi, you have to use a cursor to use long data operations with sqlda.
E.g. use the following sequence: EXEC SQL PREPARE stmtupd from :stmt; EXEC SQL DECLARE :C1 CURSOR FOR stmtupd; EXEC SQL DESCRIBE stmtupd; EXEC SQL OPEN :C1 USING DESCRIPTOR KEEP; EXEC SQL PUTVAL :C1 USING DESCRIPTOR; The keyword KEEP at the end of the OPEN statement keeps the long columns open for inserting data by the use of following PUTVALs. Regards, Thomas Simenec SAP Labs Berlin -----Original Message----- From: Claus-Thomas Buhl [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 16. Juli 2003 18:32 To: [EMAIL PROTECTED] Subject: Storing binary data in LONG (BYTE) columns in ESQL/C I am using the C/C++ precompiler of SAP DB 7.3.0.34 and want to store binary data in LONG (BYTE) columns. I have the following ESQL/C code snippet, there are no database errors at runtime, but the data isn't stored. What am I doing wrong ? int Update (char * sqlstmt, tparam param[], int nparam) { EXEC SQL BEGIN DECLARE SECTION; char * stmt; char stmtupd[8]; EXEC SQL END DECLARE SECTION; sqlvartype *ha; int longcols=0; stmt = sqlstmt; EXEC SQL PREPARE stmtupd FROM :stmt; if (sqlca.sqlcode!=0){return 1;} EXEC SQL DESCRIBE stmtupd; if (sqlca.sqlcode!=0){return 1;} for (i=0;i<nparam;i++){ ha = &sqlda.sqlvar[i]; if (ha->col.colislong) { SQLLongDesc *ldesc = (SQLLongDesc *)alloca(sizeof(SQLLongDesc)); ldesc->szBuf = param[i].buf; ldesc->cbBufMax = param[i].size; ldesc->cbBufLen = param[i].size; ha->hostvartype=sqlvlongdesc; ha->hostvaraddr=ldesc; ha->hostcolsize = sizeof (SQLLongDesc); ha->collength = sizeof (SQLLongDesc); longcols = 1; } else { ... } } EXEC SQL EXECUTE stmtupd USING DESCRIPTOR; if (sqlca.sqlcode!=0 && sqlca.sqlcode!=100) {return 1;} if (longcols) { EXEC SQL PUTVAL stmtupd USING DESCRIPTOR; if (sqlca.sqlcode!=0 && sqlca.sqlcode!=100){return 1;} } return 0; } Regards, CTB -- _______ \o/|\o/ Claus-Thomas Buhl | Diplom-Informatiker \_____/ mailto:[EMAIL PROTECTED] H.E.I. GmbH | Wimpfener Strasse 23 | D-68259 Mannheim Fon: +49-(0)621-795141 | Fax: +49-(0)621-795161 | mailto:[EMAIL PROTECTED] http://www.h-e-i.de && http://www.hei.biz && http://www.radpage.com _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
