indicators, esql and descriptor areas
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I have a problem where I'm using descriptor areas in esql, and Informix seems to be ignoring indicator values for input parameters in update or insert statements. It sets the data correctly in the database, but it never sets the field to null, even if the indicator value is -1. Here's an example: EXEC SQL ALLOCATE DESCRIPTOR "desc"; EXEC SQL BEGIN DECLARE SECTION; char* charData = "foo"; long len = 4; short ind = -1; int dataType = SQLVCHAR; int index = 1; EXEC SQL END DECLARE SECTION; EXEC SQL SET DESCRIPTOR :h_daName VALUE :index DATA = :charData, TYPE = :dataType, INDICATOR = :ind, LENGTH = :len; If I execute a statement using a statement like "UPDATE CUSTOMERS SET FIRST_NAME = ?" with the above descriptor area, the first name field is set to "foo", not null, as I would have expected. Any ideas? -- Steve Molitor smolitor@erac.com "Emacs is the Computer"
In article <uhfd8pcoe.fsf@erac.com>, Steve Molitor <smolitor@erac.com> wrote: > > I have a problem where I'm using descriptor areas in esql, and > Informix seems to be ignoring indicator values for input parameters in > update or insert statements. It sets the data correctly in the > database, but it never sets the field to null, even if the indicator > value is -1. > > Here's an example: > > EXEC SQL ALLOCATE DESCRIPTOR "desc"; > > EXEC SQL BEGIN DECLARE SECTION; > char* charData = "foo"; > long len = 4; > short ind = -1; > int dataType = SQLVCHAR; > int index = 1; > EXEC SQL END DECLARE SECTION; > > EXEC SQL SET DESCRIPTOR :h_daName VALUE :index > DATA = :charData, > TYPE = :dataType, > INDICATOR = :ind, > LENGTH = :len; > > If I execute a statement using a statement like "UPDATE CUSTOMERS SET > FIRST_NAME = ?" with the above descriptor area, the first name field > is set to "foo", not null, as I would have expected. > > Any ideas? > > -- > Steve Molitor > smolitor@erac.com > "Emacs is the Computer" > Indicators only tell you when something IS null, it can't be used to set something to null. At least, that's the indication I get from the book. -- # unrm / ksh: unrm: not found # man cpio Sent via Deja.com http://www.deja.com/ Before you buy.