File: tuple.h

package info (click to toggle)
psqlodbc 1%3A07.03.0200-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,180 kB
  • ctags: 2,986
  • sloc: ansic: 29,035; sh: 7,487; sql: 115; makefile: 96
file content (72 lines) | stat: -rw-r--r-- 2,126 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* File:			tuple.h
 *
 * Description:		See "tuple.c"
 *
 * Important NOTE:	The TupleField structure is used both to hold backend data and
 *					manual result set data.  The "set_" functions and the TupleNode
 *					structure are only used for manual result sets by info routines.
 *
 * Comments:		See "notice.txt" for copyright and license information.
 *
 */

#ifndef __TUPLE_H__
#define __TUPLE_H__

#include "psqlodbc.h"

/*	Used by backend data AND manual result sets */
struct TupleField_
{
	Int4		len;			/* length of the current Tuple */
	void	   *value;			/* an array representing the value */
};

/*	Used ONLY for manual result sets */
struct TupleNode_
{
	struct TupleNode_ *prev,
			   *next;
	TupleField	tuple[1];
};

/*	keyset(TID + OID) info */
struct KeySet_
{
	UWORD	status;
	UWORD	offset;
	UDWORD	blocknum;
	UDWORD	oid;
};
/*	Rollback(index + original TID) info */
struct Rollback_
{
	UDWORD	index;
	UDWORD	blocknum;
	UWORD	offset;
};
#define	KEYSET_INFO_PUBLIC	0x07
#define	CURS_SELF_ADDING	(1L << 3)
#define	CURS_SELF_DELETING	(1L << 4)
#define	CURS_SELF_UPDATING	(1L << 5)
#define	CURS_SELF_ADDED		(1L << 6)
#define	CURS_SELF_DELETED	(1L << 7)
#define	CURS_SELF_UPDATED	(1L << 8)
#define	CURS_NEEDS_REREAD	(1L << 9)
#define	CURS_IN_ROWSET		(1L << 10)
#define	CURS_OTHER_DELETED	(1L << 11)

/*	These macros are wrappers for the corresponding set_tuplefield functions
	but these handle automatic NULL determination and call set_tuplefield_null()
	if appropriate for the datatype (used by SQLGetTypeInfo).
*/
#define set_nullfield_string(FLD, VAL)		((VAL) ? set_tuplefield_string(FLD, (VAL)) : set_tuplefield_null(FLD))
#define set_nullfield_int2(FLD, VAL)		((VAL) != -1 ? set_tuplefield_int2(FLD, (VAL)) : set_tuplefield_null(FLD))
#define set_nullfield_int4(FLD, VAL)		((VAL) != -1 ? set_tuplefield_int4(FLD, (VAL)) : set_tuplefield_null(FLD))

void		set_tuplefield_null(TupleField *tuple_field);
void		set_tuplefield_string(TupleField *tuple_field, const char *string);
void		set_tuplefield_int2(TupleField *tuple_field, Int2 value);
void		set_tuplefield_int4(TupleField *tuple_field, Int4 value);

#endif