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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:14:58+00:00 2026-05-15T07:14:58+00:00

I seem to misunderstand a basic syntax, why this sample works: sqlite3_prepare_v2(db, insert into

  • 0

I seem to misunderstand a basic syntax, why this sample works:

sqlite3_prepare_v2(db, "insert into test values('boo','boo',0);", strlen(querystring)+1 , &stmt, NULL);

if ((rc = sqlite3_step(stmt)) != SQLITE_DONE)
  fprintf(stderr, "Error: sqlite3_step() %d. Error Message %s;\n",rc,sqlite3_errmsg(db));

But when I try this query:
“insert into test(strtest) values(‘boo’);”

I get an error:
Error: sqlite3_step() 19. Error Message constraint failed;

What am I missing?

table test is: “create table test (blobtest BLOB(4) NOT NULL, strtest VARCHAR NOT NULL, inttest INTEGER NOT NULL );”

Thanks,
Doori Bar

  • 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-15T07:14:59+00:00Added an answer on May 15, 2026 at 7:14 am

    All three columns are declared as NOT NULL, and they do not have a default value.

    So your query:

    insert into test(strtest) values('boo');
    

    Is only assigning blobtest a value, leaving out strtest and inttest which cannot be null.

    You can fix this by either adding two more values, or you can change the table schema to default to something, e.g.:

    create table test (
        blobtest BLOB(4) NOT NULL,
        strtest VARCHAR NOT NULL DEFAULT '',
        inttest INTEGER NOT NULL DEFAULT 0
    );
    

    (or you could take out NOT NULL if you would like them to be NULL-able)

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

Sidebar

Related Questions

Seem to run into a service endpoint not found problem when trying to get
I seem to be a little lost on what to so about this, im
I seem to be running into great difficulty in attempting to convert a Google
Seem like my daily road block. Is this possible? String in qw? #!/usr/bin/perl use
I wanted to implement lazy loading of variables, but I seem to misunderstand descriptors
I just introduced a bug into my code because I seem to have misunderstood
I seem to be running into an interesting problem while saving a Sprite to
Seem to be having some issues storing the current date in a core data
I seem to have a problem passing some strings on from one form to
I seem to have found a bug in jQuery UI that duplicates dragged elements

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.