Adding support for Postgres Point as well as PostGIS Geometry/Geography Points

This commit is contained in:
Xavier Stevens
2015-01-20 15:09:29 -08:00
parent 5d4368bbca
commit b211211fdf
5 changed files with 257 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: proto/pg_logicaldec.proto */
/* Generated from: pg_logicaldec.proto */
/* Do not generate deprecated warnings for self */
#ifndef PROTOBUF_C__NO_DEPRECATED
@@ -7,6 +7,49 @@
#endif
#include "pg_logicaldec.pb-c.h"
void decoderbufs__point__init
(Decoderbufs__Point *message)
{
static Decoderbufs__Point init_value = DECODERBUFS__POINT__INIT;
*message = init_value;
}
size_t decoderbufs__point__get_packed_size
(const Decoderbufs__Point *message)
{
assert(message->base.descriptor == &decoderbufs__point__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t decoderbufs__point__pack
(const Decoderbufs__Point *message,
uint8_t *out)
{
assert(message->base.descriptor == &decoderbufs__point__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t decoderbufs__point__pack_to_buffer
(const Decoderbufs__Point *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &decoderbufs__point__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
Decoderbufs__Point *
decoderbufs__point__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (Decoderbufs__Point *)
protobuf_c_message_unpack (&decoderbufs__point__descriptor,
allocator, len, data);
}
void decoderbufs__point__free_unpacked
(Decoderbufs__Point *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &decoderbufs__point__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void decoderbufs__datum_message__init
(Decoderbufs__DatumMessage *message)
{
@@ -93,7 +136,58 @@ void decoderbufs__row_message__free_unpacked
assert(message->base.descriptor == &decoderbufs__row_message__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descriptors[9] =
static const ProtobufCFieldDescriptor decoderbufs__point__field_descriptors[2] =
{
{
"x",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_DOUBLE,
0, /* quantifier_offset */
offsetof(Decoderbufs__Point, x),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"y",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_DOUBLE,
0, /* quantifier_offset */
offsetof(Decoderbufs__Point, y),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned decoderbufs__point__field_indices_by_name[] = {
0, /* field[0] = x */
1, /* field[1] = y */
};
static const ProtobufCIntRange decoderbufs__point__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor decoderbufs__point__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"decoderbufs.Point",
"Point",
"Decoderbufs__Point",
"decoderbufs",
sizeof(Decoderbufs__Point),
2,
decoderbufs__point__field_descriptors,
decoderbufs__point__field_indices_by_name,
1, decoderbufs__point__number_ranges,
(ProtobufCMessageInit) decoderbufs__point__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descriptors[10] =
{
{
"column_name",
@@ -203,6 +297,18 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"datum_point",
10,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(Decoderbufs__DatumMessage, datum_point),
&decoderbufs__point__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned decoderbufs__datum_message__field_indices_by_name[] = {
0, /* field[0] = column_name */
@@ -213,12 +319,13 @@ static const unsigned decoderbufs__datum_message__field_indices_by_name[] = {
4, /* field[4] = datum_float */
2, /* field[2] = datum_int32 */
3, /* field[3] = datum_int64 */
9, /* field[9] = datum_point */
7, /* field[7] = datum_string */
};
static const ProtobufCIntRange decoderbufs__datum_message__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 9 }
{ 0, 10 }
};
const ProtobufCMessageDescriptor decoderbufs__datum_message__descriptor =
{
@@ -228,7 +335,7 @@ const ProtobufCMessageDescriptor decoderbufs__datum_message__descriptor =
"Decoderbufs__DatumMessage",
"decoderbufs",
sizeof(Decoderbufs__DatumMessage),
9,
10,
decoderbufs__datum_message__field_descriptors,
decoderbufs__datum_message__field_indices_by_name,
1, decoderbufs__datum_message__number_ranges,

View File

@@ -1,8 +1,8 @@
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: proto/pg_logicaldec.proto */
/* Generated from: pg_logicaldec.proto */
#ifndef PROTOBUF_C_proto_2fpg_5flogicaldec_2eproto__INCLUDED
#define PROTOBUF_C_proto_2fpg_5flogicaldec_2eproto__INCLUDED
#ifndef PROTOBUF_C_pg_5flogicaldec_2eproto__INCLUDED
#define PROTOBUF_C_pg_5flogicaldec_2eproto__INCLUDED
#include <protobuf-c/protobuf-c.h>
@@ -10,11 +10,12 @@ PROTOBUF_C__BEGIN_DECLS
#if PROTOBUF_C_VERSION_NUMBER < 1000000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
#elif 1000001 < PROTOBUF_C_MIN_COMPILER_VERSION
#elif 1000002 < PROTOBUF_C_MIN_COMPILER_VERSION
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif
typedef struct _Decoderbufs__Point Decoderbufs__Point;
typedef struct _Decoderbufs__DatumMessage Decoderbufs__DatumMessage;
typedef struct _Decoderbufs__RowMessage Decoderbufs__RowMessage;
@@ -30,6 +31,17 @@ typedef enum _Decoderbufs__Op {
/* --- messages --- */
struct _Decoderbufs__Point
{
ProtobufCMessage base;
double x;
double y;
};
#define DECODERBUFS__POINT__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&decoderbufs__point__descriptor) \
, 0, 0 }
struct _Decoderbufs__DatumMessage
{
ProtobufCMessage base;
@@ -49,10 +61,11 @@ struct _Decoderbufs__DatumMessage
char *datum_string;
protobuf_c_boolean has_datum_bytes;
ProtobufCBinaryData datum_bytes;
Decoderbufs__Point *datum_point;
};
#define DECODERBUFS__DATUM_MESSAGE__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&decoderbufs__datum_message__descriptor) \
, NULL, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, NULL, 0,{0,NULL} }
, NULL, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, NULL, 0,{0,NULL}, NULL }
struct _Decoderbufs__RowMessage
@@ -73,6 +86,25 @@ struct _Decoderbufs__RowMessage
, 0,0, NULL, 0,0, 0,NULL, 0,NULL }
/* Decoderbufs__Point methods */
void decoderbufs__point__init
(Decoderbufs__Point *message);
size_t decoderbufs__point__get_packed_size
(const Decoderbufs__Point *message);
size_t decoderbufs__point__pack
(const Decoderbufs__Point *message,
uint8_t *out);
size_t decoderbufs__point__pack_to_buffer
(const Decoderbufs__Point *message,
ProtobufCBuffer *buffer);
Decoderbufs__Point *
decoderbufs__point__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void decoderbufs__point__free_unpacked
(Decoderbufs__Point *message,
ProtobufCAllocator *allocator);
/* Decoderbufs__DatumMessage methods */
void decoderbufs__datum_message__init
(Decoderbufs__DatumMessage *message);
@@ -113,6 +145,9 @@ void decoderbufs__row_message__free_unpacked
ProtobufCAllocator *allocator);
/* --- per-message closures --- */
typedef void (*Decoderbufs__Point_Closure)
(const Decoderbufs__Point *message,
void *closure_data);
typedef void (*Decoderbufs__DatumMessage_Closure)
(const Decoderbufs__DatumMessage *message,
void *closure_data);
@@ -126,10 +161,11 @@ typedef void (*Decoderbufs__RowMessage_Closure)
/* --- descriptors --- */
extern const ProtobufCEnumDescriptor decoderbufs__op__descriptor;
extern const ProtobufCMessageDescriptor decoderbufs__point__descriptor;
extern const ProtobufCMessageDescriptor decoderbufs__datum_message__descriptor;
extern const ProtobufCMessageDescriptor decoderbufs__row_message__descriptor;
PROTOBUF_C__END_DECLS
#endif /* PROTOBUF_C_proto_2fpg_5flogicaldec_2eproto__INCLUDED */
#endif /* PROTOBUF_C_pg_5flogicaldec_2eproto__INCLUDED */