Merge commit 'origin/master'
[versaplex.git] / vxodbc / tuple.h
blobab60c588a0812b95342fdb642da0ba563b0e3297
1 /* File: tuple.h
3 * Description: See "tuple.c"
5 * Important NOTE: The TupleField structure is used both to hold backend
6 data and manual result set data. The "set_" functions
7 are only used for manual result sets by info routines.
9 * Comments: See "notice.txt" for copyright and license information.
13 #ifndef __TUPLE_H__
14 #define __TUPLE_H__
16 #include "psqlodbc.h"
18 /* Used by backend data AND manual result sets */
19 struct TupleField_
21 Int4 len; /* PG length of the current Tuple */
22 void *value; /* an array representing the value */
25 /* keyset(TID + OID) info */
26 struct KeySet_
28 UWORD status;
29 UInt2 offset;
30 UInt4 blocknum;
31 OID oid;
33 /* Rollback(index + original TID) info */
34 struct Rollback_
36 SQLLEN index;
37 UInt4 blocknum;
38 UInt2 offset;
39 UWORD option;
41 #define KEYSET_INFO_PUBLIC 0x07
42 #define CURS_SELF_ADDING (1L << 3)
43 #define CURS_SELF_DELETING (1L << 4)
44 #define CURS_SELF_UPDATING (1L << 5)
45 #define CURS_SELF_ADDED (1L << 6)
46 #define CURS_SELF_DELETED (1L << 7)
47 #define CURS_SELF_UPDATED (1L << 8)
48 #define CURS_NEEDS_REREAD (1L << 9)
49 #define CURS_IN_ROWSET (1L << 10)
50 #define CURS_OTHER_DELETED (1L << 11)
52 /* These macros are wrappers for the corresponding set_tuplefield functions
53 but these handle automatic NULL determination and call set_tuplefield_null()
54 if appropriate for the datatype (used by SQLGetTypeInfo).
56 #define set_nullfield_string(FLD, VAL) ((VAL) ? set_tuplefield_string(FLD, (VAL)) : set_tuplefield_null(FLD))
57 #define set_nullfield_int2(FLD, VAL) ((VAL) != -1 ? set_tuplefield_int2(FLD, (VAL)) : set_tuplefield_null(FLD))
58 #define set_nullfield_int4(FLD, VAL) ((VAL) != -1 ? set_tuplefield_int4(FLD, (VAL)) : set_tuplefield_null(FLD))
60 void set_tuplefield_null(TupleField *tuple_field);
61 void set_tuplefield_string(TupleField *tuple_field, const char *string);
62 void set_tuplefield_int2(TupleField *tuple_field, Int2 value);
63 void set_tuplefield_int4(TupleField *tuple_field, Int4 value);
64 SQLLEN ClearCachedRows(TupleField *tuple, int num_fields, SQLLEN num_rows);
65 SQLLEN ReplaceCachedRows(TupleField *otuple, const TupleField *ituple, int num_fields, SQLLEN num_rows);
67 #endif