File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -194,10 +194,10 @@ def pg_quote(s)
194
194
end
195
195
196
196
with_proto ( 'scalars { float_field: 123.456 }' ) do
197
- test_query ( 'pgpb.test.ExampleMessage:scalars.float_field' , [ '123.456001 ' ] )
197
+ test_query ( 'pgpb.test.ExampleMessage:scalars.float_field' , [ '123.456 ' ] )
198
198
end
199
199
with_proto ( 'scalars { double_field: 123.456 }' ) do
200
- test_query ( 'pgpb.test.ExampleMessage:scalars.double_field' , [ '123.456000 ' ] )
200
+ test_query ( 'pgpb.test.ExampleMessage:scalars.double_field' , [ '123.456 ' ] )
201
201
end
202
202
203
203
with_proto ( 'scalars { bool_field: true }' ) do
Original file line number Diff line number Diff line change 27
27
extern " C" {
28
28
// Must be included before other Postgres headers
29
29
#include < postgres.h>
30
+ #include < common/shortest_dec.h>
30
31
}
31
32
32
33
namespace pb = ::google::protobuf;
@@ -463,10 +464,16 @@ class PrimitiveEmitter : public Emitter {
463
464
field.wire_type , ty_);
464
465
switch (ty_) {
465
466
case T::TYPE_DOUBLE:
466
- Emit (WFL::DecodeDouble (field.value .as_uint64 ));
467
+ {
468
+ char *cstr = double_to_shortest_decimal (WFL::DecodeDouble (field.value .as_uint64 ));
469
+ EmitStr (std::move (std::string (cstr)));
470
+ }
467
471
break ;
468
472
case T::TYPE_FLOAT:
469
- Emit (WFL::DecodeFloat (field.value .as_uint32 ));
473
+ {
474
+ char *cstr = float_to_shortest_decimal (WFL::DecodeFloat (field.value .as_uint32 ));
475
+ EmitStr (std::move (std::string (cstr)));
476
+ }
470
477
break ;
471
478
case T::TYPE_INT64:
472
479
case T::TYPE_SFIXED64:
You can’t perform that action at this time.
0 commit comments