Pro*C issues - some of the low level things

From: Clint Eastwood <cjundieseastwd_at_powerup.com.au>
Date: Fri, 03 Dec 1999 06:00:52 GMT
Message-ID: <827lvl$2ed31_at_inetbws1.citec.com.au>



HiYa

[Quoted] a few questions

[Quoted] I have worked a little in the past with Pro*C however at that site we had a lot of functional things wrapped already, in that role there wasn't much development of totally new things, and so I could get by by just understanding C and using the code examples that were already there. To do things we only had to make calls with code like:

EXEC SQL BEGIN DECLARE SECTION ;

     int     G_PAY_PRD_NR;
     int     G_REC_TYP;
     int     G_EMP_NR;
     varchar G_ADTNL_DATA_FLD1[8];
     varchar G_ADTNL_DATA_FLD2[8];
     varchar G_FREE_TEXT[60];

EXEC SQL END DECLARE SECTION ; and to declare a cursor:

EXEC SQL DECLARE SUPER_LINE CURSOR FOR

     select PAY_PRD_NR,
            REC_TYP,
            EMP_NR,
            EMP_IDN,
            EMP_SRNM,
            EMP_INTLS,
            SLRY,
            LCTN,
            EMP_CNTRB,
            PRE_TAX_CNTRB,
            EMP_VLNTR_CNTRB,
            CMPY_CNTRB,
            EXPT_CD,
            ADTNL_DATA_FLD1,
            ADTNL_DATA_FLD2,
            FREE_TEXT
     from   FN_SUPER_DTL
     where  PAY_PRD_NR = :G_PAY_PRD_NR
[Quoted]      order by REC_TYP;

then we could directly use this in the code like:

    EXEC SQL FETCH SUPER_LINE into

:G_PAY_PRD_NR,
:G_REC_TYP,
:G_EMP_NR,
:G_EMP_IDN,
:G_EMP_SRNM,
:G_EMP_INTLS,
:G_SLRY,
:G_LCTN,
:G_EMP_CNTRB,
:G_PRE_TAX_CNTRB,
:G_EMP_VLNTR_CNTRB,
:G_CMPY_CNTRB,
:G_EXPT_CD,
:G_ADTNL_DATA_FLD1,
:G_ADTNL_DATA_FLD2,
:G_FREE_TEXT;
[Quoted] is this the normal way that people use this?? I thought that it was until I started in this position, where I find that we are using straight C to insert a query into a string, then calling a function that is in another module like this:

[Quoted]   sprintf(sql_statement, "INSERT INTO System.Accounts VALUES('%s',%s')",

          account_code, user_group);

    if ((error_code = oracle_execute()) != 0)     {

        retries = 0;
        while ((retries < MAX_SQL_INSERT_RETRY) &&
               (error_code != 0) &&
               (strncmp(sqlca.sqlerrm.sqlerrmc,
                "ORA-00001: unique constraint (SYSTEM.SYS_C00370) 
violated\n",
                sqlca.sqlerrm.sqlerrml) == 0))




[Quoted] All of this seems like we are doing things the hard way here, but not having been up on what was done to set things up at the last place I am feeling a little like a flag in a strong wind.

I feel that things can be done differently, I just don't know how to set these things up.

help??

Is there a good reference that can help me fill in the holes that are in my knowledge??

thanks

See Ya
(when the bandwidth gets better ;-)

Chris Eastwood                            Please remove undies for reply
Photographer, Stunt Programmer
Motorcyclist and dingbat Received on Fri Dec 03 1999 - 07:00:52 CET

Original text of this message