Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Very strange behaviour of SQL under OCI

Re: Very strange behaviour of SQL under OCI

From: Grzesiek <grzesiek_at_no.spam>
Date: Thu, 01 Apr 1999 18:54:30 GMT
Message-ID: <7e0aet$1fi$1@euler.softax.com.pl>

Thomas Kyte <tkyte_at_us.oracle.com> wrote in message news:370b7a5d.7377608_at_192.86.155.100...

> A copy of this was sent to "Grzesiek" <grzesiek_at_no.spam>
> (if that email address didn't require changing)
> On Thu, 01 Apr 1999 11:55:32 GMT, you wrote:
>
>
> Lets see the code.
>

OK. Actually I'm using some set of classes which covers primary OCI, but here is simplified, almost "pure C" version of the code. It produces output:

$ Records fetched: 1

while there are over 3000 records in table.

#define VERSION_7 2

/* zewnetrzne typy danych */
#define VARCHAR2_TYPE 1
#define NUMBER_TYPE 2
#define INT_TYPE 3
#define FLOAT_TYPE 4
#define STRING_TYPE 5
#define ROWID_TYPE 11
#define DATE_TYPE 12
#define RAW_TYPE 23
#define LONG_RAW_TYPE 24
#define UNSIGNED_TYPE 68
#define CHAR_TYPE 96
#define CHARZ_TYPE 97

extern "C"
{
#include <ociapr.h>

}
#include <iostream.h>
#include <string.h>

static int fetchSize = 20;

int main(void)
{

    ub1 m_hda[512];
    Lda_Def m_lda;
    Cda_Def m_cda;
    sb4 dbSize;
 sb2 dbType;
 sb4 displaySize;

    char *tmpFetch;
    ub2 *tmpLen;
    ub2 *tmpInd;

    memset(m_hda,0,sizeof(m_hda));
    if(olog(&m_lda, m_hda, (text*)"pz", -1, (text*)"pz", -1,

     (text*)"PZ", -1, OCI_LM_DEF))
        return -1;
    if (oopen(&m_cda, &m_lda, (text *)0, 1, 1, (text *)0, 1))
        return -1;
    if (oparse(&m_cda,
            (text*)"SELECT kod_odm FROM transakcje",
            (sb4) - 1, 0, (ub4)VERSION_7))
        return -1;

    if(odescr(&m_cda,
    1,
    &dbSize, &dbType,
    0, 0,
    &displaySize,
    0, 0,
    0))

        return -1;
    tmpFetch=new char[displaySize*fetchSize];     tmpLen=new ub2[fetchSize];
    tmpInd=new ub2[fetchSize];
 if (odefin(&m_cda, 1, (ub1 *)tmpFetch, displaySize,

     (sword)VARCHAR2_TYPE,
     (sword) - 1, (sb2 *)0, (text *)0, -1, -1,
     (ub2 *) tmpLen, (ub2 *) tmpInd))
        return -1;
    if(oexec(&m_cda) < 0)
        return -1;
    if(ofen(&m_cda,fetchSize) < 0)
        return -1;

    cout<<"Records fetched: "<<m_cda.rpc<<endl;     oclose(&m_cda);
    ologof(&m_lda);
    return 0;
} Received on Thu Apr 01 1999 - 12:54:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US