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

« back to all changes in this revision

Viewing changes to src/C/pljava/type/Void.c

  • 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
15
15
/*
16
16
 * void primitive type.
17
17
 */
18
 
static TypeClass s_voidClass;
19
 
static Type s_void;
20
 
 
21
 
static Datum _void_invoke(Type self, JNIEnv* env, jclass cls, jmethodID method, jvalue* args, PG_FUNCTION_ARGS)
 
18
static Datum _void_invoke(Type self, jclass cls, jmethodID method, jvalue* args, PG_FUNCTION_ARGS)
22
19
{
23
 
        bool saveicj = isCallingJava;
24
 
        isCallingJava = true;
25
 
        (*env)->CallStaticVoidMethodA(env, cls, method, args);
26
 
        isCallingJava = saveicj;
 
20
        JNI_callStaticVoidMethodA(cls, method, args);
27
21
        fcinfo->isnull = true;
28
22
        return 0;
29
23
}
30
24
 
31
 
static jvalue _void_coerceDatum(Type self, JNIEnv* env, Datum nothing)
 
25
static jvalue _void_coerceDatum(Type self, Datum nothing)
32
26
{
33
27
        jvalue result;
34
28
        result.j = 0L;
35
29
        return result;
36
30
}
37
31
 
38
 
static Datum _void_coerceObject(Type self, JNIEnv* env, jobject nothing)
 
32
static Datum _void_coerceObject(Type self, jobject nothing)
39
33
{
40
34
        return 0;
41
35
}
42
36
 
43
 
static Type void_obtain(Oid typeId)
44
 
{
45
 
        return s_void;
46
 
}
47
 
 
48
37
/* Make this datatype available to the postgres system.
49
38
 */
50
 
extern Datum Void_initialize(PG_FUNCTION_ARGS);
51
 
PG_FUNCTION_INFO_V1(Void_initialize);
52
 
Datum Void_initialize(PG_FUNCTION_ARGS)
 
39
extern void Void_initialize(void);
 
40
void Void_initialize(void)
53
41
{
54
 
        s_voidClass = TypeClass_alloc("type.void");
55
 
        s_voidClass->JNISignature = "V";
56
 
        s_voidClass->javaTypeName = "void";
57
 
        s_voidClass->invoke       = _void_invoke;
58
 
        s_voidClass->coerceDatum  = _void_coerceDatum;
59
 
        s_voidClass->coerceObject = _void_coerceObject;
60
 
        s_void = TypeClass_allocInstance(s_voidClass, VOIDOID);
61
 
 
62
 
        Type_registerPgType(VOIDOID, void_obtain);
63
 
        Type_registerJavaType("void", void_obtain);
64
 
        PG_RETURN_VOID();
 
42
        TypeClass cls = TypeClass_alloc("type.void");
 
43
        cls->JNISignature = "V";
 
44
        cls->javaTypeName = "void";
 
45
        cls->invoke       = _void_invoke;
 
46
        cls->coerceDatum  = _void_coerceDatum;
 
47
        cls->coerceObject = _void_coerceObject;
 
48
        Type_registerType("void", TypeClass_allocInstance(cls, VOIDOID));
65
49
}