Skip to content

Commit a672fe0

Browse files
committed
Bug#29847865: Change according to rapidjson transcoder example https://
rapidjson.org/md_doc_encoding.html
1 parent 9fe938a commit a672fe0

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

cdk/include/mysql/cdk/foundation/string.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,16 +287,8 @@ size_t str_decode(
287287
rapidjson::EncodedInputStream<FROM, Mem_stream<char> > input(bytes);
288288
Str_stream<typename TO::Ch> output(out);
289289

290-
/*
291-
Note: EncodedInputStream looks for BOM mark and for that reason
292-
the underlying byte stream is ahead of the current position in the
293-
stream.
294-
*/
295-
296-
for(bool more = true; more;)
290+
while(input.Peek() != '\0')
297291
{
298-
more = bytes.hasData();
299-
300292
if (!Transcoder::Transcode(input, output))
301293
{
302294
// TODO: add some context info from the input stream.

devapi/tests/bugs-t.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,3 +754,21 @@ TEST_F(Bugs, bug29394723)
754754
cout << "_platform: " << _platform << endl;
755755
EXPECT_NE("", _platform);
756756
}
757+
758+
TEST_F(Bugs, bug29847865)
759+
{
760+
SKIP_IF_NO_XPLUGIN
761+
762+
get_sess().sql("DROP TABLE IF EXISTS test.t").execute();
763+
get_sess().sql("CREATE TABLE test.t(a TEXT)").execute();
764+
Table t = get_sess().getSchema("test").getTable("t");
765+
766+
string foo = u"\x00000281\x00000282\x00000283\x00000284\x00000285\x00000286";
767+
768+
t.insert().values(foo).execute();
769+
Row r = t.select().limit(1).execute().fetchOne();
770+
string bar = r.get(0);
771+
772+
EXPECT_EQ(foo.size(), bar.size());
773+
EXPECT_EQ(foo, bar);
774+
}

0 commit comments

Comments
 (0)