#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 boolean OCI_API OCI_TypeInfoFree | ( | OCI_TypeInfo * | typinf | ) |
Free a type info object.
typinf | - Type info handle |
Definition at line 377 of file typeinfo.c.
References OCI_TypeInfo::con, OCI_TypeInfo::refcount, and OCI_Connection::tinfs.
Referenced by OCI_TypeInfoGet().
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 71 of file typeinfo.c.
References OCI_TypeInfo::ccode, OCI_TypeInfo::cols, OCI_TypeInfo::con, OCI_Connection::cxt, OCI_Connection::err, OCI_TypeInfo::name, OCI_TypeInfo::nb_cols, OCI_TypeInfoFree(), OCI_TypeInfo::refcount, OCI_TypeInfo::schema, OCI_TypeInfo::tcode, OCI_TypeInfo::tdo, OCI_Connection::tinfs, and OCI_TypeInfo::type.
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 429 of file typeinfo.c.
References OCI_TypeInfo::cols, OCI_TypeInfo::con, and OCI_TypeInfo::nb_cols.
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 416 of file typeinfo.c.
References OCI_TypeInfo::nb_cols.
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 443 of file typeinfo.c.
References OCI_TypeInfo::name.
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 403 of file typeinfo.c.
References OCI_TypeInfo::type.