1 /* File: tuple.h 2 * 3 * Description: See "tuple.c" 4 * 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. 8 * 9 * Comments: See "readme.txt" for copyright and license information. 10 * 11 */ 12 13 #ifndef __TUPLE_H__ 14 #define __TUPLE_H__ 15 16 #include "psqlodbc.h" 17 18 /* Used by backend data AND manual result sets */ 19 struct TupleField_ 20 { 21 Int4 len; /* PG length of the current Tuple */ 22 void *value; /* an array representing the value */ 23 }; 24 25 /* keyset(TID + OID) info */ 26 struct KeySet_ 27 { 28 UWORD status; 29 UInt2 offset; 30 UInt4 blocknum; 31 OID oid; 32 }; 33 /* Rollback(index + original TID) info */ 34 struct Rollback_ 35 { 36 SQLLEN index; 37 UInt4 blocknum; 38 UInt2 offset; 39 OID oid; 40 UWORD option; 41 }; 42 #define KEYSET_INFO_PUBLIC 0x07 43 #define CURS_SELF_ADDING (1L << 3) 44 #define CURS_SELF_DELETING (1L << 4) 45 #define CURS_SELF_UPDATING (1L << 5) 46 #define CURS_SELF_ADDED (1L << 6) 47 #define CURS_SELF_DELETED (1L << 7) 48 #define CURS_SELF_UPDATED (1L << 8) 49 #define CURS_NEEDS_REREAD (1L << 9) 50 #define CURS_IN_ROWSET (1L << 10) 51 #define CURS_OTHER_DELETED (1L << 11) 52 53 /* These macros are wrappers for the corresponding set_tuplefield functions 54 but these handle automatic NULL determination and call set_tuplefield_null() 55 if appropriate for the datatype (used by SQLGetTypeInfo). 56 */ 57 #define set_nullfield_string(FLD, VAL) ((VAL) ? set_tuplefield_string(FLD, (VAL)) : set_tuplefield_null(FLD)) 58 #define set_nullfield_int2(FLD, VAL) ((VAL) != -1 ? set_tuplefield_int2(FLD, (VAL)) : set_tuplefield_null(FLD)) 59 #define set_nullfield_int4(FLD, VAL) ((VAL) != -1 ? set_tuplefield_int4(FLD, (VAL)) : set_tuplefield_null(FLD)) 60 61 void set_tuplefield_null(TupleField *tuple_field); 62 void set_tuplefield_string(TupleField *tuple_field, const char *string); 63 void set_tuplefield_int2(TupleField *tuple_field, Int2 value); 64 void set_tuplefield_int4(TupleField *tuple_field, Int4 value); 65 SQLLEN ClearCachedRows(TupleField *tuple, int num_fields, SQLLEN num_rows); 66 SQLLEN ReplaceCachedRows(TupleField *otuple, const TupleField *ituple, int num_fields, SQLLEN num_rows); 67 68 typedef struct _PG_BM_ { 69 Int4 index; 70 KeySet keys; 71 } PG_BM; 72 73 #endif 74