forked from tada/pljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLInputFromTuple.c
More file actions
56 lines (49 loc) · 1.57 KB
/
Copy pathSQLInputFromTuple.c
File metadata and controls
56 lines (49 loc) · 1.57 KB
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
/*
* Copyright (c) 2004-2019 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
* which accompanies this distribution, and is available at
* http://opensource.org/licenses/BSD-3-Clause
*
* Contributors:
* Tada AB
* Chapman Flack
*
* @author Thomas Hallgren
*/
#include <postgres.h>
#include "pljava/type/SingleRowReader.h"
#include "pljava/type/TupleDesc.h"
#include "pljava/DualState.h"
#include "pljava/Invocation.h"
#include "pljava/SQLInputFromTuple.h"
static jclass s_SQLInputFromTuple_class;
static jmethodID s_SQLInputFromTuple_init;
jobject pljava_SQLInputFromTuple_create(HeapTupleHeader hth)
{
Ptr2Long p2lht;
Ptr2Long p2lro;
jobject result;
jobject jtd = pljava_SingleRowReader_getTupleDesc(hth);
p2lht.longVal = 0L;
p2lro.longVal = 0L;
p2lht.ptrVal = hth;
p2lro.ptrVal = currentInvocation;
result =
JNI_newObjectLocked(s_SQLInputFromTuple_class, s_SQLInputFromTuple_init,
pljava_DualState_key(), p2lro.longVal, p2lht.longVal, jtd);
JNI_deleteLocalRef(jtd);
return result;
}
/* Make this datatype available to the postgres system.
*/
void pljava_SQLInputFromTuple_initialize(void)
{
jclass cls =
PgObject_getJavaClass("org/postgresql/pljava/jdbc/SQLInputFromTuple");
s_SQLInputFromTuple_init = PgObject_getJavaMethod(cls, "<init>",
"(Lorg/postgresql/pljava/internal/DualState$Key;JJLorg/postgresql/pljava/internal/TupleDesc;)V");
s_SQLInputFromTuple_class = JNI_newGlobalRef(cls);
JNI_deleteLocalRef(cls);
}