~ubuntu-branches/ubuntu/lucid/psqlodbc/lucid

« back to all changes in this revision

Viewing changes to tuple.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-05-13 10:47:36 UTC
  • Revision ID: james.westby@ubuntu.com-20040513104736-a530gmn0p3knep89
Tags: upstream-07.03.0200
ImportĀ upstreamĀ versionĀ 07.03.0200

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* File:                        tuple.h
 
2
 *
 
3
 * Description:         See "tuple.c"
 
4
 *
 
5
 * Important NOTE:      The TupleField structure is used both to hold backend data and
 
6
 *                                      manual result set data.  The "set_" functions and the TupleNode
 
7
 *                                      structure are only used for manual result sets by info routines.
 
8
 *
 
9
 * Comments:            See "notice.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;                    /* length of the current Tuple */
 
22
        void       *value;                      /* an array representing the value */
 
23
};
 
24
 
 
25
/*      Used ONLY for manual result sets */
 
26
struct TupleNode_
 
27
{
 
28
        struct TupleNode_ *prev,
 
29
                           *next;
 
30
        TupleField      tuple[1];
 
31
};
 
32
 
 
33
/*      keyset(TID + OID) info */
 
34
struct KeySet_
 
35
{
 
36
        UWORD   status;
 
37
        UWORD   offset;
 
38
        UDWORD  blocknum;
 
39
        UDWORD  oid;
 
40
};
 
41
/*      Rollback(index + original TID) info */
 
42
struct Rollback_
 
43
{
 
44
        UDWORD  index;
 
45
        UDWORD  blocknum;
 
46
        UWORD   offset;
 
47
};
 
48
#define KEYSET_INFO_PUBLIC      0x07
 
49
#define CURS_SELF_ADDING        (1L << 3)
 
50
#define CURS_SELF_DELETING      (1L << 4)
 
51
#define CURS_SELF_UPDATING      (1L << 5)
 
52
#define CURS_SELF_ADDED         (1L << 6)
 
53
#define CURS_SELF_DELETED       (1L << 7)
 
54
#define CURS_SELF_UPDATED       (1L << 8)
 
55
#define CURS_NEEDS_REREAD       (1L << 9)
 
56
#define CURS_IN_ROWSET          (1L << 10)
 
57
#define CURS_OTHER_DELETED      (1L << 11)
 
58
 
 
59
/*      These macros are wrappers for the corresponding set_tuplefield functions
 
60
        but these handle automatic NULL determination and call set_tuplefield_null()
 
61
        if appropriate for the datatype (used by SQLGetTypeInfo).
 
62
*/
 
63
#define set_nullfield_string(FLD, VAL)          ((VAL) ? set_tuplefield_string(FLD, (VAL)) : set_tuplefield_null(FLD))
 
64
#define set_nullfield_int2(FLD, VAL)            ((VAL) != -1 ? set_tuplefield_int2(FLD, (VAL)) : set_tuplefield_null(FLD))
 
65
#define set_nullfield_int4(FLD, VAL)            ((VAL) != -1 ? set_tuplefield_int4(FLD, (VAL)) : set_tuplefield_null(FLD))
 
66
 
 
67
void            set_tuplefield_null(TupleField *tuple_field);
 
68
void            set_tuplefield_string(TupleField *tuple_field, const char *string);
 
69
void            set_tuplefield_int2(TupleField *tuple_field, Int2 value);
 
70
void            set_tuplefield_int4(TupleField *tuple_field, Int4 value);
 
71
 
 
72
#endif