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 6173897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:39:17+00:00 2026-05-23T23:39:17+00:00

So I try simple sqlite3pp modified a bit code : #include <iostream> #include <sqlite3pp.h>

  • 0

So I try simple sqlite3pp modified a bit code:

#include <iostream>
#include <sqlite3pp.h>

using namespace std;

int main(int argc, char* argv[])
{
    try {
        sqlite3pp::database db("test.db");

        {
            db.execute("CREATE TABLE IF NOT EXISTS users ( email varchar(65) primary key, pass varchar(65))");
            db.execute("INSERT INTO users (email, pass) VALUES ('AAAA', '1234')");
        }

        {
            sqlite3pp::transaction xct(db);

            sqlite3pp::command cmd(db, "INSERT INTO users (email, pass) VALUES (?, ?)");

            cout << cmd.bind(1, "BBBB") << endl;
            cout << cmd.bind(2, "1234") << endl;
            cout << cmd.execute() << endl;

            cout << cmd.reset() << endl;

            cmd.binder() << "CCCC" << "1234";

            cout << cmd.execute() << endl;

            xct.commit();
        }

        {
            sqlite3pp::transaction xct(db, true);

            sqlite3pp::command cmd(db, "INSERT INTO users (email, pass) VALUES (:name, :name)");

            cout << cmd.bind(":name", "DDDD") << endl;

            cout << cmd.execute() << endl;
        }
    }
    catch (exception& ex) {
        cout << ex.what() << endl;
    }
    cin.get();

}

First time it gives such output:

0
0
0
0
0
0
0

And on second time and forward when I execute it:

0
0
1
19
1
column email is not unique

Why it does not throw any error sooner than 5th (SQL error codes)?

  • 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-23T23:39:19+00:00Added an answer on May 23, 2026 at 11:39 pm

    Having had a quick look in the implementation of sqlite3pp, it seems stuff tends to just return error codes, and expects you to check them; it looked like it could be the destructor for the transaction that is throwing an exception, which is why you see your error message at the point that you do.

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

Sidebar

Related Questions

I try to load image with processing.js using CoffeeScript and write this simple code:
Whenever I try to copy an entire working copy using simple drag and drop
I am using the simple modal and Ajax . When I try to read
I am serializing a class using simple-xml ( http://simple.sourceforge.net/ ) but when i try
I'm learning F#, and decided to try making simple XNA games for windows using
in this code i'm try to draw simple olympic ring and rotate it... the
I try to write a simple client/server application (all application is a bluetooth service
I try to write a simple Markdown parser in JavaScript. Therefore I want to
I try to build a gui (Swing) for a simple java application. The application
Every time I try to do something seemingly-simple in CSS, it doesn't work. I

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.