MySQL Forums
Forum List  »  Connector/C++

Problem while using MySQL connector API
Posted by: Sourabh Chourasiya
Date: October 07, 2019 05:19AM

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.

Options: ReplyQuote


Subject
Views
Written By
Posted
Problem while using MySQL connector API
936
October 07, 2019 05:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.