10
10
#define __COLUMNINFO_H__
12
12
#include "psqlodbc.h"
15
14
struct ColumnInfoClass_
18
char **name; /* list of type names */
19
Oid *adtid; /* list of type ids */
20
Int2 *adtsize; /* list type sizes */
21
Int2 *display_size; /* the display size (longest row) */
22
Int4 *atttypmod; /* the length of bpchar/varchar */
19
char *name; /* field name */
20
OID adtid; /* type oid */
21
Int2 adtsize; /* type size */
22
Int4 display_size; /* the display size (longest row) */
23
Int4 atttypmod; /* the length of bpchar/varchar */
24
OID relid; /* the relation id */
25
Int2 attid; /* the attribute number */
25
29
#define CI_get_num_fields(self) (self->num_fields)
26
#define CI_get_oid(self, col) (self->adtid[col])
27
#define CI_get_fieldname(self, col) (self->name[col])
28
#define CI_get_fieldsize(self, col) (self->adtsize[col])
29
#define CI_get_display_size(self, col) (self->display_size[col])
30
#define CI_get_atttypmod(self, col) (self->atttypmod[col])
30
#define CI_get_oid(self, col) (self->coli_array[col].adtid)
31
#define CI_get_fieldname(self, col) (self->coli_array[col].name)
32
#define CI_get_fieldsize(self, col) (self->coli_array[col].adtsize)
33
#define CI_get_display_size(self, col) (self->coli_array[col].display_size)
34
#define CI_get_atttypmod(self, col) (self->coli_array[col].atttypmod)
35
#define CI_get_relid(self, col) (self->coli_array[col].relid)
36
#define CI_get_attid(self, col) (self->coli_array[col].attid)
32
38
ColumnInfoClass *CI_Constructor(void);
33
39
void CI_Destructor(ColumnInfoClass *self);
34
40
void CI_free_memory(ColumnInfoClass *self);
41
char CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn);
36
43
/* functions for setting up the fields from within the program, */
37
44
/* without reading from a socket */
38
void CI_set_num_fields(ColumnInfoClass *self, int new_num_fields);
45
void CI_set_num_fields(ColumnInfoClass *self, int new_num_fields, BOOL);
39
46
void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
40
Oid new_adtid, Int2 new_adtsize, Int4 atttypmod);
47
OID new_adtid, Int2 new_adtsize, Int4 atttypmod,
48
OID new_relid, OID new_attid);