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

  • SEARCH
  • Home
  • 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 8215197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:42:14+00:00 2026-06-07T11:42:14+00:00

When i figured out how to compile a simple program, now I have other

  • 0

When i figured out how to compile a simple program, now I have other problem … I installed PostgreSQL and created database and table:

1) createdb testDB 2) create table cities (city varchar(80), location
varchar(80));

And my still very simple program :

#include <iostream>
#include <soci.h>
#include <postgresql/soci-postgresql.h>
#include <string>
using namespace std;

int main(int argc, char **argv)
{
   try
   { 
      soci::session sql(soci::postgresql, "dbname=testDB");

    string row = "";
    sql << "select * from cities;", soci::into(row);

    sql << "insert into cities values('London', 'UK')";

    sql << "select * from cities;", soci::into(row);
    cout << row << "\n"; 
   }
   catch (soci::postgresql_soci_error const & e)
   {
      std::cerr << "PostgreSQL error: " << e.sqlstate() << " " << e.what() << std::endl;
   }
   catch (std::exception const & e)
   {
      std::cerr << "Some other error: " << e.what() << std::endl;
   }
   return 0;

}

This code shows me only rows I already have in my testDB and doesn’t show a row that I’ve just inserted. For example: in my testDB, in table cities, I have:

Warsaw Poland
Berlin Germany
Paris France

and above code shows me:

Warsaw Poland

but doesn’t show:

Berlin Germany
Paris France
London UK

Please, help:(

  • 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-06-07T11:42:16+00:00Added an answer on June 7, 2026 at 11:42 am

    So, adding commit after sql << "insert into cities values ('London', 'UK')";
    solve this problem.

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

Sidebar

Related Questions

I have a made a simple program that reproduces the problem: #include <boost/archive/text_oarchive.hpp> #include
I'm sure this is simple, but I haven't figured it out yet... I've installed
Challenge: I have this code that fails to compile. Can you figure out what's
I figured out that of course . and SPACE aren't allowed. Are there other
I'm trying to cross=compile a simple program with inline assembly for a variety of
I have a simple requirement: The number of columns of my <tr:table/> is dynamic.
Edit (updated question) I have a simple C program: // it is not important
I can figure out why this simple code would not compile. May be fresh
I have just started to learn about Java. I have figured out how to
I have a program, say src/sample.hs , and I want it to compile (using

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.