Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:20:16+00:00 2026-05-25T15:20:16+00:00

I have a fairly simple call I’m trying to make to a database. I

  • 0

I have a fairly simple call I’m trying to make to a database. I have everything surrounded in try/catch and if statements, but… nothing. I know I’m making the connection (the connection refcount in MySQL increments each time I try running the script), but it never seems to return. Code is:

 if (!conn.connect(db, server, username, pass))
 { /* Log error to a file */}
 try
 {
     mysqlpp::Query query = conn.query();
     query << "CALL db.test('1', '2')";
     std::cout << "About to call query" << std::endl;
     if (mysqlpp::StoreQueryResult res = query.store())
     {
        std::string toReturn = "";
        res[0][0].to_string(toReturn);
        std::cout << "Query called.  Result: " << toReturn << std::endl;
     }
 }
 catch(Exception e)
 { /*Output caught exception*/ }

and I get:

    About to call query

as my sole output.
I have more debugging in there (query is being put together correctly, connection is correct, etc).
Anyone have any idea what might be happening, or what I should check next?

Thanks!

— Edit: If I run the call straight from MySQL, everything works as expected, so that’s not causing the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:20:16+00:00Added an answer on May 25, 2026 at 3:20 pm

    You should call the query inside conn.query(); Like

    std::cout << "About to call query" << std::endl;
    mysqlpp::Query query = conn.query("CALL db.test('1', '2')");
    if (mysqlpp::StoreQueryResult res = query.store())
    {
       std::string toReturn = "";      //this is not necessary
       res[0][0].to_string(toReturn);  //this is not necessary
    
       for (size_t i = 0; i < res.num_rows(); ++i) 
       {
            std::cout << "Query called.  Result: " << res[i][0] << std::endl;
       }
    }
    

    you can refer http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html for examples

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a fairly simple call using PICC18. Using the MPLAB
I have a fairly simple ajax call built on jQuery. It works perfectly in
I am trying to do something I think should be fairly simple, but I
I have been trying to create a fairly simple application in WPF following the
I have what I think should be a fairly simple implementation, but I'm running
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and
I have a fairly simple const struct in some C code that simply holds
I have a fairly simple addition to the HTTP standard. An ambitious goal I
I have a fairly simple sync problem. I have a table with about 10
I have a fairly simple block of code. Sub Run(Name) on error resume next

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.