OCILIB (C Driver for Oracle) 3.12.1
|
#include "ocilib.h" int main(void) { OCI_Connection *cn; OCI_TypeInfo *tbl; int i,n; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); tbl = OCI_TypeInfoGet(cn, "products", OCI_TIF_TABLE); if (tbl != NULL) { printf ("Column Name Type Length Prec. Scale Null ?\n"); printf ("---------------------------- ------------------------------\n"); n = OCI_TypeInfoGetColumnCount(tbl); for(i = 1; i <= n; i++) { OCI_Column *col = OCI_TypeInfoGetColumn(tbl, i); printf("%-20s%-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"); } } OCI_Cleanup(); return EXIT_SUCCESS; }
Functions | |
OCI_EXPORT OCI_TypeInfo *OCI_API | OCI_TypeInfoGet (OCI_Connection *con, const mtext *name, unsigned int type) |
Retrieve the available type info information. | |
OCI_EXPORT unsigned int OCI_API | OCI_TypeInfoGetType (OCI_TypeInfo *typinf) |
Return the type of the type info object. | |
OCI_EXPORT boolean OCI_API | OCI_TypeInfoFree (OCI_TypeInfo *typinf) |
Free a type info object. | |
OCI_EXPORT unsigned int OCI_API | OCI_TypeInfoGetColumnCount (OCI_TypeInfo *typinf) |
Retruns the number of columns of a table/view/object. | |
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. | |
OCI_EXPORT const mtext *OCI_API | OCI_TypeInfoGetName (OCI_TypeInfo *typinf) |
Return the name described by the type info object. |
OCI_EXPORT OCI_TypeInfo* OCI_API OCI_TypeInfoGet | ( | OCI_Connection * | con, |
const mtext * | name, | ||
unsigned int | type | ||
) |
Retrieve the available type info information.
con | - Connection handle |
name | - Table/view name to query for |
type | - Type of object |
Definition at line 76 of file typeinfo.c.
References OCI_TypeInfoFree(), and OCI_TypeInfoGet().
Referenced by OCI_TypeInfoGet().
OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetType | ( | OCI_TypeInfo * | typinf | ) |
Return the type of the type info object.
typinf | - Type info handle |
Definition at line 577 of file typeinfo.c.
OCI_EXPORT boolean OCI_API OCI_TypeInfoFree | ( | OCI_TypeInfo * | typinf | ) |
Free a type info object.
typinf | - Type info handle |
Definition at line 548 of file typeinfo.c.
Referenced by OCI_TypeInfoGet().
OCI_EXPORT unsigned int OCI_API OCI_TypeInfoGetColumnCount | ( | OCI_TypeInfo * | typinf | ) |
Retruns the number of columns of a table/view/object.
typinf | - Type info handle |
Definition at line 593 of file typeinfo.c.
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.
typinf | - Type info handle |
index | - Column position |
Definition at line 609 of file typeinfo.c.
OCI_EXPORT const mtext* OCI_API OCI_TypeInfoGetName | ( | OCI_TypeInfo * | typinf | ) |
Return the name described by the type info object.
typinf | - Type info handle |
Definition at line 627 of file typeinfo.c.