8 Replies Latest reply on Jan 3, 2013 12:32 PM by Jan-Marten Spit


      Hi All,

      I am having problems setting the attribute OCI_ATTR_PREFETCH_ROWS. I need to set the value of this attribute in order to decrease the number of trips to the server. Until now I am having one row per trip and this causes my application to be very slow on some cases, so I need to set this value to a higher values. I have tried this for a time but I have get no result... the applications always brings one row per trip.....
      Here is a resume of my code:

      status= (sword)OCIHandleAlloc((dvoid *)theApp.m_Config.m_pEnv,(dvoid **)&stmthp, OCI_HTYPE_STMT, 0,0);

      status= (sword)OCIHandleAlloc((dvoid *)theApp.m_Config.m_pEnv,(dvoid **)&stmthpdata, OCI_HTYPE_STMT, 0,0);

      text * get_struktur = (text *) "begin :refcursor:= eds.func_sl_struktur(:project); end;";

      ub4 rows = 10;

      OCIAttrSet((dvoid *)stmthp, (ub4) OCI_HTYPE_STMT,(dvoid *)&rows, (ub4)sizeof(ub4), (ub4)OCI_ATTR_PREFETCH_ROWS , theApp.m_Config.m_pErr);

      status = (sword)OCIStmtPrepare(stmthp,theApp.m_Config.m_pErr,(text *)get_struktur, (ub4)strlen((const char*)get_struktur), (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT);                     

      status = (sword) OCIBindByName(stmthp, bndp, theApp.m_Config.m_pErr,(text*) ":refcursor", (sb4)(strlen(":refcursor")),(dvoid *)&stmthpdata,0,SQLT_RSET,0,0,0,0,0,OCI_DEFAULT);

      status = (sword) OCIBindByName(stmthp, bind2, theApp.m_Config.m_pErr,(text*) ":project", (sb4)(strlen(":project")),Project.GetBufferSetLength(Project.GetLength()),Project.GetLength(),SQLT_CHR,0,0,0,0,0,OCI_DEFAULT);

      status = (sword)OCIStmtExecute(theApp.m_Config.m_pSvc,stmthp,theApp.m_Config.m_pErr,(ub4)1,(ub4)0,(CONST OCISnapshot *)NULL,(OCISnapshot *)NULL,OCI_DEFAULT);

      status = (sword)OCIDefineByPos(stmthpdata,&dfn8p[0], theApp.m_Config.m_pErr, 1, VaterId.GetBufferSetLength(10), 10, SQLT_AFC , 0, 0, 0, OCI_DEFAULT);

      status = (sword)OCIDefineByPos(stmthpdata,&dfn8p[1], theApp.m_Config.m_pErr, 2, VaterTyp.GetBufferSetLength(2), 2, SQLT_AFC, 0, 0, 0, OCI_DEFAULT);

      status= (sword) OCIStmtFetch2(stmthpdata, theApp.m_Config.m_pErr,1, OCI_DEFAULT, (sb4)0,OCI_DEFAULT);


      status= OCIStmtFetch2(stmthpdata, theApp.m_Config.m_pErr,1, OCI_DEFAULT, (sb4)0,OCI_DEFAULT);

      Am I doint something wrong or missing something?
      Any help will be welcome...
      Thanks in advance