~ubuntu-branches/ubuntu/oneiric/postgresql-pljava/oneiric

« back to all changes in this revision

Viewing changes to src/C/include/pljava/type/Type_priv.h

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2006-06-26 10:44:55 UTC
  • mfrom: (1.1.1 upstream) (3.1.1 edgy)
  • Revision ID: james.westby@ubuntu.com-20060626104455-135i9wosat2k8vvt
Tags: 1.3.0-1
* New upstream release (closes: #375199)
* Built for postgresql 8.1 (closes: #339641)
* Rebuilt for new libgcj library (closes: #369986)
* Updated copyright file
* Updated standards version
* Made use of cdbs simple patchsys

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2004, 2005 TADA AB - Taby Sweden
 
2
 * Copyright (c) 2004, 2005, 2006 TADA AB - Taby Sweden
3
3
 * Distributed under the terms shown in the file COPYRIGHT
4
4
 * found in the root folder of this project or at
5
5
 * http://eng.tada.se/osprojects/COPYRIGHT.html
10
10
#define __pljava_type_Type_priv_h
11
11
 
12
12
#include "pljava/PgObject_priv.h"
 
13
#include "pljava/HashMap.h"
13
14
#include "pljava/type/Type.h"
14
15
 
15
16
#ifdef __cplusplus
29
30
         * Contains the JNI compliant signature for the type.
30
31
         */
31
32
        const char* JNISignature;
32
 
        
 
33
 
33
34
        /*
34
35
         * Contains the Java type name.
35
36
         */
36
37
        const char* javaTypeName;
37
38
 
38
39
        /*
39
 
         * Points to the object type that corresponds to this type
40
 
         * if this type is a primitive. For non primitives, this attribute
41
 
         * will be NULL.
42
 
         */
43
 
        Type objectType;
 
40
         * The Java class that represents this type. Will be NULL for
 
41
         * primitive types.
 
42
         */
 
43
        jclass javaClass;
 
44
 
 
45
        /*
 
46
         * Set to true if this type represents a dynamic type (anyelement or
 
47
         * collection/iterator of anyelement)
 
48
         */
 
49
        bool dynamic;
 
50
 
 
51
        /*
 
52
         * Set to true if the invocation will create an out parameter (ResultSet typically)
 
53
         * to collect the return value. If so, the real return value will be a bool.
 
54
         */
 
55
        bool outParameter;
 
56
 
 
57
        /*
 
58
         * Creates the array type for this type.
 
59
         */
 
60
        Type (*createArrayType)(Type self, Oid arrayType);
 
61
 
 
62
        /*
 
63
         * Returns the real type for a dynamic type. A non dynamic type will
 
64
         * return itself.
 
65
         */
 
66
        Type (*getRealType)(Type self, Oid realTypeID, jobject typeMap);
44
67
 
45
68
        /*
46
69
         * Returns true if this type uses the same postgres type the other type.
57
80
         * Translate a given Datum into a jvalue accorging to the type represented
58
81
         * by this instance.
59
82
         */
60
 
        jvalue (*coerceDatum)(Type self, JNIEnv* env, Datum datum);
 
83
        DatumCoercer coerceDatum;
61
84
 
62
85
        /*
63
86
         * Translate a given Object into a Datum accorging to the type represented
64
87
         * by this instance.
65
88
         */
66
 
        Datum (*coerceObject)(Type self, JNIEnv* env, jobject object);
 
89
        ObjectCoercer coerceObject;
67
90
 
68
91
        /*
69
92
         * Calls a java method using one of the Call<type>MethodA routines where
75
98
         * the wasNull parameter is set to false by the caller prior to the
76
99
         * call.
77
100
         */
78
 
        Datum (*invoke)(Type self, JNIEnv* env, jclass clazz, jmethodID method, jvalue* args, PG_FUNCTION_ARGS);
 
101
        Datum (*invoke)(Type self, jclass clazz, jmethodID method, jvalue* args, PG_FUNCTION_ARGS);
 
102
 
 
103
        jobject (*getSRFProducer)(Type self, jclass clazz, jmethodID method, jvalue* args);
 
104
        jobject (*getSRFCollector)(Type self, PG_FUNCTION_ARGS);
 
105
        bool (*hasNextSRF)(Type self, jobject producer, jobject collector, jint counter);
 
106
        Datum (*nextSRF)(Type self, jobject producer, jobject collector);
 
107
        void (*closeSRF)(Type self, jobject producer);
 
108
        const char* (*getJNISignature)(Type self);
 
109
        const char* (*getJNIReturnSignature)(Type self, bool forMultiCall, bool useAltRepr);
79
110
 
80
111
        /*
81
112
         * Returns the TupleDesc that corresponds to this type.
85
116
 
86
117
struct Type_
87
118
{
88
 
        TypeClass m_class;
89
 
        
90
 
        Oid m_oid;
 
119
        TypeClass typeClass;
 
120
 
 
121
        /*
 
122
         * The Oid that identifies this type.
 
123
         */
 
124
        Oid       typeId;
 
125
 
 
126
        /*
 
127
         * Points to the array type where this type is the element type.
 
128
         * If the type has no corresponding array type, this type will be NULL.
 
129
         */
 
130
        Type  arrayType;
 
131
 
 
132
        /*
 
133
         * If the type is an array type, this is the element type.
 
134
         */
 
135
        Type  elementType;
 
136
 
 
137
        /*
 
138
         * Points to the object type that corresponds to this type
 
139
         * if this type is a primitive. For non primitives, this attribute
 
140
         * will be NULL.
 
141
         */
 
142
        Type  objectType;
 
143
 
 
144
        /*
 
145
         * Oid keyed hash map of coercion routines that can front this type when doing
 
146
         * parameter input coercion.
 
147
         */
 
148
        HashMap inCoercions;
 
149
 
 
150
        /*
 
151
         * Oid keyed hash map of coercion routines that can front this type when doing
 
152
         * coercion of output results.
 
153
         */
 
154
        HashMap outCoercions;
 
155
 
 
156
        int16 length;
 
157
        bool  byValue;
 
158
        char  align;
91
159
};
92
160
 
93
161
/*
100
168
 * Default version of invoke. Will make a JNI CallObjectMethod call and then
101
169
 * a call to self->coerceObject to create the Datum.
102
170
 */
103
 
extern Datum _Type_invoke(Type self, JNIEnv* env, jclass cls, jmethodID method, jvalue* args, PG_FUNCTION_ARGS);
 
171
extern Datum _Type_invoke(Type self, jclass cls, jmethodID method, jvalue* args, PG_FUNCTION_ARGS);
104
172
 
105
173
/*
106
174
 * Return the m_oid member of the Type. This is the default version of
107
175
 * Type_getTupleDesc.
108
176
 */
109
 
TupleDesc _Type_getTupleDesc(Type self, PG_FUNCTION_ARGS);
 
177
extern TupleDesc _Type_getTupleDesc(Type self, PG_FUNCTION_ARGS);
 
178
 
 
179
/*
 
180
 * Store a Type keyed by its Oid in the cache.
 
181
 */
 
182
extern void Type_cacheByOid(Oid typeId, Type type);
110
183
 
111
184
/*
112
185
 * Create a TypeClass with default sizes for TypeClass and Type.
122
195
 * Types are always allocated in global context.
123
196
 */
124
197
extern Type TypeClass_allocInstance(TypeClass cls, Oid typeId);
 
198
extern Type TypeClass_allocInstance2(TypeClass cls, Oid typeId, Form_pg_type pgType);
125
199
 
126
200
#ifdef __cplusplus
127
201
}