retreiving all meta data with OCI

From: luke <anduguid_at_shaw.ca>
Date: 20 Dec 2002 14:18:42 -0800
Message-ID: <5a901a8.0212201418.6e2cab60_at_posting.google.com>


hi,

having worked through the the oci samples & writing a few test beds myself i am still lost as how to retrieve the schema object list.

...
checkerr( errhp, OCIHandleAlloc((dvoid *) envhp, (dvoid **) &dschp,

            (ub4) OCI_HTYPE_DESCRIBE,
            (size_t) 0, (dvoid **) 0) );

  if ((retval = OCIDescribeAny( svchp, errhp, (dvoid *)"SCOTT",
                                (ub4) strlen( "SCOTT" ),
                                OCI_OTYPE_NAME, (ub1)1,
                                OCI_PTYPE_SCHEMA, dschp )) !=
OCI_SUCCESS) {
    if (retval == OCI_NO_DATA) {
      printf( "NO DATA: OCIDescribeAny on %s\n", 0 );     }
    else { // OCI Error.
      printf( "ERROR: OCIDescribeAny on %s\n", 0 );
      checkerr( errhp, retval );
      return;

    }
  }
  else {
    // get the parameter descriptor
    checkerr( errhp, OCIAttrGet( (dvoid *)dschp, (ub4)OCI_HTYPE_DESCRIBE,

(dvoid *)&parmp, (ub4 *)0,
(ub4)OCI_ATTR_PARAM,

(OCIError *)errhp ) );

    // 0bject list of 'SCOTT' schema
    checkerr( errhp, OCIAttrGet( (dvoid*) parmp, (ub4) OCI_DTYPE_PARAM,
(dvoid*)&objlst, (ub4 *) 0,
(ub4)OCI_ATTR_LIST_OBJECTS, (OCIError
*)errhp ) );     

    printf( "object list : %s\n", objlst );   

    // get number of parameters
    checkerr( errhp, OCIAttrGet( (dvoid*) parmp, (ub4) OCI_DTYPE_PARAM,
(dvoid*) &numlst, (ub4 *) 0,
(ub4) OCI_ATTR_NUM_PARAMS, (OCIError
*) errhp ) );

    printf( "number of objects in the database : %d\n", numlst );          

  }   

  // free the describe handle
  OCIHandleFree( (dvoid *) dschp, (ub4) OCI_HTYPE_DESCRIBE ); ...



checkerr( errhp, OCIAttrGet( (dvoid*) parmp, (ub4) OCI_DTYPE_PARAM,

(dvoid*)objlst, (ub4 *) 0,
(ub4)OCI_ATTR_LIST_OBJECTS, (OCIError
*)errhp ) );

apparently has an error of 'an invalid parameter', the only one i can see being the problem is OCI_ATTR_LIST_OBJECTS, which the doc's is a attribute type of text *, which is how it is declared.? on that matter does it even make sense for an object list to be text* ?

thanks, in advance,
luke Received on Fri Dec 20 2002 - 23:18:42 CET

Original text of this message