⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ort.h

📁 ORACLE访问接口
💻 H
📖 第 1 页 / 共 5 页
字号:
        case OCI_TYPECODE_NUMBER:                          /o oracle number o/
        case OCI_TYPECODE_DECIMAL:                               /o decimal o/
          {
            /o get the scale of the number o/
            if (OCITypeElemNumScale(env, err, ado) == 3)
              /o do something o/ ;
          }
          /o fall through to get the precision o/

        case OCI_TYPECODE_FLOAT:                                   /o float o/
        case OCI_TYPECODE_SIGNED32:                                 /o long o/
        case OCI_TYPECODE_UNSIGNED32:                      /o unsigned long o/
        case OCI_TYPECODE_REAL:                                     /o real o/
        case OCI_TYPECODE_DOUBLE:                                 /o double o/
          {
            /o get the precision of the number o/
            if (OCITypeElemNumPrec(env, err, ado) == 2)
              /o do something o/ ;
          }
          break;

        /o string types o/
        case OCI_TYPECODE_CHAR:                      /o fixed length string o/
        case OCI_TYPECODE_VARCHAR2:               /o variable length string o/
        case OCI_TYPECODE_RAW:                                       /o raw o/
          {
            /o get the length of the fixed or variable length string o/
            if (OCITypeElemLength(env, err, ado) < 100)
              /o do something o/
          }
          break;

        /o parameterized types o/
        case OCI_TYPECODE_REF:                          /o reference o/
        case OCI_TYPECODE_PTR:                            /o pointer o/
          {
            /o get the type stored in the parameterized type o/
            if (OCITypeElemParameterizedType(env, err, ado, &tdo)
                 != OCI_SUCCESS)
              /o error o/ ;

            /o do something o/
	    if (OCI_TYPEELEM_IS_REF(OCITypeElemFlags(env, err, ado)))...
          }
          break;

	/o domain type o/
	case OCI_TYPECODE_NAMEDCOLLECTION:
	  switch (OCITypeCollTypeCode(env, err, tdo))
	  {
	  case OCI_TYPECODE_VARRAY:                   /o variable array o/
            ub4   num_elems;
	    OCIType *element_type;

            /o get the number of elements in the farray or the maximum number
             o of elements in the varray.
             o/
            OCITypeCollSize(env, err, tdo, &num_elems);

            /o get the type of the array o/
	    OCITypeElemType(env, err, tdo, &element_type);
          }
          break;

          case OCI_TYPECODE_TABLE:                         /o multiset o/
          {
	    OCIType *table_type;

            /o get the type of the multiset o/
	    OCITypeElemType(env, err, tdo, &table_type);

            /o do something o/
          }
	}

        /o abstract type o/
        case OCI_TYPECODE_ADT:                 /o abstract data type o/
          {
            /o get the adt information o/
            if (OCITypeElemType(env, err, ado, &tdo) != OCI_SUCCESS)
              /o error o/ ;

            /o do something o/
          }
          break;

        default:
          DISCARD printf("Error:  invalid type code\n");

        } /o end of typecode switch o/

      } /o end of loop through all attributes in a type o/


      /o ------------ GET THE IMMEDIATE METHODS OF A TYPE ------------ o/

      /o loop through all methods in the type by reusing iterator o/
      if (OCITypeIterSet(env, err, car_tdo, iterator) != OCI_SUCCESS)
        /o do something o/

      while (OCITypeMethodNext(env, err, iterator) != OCI_NO_DATA)
      {
        /o get the method's name o/
        if (!memcmp(OCITypeMethodName(env, err, mdo, &text_len), "car",
                    text_len))
          /o do something o/  ;

        /o get the method's encapsulation o/
        if (OCITypeMethodEncap(env, err, mdo) == OCI_TYPEENCAP_PUBLIC)
          /o do something o/  ;

        /o get the method's flags o/
        meth_flags = OCITypeMethodFlags(env, err, mdo);
        if (meth_flags & OCI_TYPEMETHOD_VIRTUAL)  
          /o do something o/  ;


        /o ------------ GET THE PARAMETERS IN A METHOD ------------ o/

        /o loop through all parameters in the method o/
        count = OCITypeMethodParams(env, err, mdo);
        for (j = 1; j <= count; j++)
        {
          /o get the parameter information by position o/
          if (OCITypeParamByPos(env, err, mdo, i, &elem) != OCI_SUCCESS)
            /o error o/ ;

          /o get the parameter's name o/
          if (!memcmp(OCITypeElemName(env, err, elem, &text_len), "an_age",
                      text_len))
            /o do something o/ ;

          /o get the parameter's mode o/
          if (OCITypeElemMode(env, err, elem) == OCI_PARAM_OUT)
            /o do something o/ ;
   
          /o get the parameter's required flag o/
          if (ortgprq(env, err, elem))
            /o do something o/ ;
        }
      }

      /o get a method by name o/
      if (OCITypeMethodByName(env, err, car_tdo, "car_constructor", 
                              strlen("car_constructor"), NULLP(OCIRef), &mdo) 
                              != OCI_SUCCESS)
        /o error o/ ;

      /o get a parameter in a method by name o/
      if (OCITypeParamByName(env, err, mdo, "an_age", strlen("an_age"), &elem) 
                  != OCI_SUCCESS)
        /o error o/ ;

      /o get a parameter's typecode o/
      typecode = OCITypeElemTypeCode(env, err, elem);
   
      /o get a parameter's type object o/
      if (OCITypeElemType(env, err, elem, &tdo)) != OCI_SUCCESS)
        /o error o/ ;

      /o get a parameter's position in a method o/
      if (ortgpps(env, err, mdo, "an_age", strlen("an_age"), 
                  &position, NULLP(OCIRef), NULLP(OCITypeElem)) != OCI_SUCCESS)
        /o error o/ ;

      /o ------------ GET THE METHOD's RESULT ------------ o/
     
      /o get a method by name o/
      if (OCITypeMethodByName(env, err, car_tdo, "get_age", strlen("get_age"),
                  &mdo) != OCI_SUCCESS)
        /o error o/ ;

      /o get the typecode of the method's result o/
      typecode = OCITypeElemTypeCode(env, err, mdo);


      /o ----------------- END ---------------- o/

      /o free the references implicitly allocated o/
      DISCARD orlrfre(env, err, (dvoid *)&attr_ref);
      DISCARD orlrfre(env, err, (dvoid *)&param_ref);

  NOTES

  MODIFIED
    whe        09/01/99 -  976457:check __cplusplus for C++ code
    cxcheng    05/06/97 -  make OCI_TYPE?? test macros return either 1 or 0
    cxcheng    04/22/97 -  add comment on desupporting OCIType functions
    skrishna   03/18/97 -  fix ifdef for supporting ansi and k&r proto-types
    cxcheng    02/26/97 -  fix lint problem with oro names
    cxcheng    02/06/97 -  take out short name support except with SLSHORTNAME
    cxcheng    01/15/97 -  change prototype of OCITypeElemParameterizedType()
    cxcheng    01/03/97 -  replace bit in OCI_TYPEPARAM_IS_REQUIRED with bitwis
    cxcheng    12/31/96 -  replace OCI_PARAM_IS_REQUIRED with OCI_TYPEPARAM_IS_
    cxcheng    12/09/96 -  add prototype for OCITypeElemExtTypeCode and OCIType
    cxcheng    11/25/96 -  add schema name parameter to OCITypeVTInsert()
    cxcheng    11/20/96 -  fix prototype for OCITypeByName()
    cxcheng    11/11/96 -  fix prototype for OCITypeByName()
    cxcheng    11/05/96 -  remove OCITypeElemExtTypeCode and OCITypeCollExtType
    dchatter   10/28/96 -  change ortgatyp to be OCITypeArrayByName
    cxcheng    10/25/96 -  fix problem with ortgatyp at end
    cxcheng    10/22/96 -  add OCITypeByRef and OCITypeArrayByRef
    cxcheng    10/20/96 -  remove ortgtyp() from #define section at end
    cxcheng    10/18/96 -  rename OCITypeGetArray to OCITypeArrayByName
    cxcheng    10/17/96 -  final change to prototype for OCI_TYPEPARAM_IS_REQUI
    cxcheng    10/15/96 -  rename OCIEncapLevel and OCIMethodFlag
    cxcheng    10/14/96 -  change prototype of OCITypeResult
    mluong     10/11/96 -  fix compile error
    jwijaya    10/10/96 -  fix bug on OCI_PARAM_IS_REQUIRED
    cxcheng    10/09/96 -  more lint and link fixes
    cxcheng    10/08/96 -  more lint fixes
    cxcheng    10/07/96 -  more changes
    cxcheng    10/04/96 -  replace short names with long names
    cxcheng    10/01/96 -  change to long names for readability
    cxcheng    09/27/96 -  rename ortgatyp() to ortgtya() for lint
    cxcheng    09/20/96 -  add ortgatyp() for array get type
    cxcheng    09/18/96 -  add array pin and iterator functions
    cxcheng    08/09/96 -  add version table calls
    cxcheng    07/22/96 -  add OCITypeElemType() to top
    jwijaya    07/03/96 -  add ANSI prototypes
    cxcheng    06/28/96 -  add OCITypeElemCharSetForm()
    cxcheng    06/26/96 -  fix comment on OCITypeParamByPos()/ortgpps()
    cxcheng    06/18/96 -  fix comments on OCITypeResult()
    cxcheng    06/17/96 -  improve comments
    skrishna   06/03/96 -  change OCITypeCollElem() prototype
    vkrishna   05/29/96 -  replace OROTCFAR with OROTCCAR
    cxcheng    05/28/96 -  fix comments, remove non-beta1 functions
    cxcheng    05/02/96 -  fix prototype bugs
    cxcheng    04/29/96 -  rename OCITypeElemm() to ortanct()
    cxcheng    04/26/96 -  add ortgrbp and ortftyi,
                           fix comments and examples
    cxcheng    04/22/96 -  big merge to main branch
    cxcheng    04/17/96 -  fix syntax
    cxcheng    04/08/96 -  change prototype to ortaty()
    skrishna   04/08/96 -  change ort*() to take OCIEnv* and OCIError* instead
			   of oroenv*
    cxcheng    03/28/96 -  add ortslob(), change ortsstr() prototype
    cxcheng    03/13/96 -  change alter type interface
    cxcheng    03/11/96 -  ORT interface changes
    cxcheng    02/27/96 -  correct comments
    jboonleu   02/09/96 -  rename oroopd to OCIDuration
    cxcheng    01/19/96 -  change ORTCTYVAL to ORTCTYEMB for embedded ADT
    cxcheng    02/14/96 -  add more comments
    jboonleu   02/09/96 -  rename oroopd to OCIDuration
    cxcheng    02/07/96 -  fix comments and examples
    cxcheng    01/19/96 -  new ORT interface without korfc's
    cxcheng    01/08/96 -  consolidate collection functions
    cxcheng    12/14/95 -  remove obsolete ortgcol() and ortrelease()
    jweisz     12/12/95 -  merge screwup: ortdth twice
    cxcheng    12/05/95 -  change multiset interface for new standard
    skotsovo   12/01/95 -  merge from /vobs/rdbms/public/ort.h@@/main/
                           st_rdbms_big_dev/st_rdbms_obj/
                           st_rdbms_jwijaya_variable_ref
    cxcheng    11/13/95 -  add ortaty()/orteaty()
    cxcheng    11/13/95 -  add new collection type accessors
    skotsovo   10/30/95 -  add 'oid' type b/c extent type uses it.
    skotsovo   10/24/95 -  update according to new variable length ref
    cxcheng    10/05/95 -  add null support, change prototypes to calls
    cxcheng    10/03/95 -  add OCITypeMethodOrder() to get ORDER method
    cxcheng    09/28/95 -  add OCITypeElemm() for collection types support
    skotsovo   06/05/95 -  add adt_type parameter to ortsab() 
    skotsovo   05/10/95 -  ifdef'd out ortgafp() 
    skotsovo   03/07/95 -  update interface to only include release 1
    skotsovo   02/22/95 -  add multiset accessors 
    skotsovo   02/09/95 -  update according to new ots doc 
    skotsovo   01/31/95 -  add rest of release 1 types 
    skotsovo   01/24/95 -  categorize sint32, double, and real as number types 
			   (with precision and scale) instead of scalar types.
    skotsovo   01/12/95 -  remove dependency from ortdty interface 
    skotsovo   01/03/95 -  remove orotyp accessors 
    skotsovo   12/12/94 -  update comments 
    skotsovo   12/05/94 -  change OCITypeElemParameterizedTyper interface 
    skotsovo   10/26/94 -  add type version table 
    skotsovo   10/17/94 -  fix ortgafp() comments 
    skotsovo   10/14/94 -  modify ortgafp() parameters 
    skotsovo   10/14/94 -  add examples 
    skotsovo   10/13/94 -  add a few new routines 
    jwijaya    10/07/94 -  add namespace to pin by name 
    jwijaya    10/02/94 -  connection handle -> connection number 
    skotsovo   09/13/94 -  modify example to use updated oririni interface 
    skotsovo   08/25/94 -  change scale to sb1 from sb2 
    skotsovo   07/28/94 -  add ortbeg() and ortend() 
    skotsovo   07/14/94 -  add decimal type & call graph
    skotsovo   06/28/94 -  subset by removing miscellaneous functions 
    skotsovo   06/28/94 -  consistently put comments before typedefs 
    skotsovo   06/27/94 -  modify according to new header file template, add
                           more examples, and change ortcty() to return a
                           reference to the type
    skotsovo   06/24/94 -  add functions to get type information from orotyp 
    skotsovo   06/20/94 -  finish modifying according to header template 
    skotsovo   06/09/94 -  modify according to header file template 
    skotsovo   06/08/94 -  replace s.h with oratypes.h 
    skotsovo   05/24/94 -  modify comments & update example
    skotsovo   05/23/94 -  modify fnt names for create, alter and drop type 
    skotsovo   05/18/94 -  remove ortdme() -- delete a method 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -