OCILIB (C and C++ Driver for Oracle)  4.6.3
Describing Schema Meta data and Objects

Detailed Description

Example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
int i, n;
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
tbl = OCI_TypeInfoGet(cn, "user_tables", OCI_TIF_VIEW);
printf("Column Name Type Length Prec. Scale Null ?\n");
printf("----------------------------------------------------------------------\n");
for (i = 1; i <= n; i++)
{
printf("%-30s%-10s%-8i%-8i%-8i%-s\n",
OCI_GetColumnName(col),
OCI_GetColumnSQLType(col),
OCI_GetColumnSize(col),
OCI_GetColumnPrecision(col),
OCI_GetColumnScale(col),
OCI_GetColumnNullable(col) == TRUE ? "Y" : "N");
}
return EXIT_SUCCESS;
}

Functions

OCI_EXPORT OCI_TypeInfo *OCI_API OCI_TypeInfoGet (OCI_Connection *con, const otext *name, unsigned int type)
 Retrieve the available type info information. More...
 
OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetType (OCI_TypeInfo *typinf)
 Return the type of the type info object. More...
 
OCI_EXPORT OCI_Connection *OCI_API OCI_TypeInfoGetConnection (OCI_TypeInfo *typinf)
 Retrieve connection handle from the type info handle. More...
 
OCI_EXPORT boolean OCI_API OCI_TypeInfoFree (OCI_TypeInfo *typinf)
 Free a type info object. More...
 
OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetColumnCount (OCI_TypeInfo *typinf)
 Return the number of columns of a table/view/object. More...
 
OCI_EXPORT OCI_Column *OCI_API OCI_TypeInfoGetColumn (OCI_TypeInfo *typinf, unsigned int index)
 Return the column object handle at the given index in the table. More...
 
OCI_EXPORT const otext *OCI_API OCI_TypeInfoGetName (OCI_TypeInfo *typinf)
 Return the name described by the type info object. More...
 
OCI_EXPORT boolean OCI_API OCI_TypeInfoIsFinalType (OCI_TypeInfo *typinf)
 Indicate if the given UDT type if final. More...
 
OCI_EXPORT OCI_TypeInfo *OCI_API OCI_TypeInfoGetSuperType (OCI_TypeInfo *typinf)
 Return the super type of the given type (e.g. parent type for a derived ORACLE UDT type) More...
 

Function Documentation

◆ OCI_TypeInfoGet()

OCI_EXPORT OCI_TypeInfo* OCI_API OCI_TypeInfoGet ( OCI_Connection con,
const otext *  name,
unsigned int  type 
)

#include <ocilib.h>

Retrieve the available type info information.

Parameters
con- Connection handle
name- Table/view name to query for
type- Type of object
Note
Possible values for parameter type are :
  • OCI_UNKNOWN
  • OCI_TIF_TABLE
  • OCI_TIF_VIEW
  • OCI_TIF_TYPE
Returns
  • Type info handle on success = - NULL if the object does not exist
  • NULL on failure

Referenced by ocilib::TypeInfo::TypeInfo().

◆ OCI_TypeInfoGetType()

OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetType ( OCI_TypeInfo typinf)

#include <ocilib.h>

Return the type of the type info object.

Parameters
typinf- Type info handle
Note
Possible values for parameter type are :
  • OCI_UNKNOWN
  • OCI_TIF_TABLE
  • OCI_TIF_VIEW
  • OCI_TIF_TYPE
Returns
Object type or OCI_UNKNOWN the input handle is NULL

Referenced by ocilib::TypeInfo::GetType().

◆ OCI_TypeInfoGetConnection()

OCI_EXPORT OCI_Connection* OCI_API OCI_TypeInfoGetConnection ( OCI_TypeInfo typinf)

#include <ocilib.h>

Retrieve connection handle from the type info handle.

Parameters
typinf- Type info handle

Referenced by ocilib::TypeInfo::GetConnection().

◆ OCI_TypeInfoFree()

OCI_EXPORT boolean OCI_API OCI_TypeInfoFree ( OCI_TypeInfo typinf)

#include <ocilib.h>

Free a type info object.

Parameters
typinf- Type info handle
Note
this call is optional. OCI_TypeInfo object are internally tracked and automatically freed when their related connection is freed
Returns
TRUE on success otherwise FALSE

◆ OCI_TypeInfoGetColumnCount()

OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetColumnCount ( OCI_TypeInfo typinf)

#include <ocilib.h>

Return the number of columns of a table/view/object.

Parameters
typinf- Type info handle

Referenced by ocilib::TypeInfo::GetColumnCount().

◆ OCI_TypeInfoGetColumn()

OCI_EXPORT OCI_Column* OCI_API OCI_TypeInfoGetColumn ( OCI_TypeInfo typinf,
unsigned int  index 
)

#include <ocilib.h>

Return the column object handle at the given index in the table.

Parameters
typinf- Type info handle
index- Column position
Returns
  • Column handle on success
  • NULL if index is out of bounds or on error

Referenced by ocilib::TypeInfo::GetColumn().

◆ OCI_TypeInfoGetName()

OCI_EXPORT const otext* OCI_API OCI_TypeInfoGetName ( OCI_TypeInfo typinf)

#include <ocilib.h>

Return the name described by the type info object.

Parameters
typinf- Type info handle

Referenced by ocilib::TypeInfo::GetName().

◆ OCI_TypeInfoIsFinalType()

OCI_EXPORT boolean OCI_API OCI_TypeInfoIsFinalType ( OCI_TypeInfo typinf)

#include <ocilib.h>

Indicate if the given UDT type if final.

Note
Non-final types are virtual UDT type that can be inherited
Parameters
typinf- Type info handle
Note
This property is only valid for UDTs (OCI_TIF_TYPE)
Returns

Referenced by ocilib::TypeInfo::IsFinalType().

◆ OCI_TypeInfoGetSuperType()

OCI_EXPORT OCI_TypeInfo* OCI_API OCI_TypeInfoGetSuperType ( OCI_TypeInfo typinf)

#include <ocilib.h>

Return the super type of the given type (e.g. parent type for a derived ORACLE UDT type)

Parameters
typinf- Type info handle
Note
This property is only valid for UDTs (OCI_TIF_TYPE)
Returns
  • when OCI_TypeInfoGetType() returns OCI_UNKNOWN, OCI_TIF_TABLE, OCI_TIF_VIEW:
    • returns NULL
  • when OCI_TypeInfoGetType() returns OCI_TIF_TYPE:
    • returns the TypeInfo handle wrapping the parent super type
    • returns NULL if the given type is NOT deriving from a base type

Referenced by ocilib::TypeInfo::GetSuperType().