oracle pro/c, threads, and prepared statements

From: <allan_alum_mit_edu_at_my-dejanews.com>
Date: Sun, 09 Aug 1998 13:02:51 GMT
Message-ID: <6qk6lr$8hu$1_at_nnrp1.dejanews.com>



I think I've run into one of those "can't get there from here" programming problems with the oracle libraries (which i'm quite new to).

How can I make the following code work:
0) start a bunch of threads and do some concurrent work. i'm using array

        indexes into global variables on almost everything.  the number of
        threads is pretty large and unknown until runtime.
1)  i copy my query to dynstmt

2) EXEC SQL PREPARE S FROM :dynstmt;
3) EXEC SQL EXECUTE S USING :value, :tptr->nodeptr->name.arr, :node,

        variables[tptr->index][0]->obj.arr, :tptr->nodeptr->customer.arr;

Of course statement 3 doesn't compile.
So what I have to do is:
3a) mutex lock
3b) copy tptr->nodeptr->name.arr ==> nametmp

    copy variables[tptr->index][0]->obj.arr ==> objtmp     copy tptr->nodeptr->customer.arr ==> customertmp 3c) EXEC SQL EXECUTE S USING :value, :nametmp, :node, :objtmp, :customertmp; 3d) mutex unlock.
This of course works, but I lose all the benefits of writing to the database concurrently. And no, I rather not try programming with the raw OCI interface again. The only way I can think of, is modifying the .c file after I've run it through Pro/C.

Thanks in advance,
allan

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Sun Aug 09 1998 - 15:02:51 CEST

Original text of this message