OCILIB (C and C++ Driver for Oracle)  4.9.0
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
Describing Schema Meta data and Objects

Detailed Description

OcilibCApiAbort

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;
}
OCI_SYM_PUBLIC boolean OCI_API OCI_ConnectionFree(OCI_Connection *con)
Close a physical connection to an Oracle database server.
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_ConnectionCreate(const otext *db, const otext *user, const otext *pwd, unsigned int mode)
Create a physical connection to an Oracle database server.
struct OCI_Connection OCI_Connection
Oracle physical connection.
Definition: types.h:124
struct OCI_Error OCI_Error
Encapsulates an Oracle or OCILIB exception.
Definition: types.h:410
struct OCI_Column OCI_Column
Oracle SQL Column and Type member representation.
Definition: types.h:175
struct OCI_TypeInfo OCI_TypeInfo
Type info metadata handle.
Definition: types.h:386
OCI_SYM_PUBLIC const otext *OCI_API OCI_ErrorGetString(OCI_Error *err)
Retrieve the error message string from an error handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_Cleanup(void)
Clean up all resources allocated by the library.
OCI_SYM_PUBLIC boolean OCI_API OCI_Initialize(POCI_ERROR err_handler, const otext *lib_path, unsigned int mode)
Initialize the library.
OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_TypeInfoGet(OCI_Connection *con, const otext *name, unsigned int type)
Retrieve the available type info information.
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_TypeInfoGetColumn(OCI_TypeInfo *typinf, unsigned int index)
Return the column object handle at the given index in the table.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetColumnCount(OCI_TypeInfo *typinf)
Return the number of columns of a table/view/object.

Functions

OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_TypeInfoGet (OCI_Connection *con, const otext *name, unsigned int type)
 Retrieve the available type info information.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetType (OCI_TypeInfo *typinf)
 Return the type of the type info object.
 
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_TypeInfoGetConnection (OCI_TypeInfo *typinf)
 Retrieve connection handle from the type info handle.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TypeInfoFree (OCI_TypeInfo *typinf)
 Free a type info object.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetColumnCount (OCI_TypeInfo *typinf)
 Return the number of columns of a table/view/object.
 
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_TypeInfoGetColumn (OCI_TypeInfo *typinf, unsigned int index)
 Return the column object handle at the given index in the table.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_TypeInfoGetName (OCI_TypeInfo *typinf)
 Return the name described by the type info object.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TypeInfoIsFinalType (OCI_TypeInfo *typinf)
 Indicate if the given UDT type is final.
 
OCI_SYM_PUBLIC 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)
 

Function Documentation

◆ OCI_TypeInfoGet()

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

#include <api.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_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetType ( OCI_TypeInfo typinf)

#include <api.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
The object type, or OCI_UNKNOWN if the input handle is NULL.

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

◆ OCI_TypeInfoGetConnection()

OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_TypeInfoGetConnection ( OCI_TypeInfo typinf)

#include <api.h>

Retrieve connection handle from the type info handle.

Parameters
typinf- Type info handle
Returns
The connection handle, or NULL on failure.

Referenced by ocilib::TypeInfo::GetConnection(), ocilib::Object::GetTypeInfo(), ocilib::Reference::GetTypeInfo(), and ocilib::Column::GetTypeInfo().

◆ OCI_TypeInfoFree()

OCI_SYM_PUBLIC boolean OCI_API OCI_TypeInfoFree ( OCI_TypeInfo typinf)

#include <api.h>

Free a type info object.

Parameters
typinf- Type info handle
Note
This call is DEPRECATED. OCI_TypeInfo objects are internally tracked and automatically freed when their related connection is freed. Thus this method does nothing.
Returns
TRUE if the input handle is valid, otherwise FALSE.

◆ OCI_TypeInfoGetColumnCount()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetColumnCount ( OCI_TypeInfo typinf)

#include <api.h>

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

Parameters
typinf- Type info handle
Returns
The number of columns, or 0 on failure.

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

◆ OCI_TypeInfoGetColumn()

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

#include <api.h>

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

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

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

◆ OCI_TypeInfoGetName()

OCI_SYM_PUBLIC const otext *OCI_API OCI_TypeInfoGetName ( OCI_TypeInfo typinf)

#include <api.h>

Return the name described by the type info object.

Parameters
typinf- Type info handle
Returns
The type info name, or NULL on failure.

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

◆ OCI_TypeInfoIsFinalType()

OCI_SYM_PUBLIC boolean OCI_API OCI_TypeInfoIsFinalType ( OCI_TypeInfo typinf)

#include <api.h>

Indicate if the given UDT type is final.

Note
Non-final types are virtual UDT types 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_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_TypeInfoGetSuperType ( OCI_TypeInfo typinf)

#include <api.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, or NULL if the given type is not deriving from a base type.

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