📄 orid.h
字号:
/o
o Get the type of the ADT instance
o/
/o find out the type of the ADT instance o/
if (oriogto(env, object, &adt_ref) != OROSTASUC)
/o error handling code o/
/o display the object o/
display(adt_ref, object, null_struct, attr_names, 0, attr_names_lengths,
attr_names_indexes, 0);
/o After the object is displayed, the program waits for the user to
o respond. The user modifies the values of an attribute and the
o program generates a path expression for the attribute and calls
o OCIObjectSetAttr() to set the value.
o/
if (OCIObjectSetAttr(env, object, null_struct, adt_ref,
(text **)attr_names, (ub4 *)attr_name_lengths,
attr_names_count, (ub4 *)attr_array_indexes,
attr_array_indexes_count,
(dvoid *)0, FALSE, (dvoid *)value) != OROSTASUC)
/o error handling code o/
END OF EXAMPLE 1
NOTES
This file has been subsetted to contain only the routines that will
be in the first release.
MODIFIED
bpalaval 02/09/01 - Change text to oratext.
whe 09/01/99 - 976457:check __cplusplus for C++ code
sthakur 09/18/97 - collection indexing not supported
cxcheng 08/05/97 - fix compile with short names
skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types
cxcheng 02/06/97 - take out short name support except with SLSHORTNAME
cxcheng 10/17/96 - final renaming of functions
jboonleu 10/07/96 - beautify with OCI long names
cxcheng 10/07/96 - change short names to long names for readability
jboonleu 09/27/96 - fix lint
jwijaya 07/03/96 - add ANSI prototypes
jboonleu 04/13/95 - new interface
jwijaya 10/11/94 - fix the sccs header and add namespace
tanguyen 08/22/94 - fix example
tanguyen 08/09/94 - remove Sccsid declaration
tanguyen 07/20/94 - fix OCIObjectSetAttr and OCIObjectGetAttr to
use position descriptor
tanguyen 07/18/94 - change 'object' type to become ptr to object
tanguyen 06/30/94 - Fix the ORID_ORACLE ifdef
tanguyen 06/27/94 - update to template format
skotsovo 05/12/94 - replace ado with attribute position
jweisz 05/11/94 - test new checkin facility
jwijaya 05/05/94 - orienv/ref/typ -> oroenv/ref/typ
jwijaya 02/07/94 - Creation
*/
#ifndef ORATYPES
#include <oratypes.h>
#endif
#ifndef ORO_ORACLE
#include <oro.h>
#endif
#ifndef OCI_ORACLE
#include <oci.h>
#endif
#ifndef ORID_ORACLE
#define ORID_ORACLE
#ifdef SLSHORTNAME
#define OCIObjectSetAttr oridset
#define OCIObjectGetAttr oridget
#endif /* SLSHORTNAME */
/*---------------------------------------------------------------------------*/
/* PUBLIC FUNCTIONS */
/*---------------------------------------------------------------------------*/
/*-------------------------- OCIObjectSetAttr ----------------------------*/
#if !defined(__STDC__) && !defined(__cplusplus) /* K&R C - not ANSI C */
sword OCIObjectSetAttr(/*_ OCIEnv *env, OCIError *err, dvoid *instance,
dvoid *null_struct, struct OCIType *tdo,
CONST oratext **names, CONST ub4 *lengths, CONST ub4 name_count,
CONST ub4 *indexes, CONST ub4 index_count,
CONST OCIInd null_status, CONST dvoid *attr_null_struct,
CONST dvoid *attr_value _*/);
#else /* ANSI C */
sword OCIObjectSetAttr( OCIEnv *env, OCIError *err, dvoid *instance,
dvoid *null_struct, struct OCIType *tdo,
CONST oratext **names, CONST ub4 *lengths, CONST ub4 name_count,
CONST ub4 *indexes, CONST ub4 index_count,
CONST OCIInd null_status, CONST dvoid *attr_null_struct,
CONST dvoid *attr_value );
#endif
/*
NAME: OCIObjectSetAttr - ORID SET value
PARAMETERS:
env (IN) - OCI environment handle initialized in object mode
err (IN) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
instance (IN) - pointer to an ADT instance
null_struct (IN) - the null structure of the ADT instance or array
tdo (IN) - pointer to the TDO
names (IN) - array of attribute names. This is used to specify
the names of the attributes in the path expression.
lengths (IN) - array of lengths of attribute names.
name_count (IN) - number of element in the array 'names'.
indexes (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4 *)0.
index_count (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4)0.
attr_null_status (IN) - the null status of the attribute if the type of
attribute is primitive.
attr_null_struct (IN) - the null structure of an ADT or collection
attribute.
attr_value (IN) - pointer to the attribute value.
REQUIRES:
DESCRIPTION:
This function set the attribute of the given object with the given
value. The position of the attribute is specified as a path
expression which is an array of names and an array of indexes.
RETURNS:
one of OROSTA*
EXAMPLES:
For path expression stanford.cs.stu[5].addr, the arrays will look like
names = {"stanford", "cs", "stu", "addr"}
lengths = {8, 2, 3, 4}
indexes = {5}
Also see the above example.
*/
/*-------------------------- OCIObjectGetAttr ----------------------------*/
#if !defined(__STDC__) && !defined(__cplusplus) /* K&R C - not ANSI C */
sword OCIObjectGetAttr(/*_ OCIEnv *env, OCIError *err, dvoid *instance,
dvoid *null_struct, struct OCIType *tdo, CONST oratext **names,
CONST ub4 *lengths, CONST ub4 name_count,
CONST ub4 *indexes, CONST ub4 index_count,
OCIInd *attr_null_status, dvoid **attr_null_struct,
dvoid **attr_value, struct OCIType **attr_tdo _*/);
#else /* ANSI C */
sword OCIObjectGetAttr( OCIEnv *env, OCIError *err, dvoid *instance,
dvoid *null_struct, struct OCIType *tdo, CONST oratext **names,
CONST ub4 *lengths, CONST ub4 name_count,
CONST ub4 *indexes, CONST ub4 index_count,
OCIInd *attr_null_status, dvoid **attr_null_struct,
dvoid **attr_value, struct OCIType **attr_tdo );
#endif
/*
NAME: OCIObjectGetAttr - ORID GET value
PARAMETERS:
env (IN) - OCI environment handle initialized in object mode
err (IN) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
instance (IN) - pointer to an ADT instance
null_struct (IN) - the null structure of the ADT instance or array
tdo (IN) - pointer to the TDO
names (IN) - array of attribute names. This is used to specify
the names of the attributes in the path expression.
lengths (IN) - array of lengths of attribute names.
name_count (IN) - number of element in the array 'names'.
indexes (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4 *)0.
index_count (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4)0.
attr_null_status (OUT) - the null status of the attribute if the type
of attribute is primitive.
attr_null_struct (OUT) - the null structure of an ADT or collection
attribute.
attr_value (OUT) - pointer to the attribute value.
attr_tdo (OUT) - pointer to the TDO of the attribute.
REQUIRES:
- a valid OCI environment handle must be given.
DESCRIPTION:
This function gets a value from an ADT instance or from an array.
If the parameter 'instance' points to an ADT instance, then the path
expression specifies the location of the attribute in the ADT.
It is assumed that the object is pinned and that the value returned
is valid until the object is unpinned.
RETURNS:
one of OROSTA*
EXAMPLES:
See example in OCIObjectSetAttr(). Also see the above example.
*/
#endif /* ORID_ORACLE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -