Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Problem while using MySQL connector API (no replies)

$
0
0
Dear Team,

Currently, I am integrating MySQL database with C++ based application as a document storage.

I have created a data in MySQL database using MySQL API for create document.

While retrieving the data from MySQL database, it is returning DbDoc object for accessing json data.

When i am trying to cast or convert that object to some other type like for rapidjson object or Json object,
for example: DbDoc to string
error: conversion from ‘mysqlx::abi2::r0::DbDoc’ to non-scalar type ‘std::string {aka std::basic_string<char>}’ requested

I tried to access the field of json data using DbDoc object, it is returning an empty data with cout for printing on console.
like:
DbDoc doc=coll.find("_id.id = :id").bind("id", id).execute().fetchOne();
cout<<doc["_id"]

output:
<document>

Could you please provide your suggestion or guidance on the same. It will help me a lot.

Viewing all articles
Browse latest Browse all 527

Trending Articles