Informix Datablade API manual errata? maybe ... 
Author Message
 Informix Datablade API manual errata? maybe ...

This is a multi-part message in MIME format.
--------------895CAA043E7B993ACDEACB2D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Preamble: I have the following db structures:

create row type ad_valid_t (
  adid integer not null,
  ts integer not null,
  count integer not null,
  valid integer not null);

create row type ad_user_t (
  uid integer not null,
  ts integer not null,
  ads list(ad_valid_t not null)
);

create table x of type ad_user_t
(
  PRIMARY KEY(uid)
);

Problem: nNow, I want to insert a record into the x table using
a prepared statement(C/MI library/Client application):
stmt = mi_prepare(conn,"insert into x values(?,?,?)",NULL);

The manual says:
"For client LIBMI applications, pass all values (regardless of
data type) by reference".- Informix Datablade API- programmer's
manual, page 5-29.

I respected the line for the above structure and ran into some problems
, 'cause, although everything worked ok allocating the collection and
obtaining the proper descriptors,  the row inserted was full of garbage.

I changed the addressing mode for the parameters (by value,
NOT by reference) and voila! the inserted row was suddenly ok.
- see the commented lines below marked with question marks ...

Now, did anybody run into this before me? What's funny is that
it seems that there is only one row (and not a row in a list (like
above))
it works like the manual said.
If somebody know what's happening, please!, enlighten me.

The C code follows:
-------------------------
      long pos = 1;
      while(currindex != -1) {
        pCell = advipc_getDataCell(currindex);

        /* ???? coll_values[0] = &(pCell->data.ld_data.ID); */
        coll_values[0] = pCell->data.ld_data.ID;
        coll_nulls[0] = MI_FALSE;

        /*????? coll_values[1] = &(pCell->data.ld_data.countPerAcc);*/
        coll_values[1] = pCell->data.ld_data.countPerAcc;
        coll_nulls[1] = MI_FALSE;

        /* ????? coll_values[2] = &(count); */
        coll_values[2] = count;
        coll_nulls[2] = MI_FALSE;

        /* ????? coll_values[3] = &(valid); */
        coll_values[3] = valid;
        coll_nulls[3] = MI_FALSE;

        row = mi_row_create(conn, rowdesc, coll_values, coll_nulls);
        if(row != NULL) {
          mi_collection_insert(conn, colldesc, row, MI_CURSOR_ABSOLUTE,
pos);
          pos++;
        }
        currindex = pCell->next;
      }
-------------------------

Radu

--------------895CAA043E7B993ACDEACB2D
Content-Type: text/x-vcard; charset=us-ascii;
 name="radu.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Radu Dumitriu
Content-Disposition: attachment;
 filename="radu.vcf"

begin:vcard
n:Dumitriu;Radu
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1

x-mozilla-cpt:;0
fn:Radu Dumitriu
end:vcard

--------------895CAA043E7B993ACDEACB2D--



Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Informix Developer Zone, Informix & VisualAge for Java , DataBlade API, Spatial DataBlade Modules, DataBlade with UDRs

2. Migration Informix Web Connect to Informix Web Datablade

3. Purify on datablade api showing MLK

4. Using DataBlade API Functions

5. Universal Server: DataBlade API or CLI

6. SBLOB Datablade API function problems

7. compiling w/ datablade api

8. Manual for API Server Cursors (getting parameter options)

9. ODBC 2.0 API Reference Manual for OpenLink Drivers??

10. Daily Rumor: Oracle to license Informix Datablades technology

11. Daily Rumor: Oracle to license Informix Datablades technology


 
Powered by phpBB® Forum Software