Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PostgreSQL v15 #413

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pljava-so/src/main/c/type/String.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ jvalue _String_coerceDatum(Type self, Datum arg)
{
jvalue result;
char* tmp = DatumGetCString(FunctionCall3(
&((String)self)->textOutput,
&((PLJString)self)->textOutput,
arg,
ObjectIdGetDatum(((String)self)->elementType),
ObjectIdGetDatum(((PLJString)self)->elementType),
Int32GetDatum(-1)));
result.l = String_createJavaStringFromNTS(tmp);
pfree(tmp);
Expand All @@ -83,19 +83,19 @@ Datum _String_coerceObject(Type self, jobject jstr)
JNI_deleteLocalRef(jstr);

ret = FunctionCall3(
&((String)self)->textInput,
&((PLJString)self)->textInput,
CStringGetDatum(tmp),
ObjectIdGetDatum(((String)self)->elementType),
ObjectIdGetDatum(((PLJString)self)->elementType),
Int32GetDatum(-1));
pfree(tmp);
return ret;
}

static String String_create(TypeClass cls, Oid typeId)
static PLJString String_create(TypeClass cls, Oid typeId)
{
HeapTuple typeTup = PgObject_getValidTuple(TYPEOID, typeId, "type");
Form_pg_type pgType = (Form_pg_type)GETSTRUCT(typeTup);
String self = (String)TypeClass_allocInstance(cls, typeId);
PLJString self = (PLJString)TypeClass_allocInstance(cls, typeId);
MemoryContext ctx = GetMemoryChunkContext(self);
fmgr_info_cxt(pgType->typoutput, &self->textOutput, ctx);
fmgr_info_cxt(pgType->typinput, &self->textInput, ctx);
Expand All @@ -109,7 +109,7 @@ Type String_obtain(Oid typeId)
return (Type)StringClass_obtain(s_StringClass, typeId);
}

String StringClass_obtain(TypeClass self, Oid typeId)
PLJString StringClass_obtain(TypeClass self, Oid typeId)
{
return String_create(self, typeId);
}
Expand All @@ -126,7 +126,7 @@ jstring String_createJavaString(text* t)
Size srcLen = VARSIZE(t) - VARHDRSZ;
if(srcLen == 0)
return s_the_empty_string;

if ( s_two_step_conversion )
{
utf8 = (char*)pg_do_encoding_conversion((unsigned char*)src,
Expand Down
8 changes: 4 additions & 4 deletions pljava-so/src/main/include/pljava/type/String.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ extern "C" {
* The String class extends the Type and adds the members necessary to
* perform standard Postgres textin/textout conversion. An instance of this
* class will be used for all types that are not explicitly mapped.
*
*
* The class also has some convenience routings for Java String manipulation.
*
*
* @author Thomas Hallgren
*
**************************************************************************/

extern jclass s_Object_class;
extern jclass s_String_class;
struct String_;
typedef struct String_* String;
typedef struct String_* PLJString;

/*
* Create a Java String object from a null terminated string. Conversion is
Expand Down Expand Up @@ -73,7 +73,7 @@ extern text* String_createText(jstring javaString);

extern Type String_obtain(Oid typeId);

extern String StringClass_obtain(TypeClass self, Oid typeId);
extern PLJString StringClass_obtain(TypeClass self, Oid typeId);

#ifdef __cplusplus
}
Expand Down