Skip to content

Commit

Permalink
int64
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Dec 13, 2023
1 parent 7712e34 commit 237231a
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions ogr_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot* slot, const OgrFdwExecS
char fidstr[256];
snprintf(fidstr, 256, OGR_FDW_FRMT_INT64, OGR_FDW_CAST_INT64(fid));

values[i] = pgDatumFromCString(fidstr, &col, PG_SQL_ASCII, &is_null);
values[i] = pgDatumFromCString(fidstr, &col, execstate->ogr.char_encoding, &is_null);
nulls[i] = is_null;
}
}
Expand Down Expand Up @@ -1966,9 +1966,29 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot* slot, const OgrFdwExecS
break;

}

#if GDAL_VERSION_MAJOR >= 2
case OFTInteger64List:
{
int ilist_size;
const int64 *ilist = (int64*)OGR_F_GetFieldAsInteger64List(feat, ogrfldnum, &ilist_size);
ArrayBuildState *abs = initArrayResult(col.pgelmtype, CurrentMemoryContext, false);
for (uint32 i = 0; i < ilist_size; i++)
{
bool is_null = false;
snprintf(cstr, CSTR_SZ, "%ld", ilist[i]);
abs = accumArrayResult(abs,
pgDatumFromCString(cstr, &col, execstate->ogr.char_encoding, &is_null),
is_null,
col.pgelmtype,
CurrentMemoryContext);
}
values[i] = makeArrayResult(abs, CurrentMemoryContext);
nulls[i] = false;
break;
}
#endif

case OFTIntegerList:
{
int ilist_size;
Expand All @@ -1979,7 +1999,7 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot* slot, const OgrFdwExecS
bool is_null = false;
snprintf(cstr, CSTR_SZ, "%d", ilist[i]);
abs = accumArrayResult(abs,
pgDatumFromCString(cstr, &col, PG_SQL_ASCII, &is_null),
pgDatumFromCString(cstr, &col, execstate->ogr.char_encoding, &is_null),
is_null,
col.pgelmtype,
CurrentMemoryContext);
Expand All @@ -1999,7 +2019,7 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot* slot, const OgrFdwExecS
bool is_null = false;
snprintf(cstr, CSTR_SZ, "%g", rlist[i]);
abs = accumArrayResult(abs,
pgDatumFromCString(cstr, &col, PG_SQL_ASCII, &is_null),
pgDatumFromCString(cstr, &col, execstate->ogr.char_encoding, &is_null),
is_null,
col.pgelmtype,
CurrentMemoryContext);
Expand All @@ -2017,7 +2037,7 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot* slot, const OgrFdwExecS
{
bool is_null = false;
abs = accumArrayResult(abs,
pgDatumFromCString(*cstrs, &col, PG_SQL_ASCII, &is_null),
pgDatumFromCString(*cstrs, &col, execstate->ogr.char_encoding, &is_null),
is_null,
col.pgelmtype,
CurrentMemoryContext);
Expand Down

0 comments on commit 237231a

Please sign in to comment.