-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathSQLInputFromTuple.c
More file actions
50 lines (45 loc) · 1.52 KB
/
SQLInputFromTuple.c
File metadata and controls
50 lines (45 loc) · 1.52 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
/*
* Copyright (c) 2004-2025 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)
{
jlong heapTup = PointerGetJLong(hth);
jlong lifespan = PointerGetJLong(currentInvocation);
jobject result;
jobject jtd = pljava_SingleRowReader_getTupleDesc(hth);
result =
JNI_newObjectLocked(s_SQLInputFromTuple_class, s_SQLInputFromTuple_init,
pljava_DualState_key(), lifespan, heapTup, 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);
}