Help: Informix system descriptor errors
Posted in 1993
Topics: SQL Development & Query Writing, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
Help: Informix system descriptor errors I am writing C and ESQLC code to dynamically build a select statement and fetch the information from the database using a system descriptor area. I have no idea ahead of time what a person will choose to query on or the number of blobs blobs a person will choose to query on. Once the select statement is built, I prepare the select statement, declare a cursor, allocate the descriptor, open the cursor and describe the statement_id for the prepare statement. Next, I loop through the system descriptor area to determine the number of blobs and track the location of each blob in an array. Once I have done this, I calloc a loc_t structure for each blob(ie. host_var =(loc_t *)calloc(NumOfBlobs,sizeof(loc_t)). The next thing I do is to set up the loc_t structures and associate each with the appropriate blob before fetching and processing a row of data. ie. : while (state = 0){ for (i=0;i<NumOfBlobs;i++){ host_var[i].loc_loctype = LOCMEMORY; host_var[i].loc_bufsize = -1; host_var[i].loc_mflags = 0; EXEC SQL set descriptor "select_desc" value :location[i] data = :host_var[i]; } /* end for */ EXEC SQL fetch select_curs using sql descriptor "select_desc"; if (sqlca.sqlcode < 0){ print associate error message; state = sqlca.sqlcode; } if (sqlca.sqlcode >0){ print number of rows fetched; status = sqlca.sqlcode; } if (sqlca.sqlcode = 0){ process row; } } /* end while */ The fetch statement returns a database error number of -450 before all the rows are fetched sometimes and at other times it fetches all the appropriate rows. At other times I get the following error: signal SEGV (no mapping at the fault address) in stleng at 0x84b00 stleng: ldsb [%o0], %o2 stleng() at 0x84b00 _sqlocopen() at 0x75050 _sqg_blob() at 0x761f4 _iqupdtargs() at 0x6deb8 _iqftch() at 0x6d450 _iqcftch() at 0x6d368 The signal SEGV appear to be occurring down in fetch statement. The -450 error and the signal SEGV error appear to be occurring at random even when the Query/select statement is the same it may or may not return an error. I was wondering if anyone has ran into this problem before and if so is it possible to correct the problem and how. cbrown@sunkj.larc.nasa.gov