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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:04:11+00:00 2026-06-12T00:04:11+00:00

I need to solve this problem. I started my project from the wrong concept

  • 0

I need to solve this problem.

I started my project from the wrong concept that ON CONFLICT REPLACE will do an update of the row content when it finds a conflict. Also I was thinking that in that insert (with the conflict) if I don’t put a value for a column it wont do the replace but keep the old value. Instead I just discovered that the ON CONFLICT REPLACE if it finds a conflict it will do a delete->insert and if it can’t find a value for a column (where I put null for not updating the field) it will replace the null value with the default column value in order to make successfully the insert.

So know I have this big root problem 😀

As you understand what I want to reach is this:

I always do the insert, if it finds already a row with the same unique keys (conflict) it will only update the values. If for a field it wont find the values ( I don’t put it in the ContentValues ) it wont update those field but keep the old one (like a normal update query where you don’t put a column for update it).

To solve my problem I tought these solutions:

  • ON CONFLICT UPDATE (this will only work when you have only 1 unique
    fields, if you have 2 or more unique fields that throw the conflict
    it will crash)
  • UPDATE ON FAIL INSERT where it always try to do an update. If it fails because it can’t find the row related to the record (it’s not yet present in the db) it will try to do an insert

Some one has already thought about this problem and has a solution?
Or maybe we can just try to find a solution 🙂

I think that the best way is to keep things on low level (db level) in order to keep a good level of performance.

  • 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-12T00:04:12+00:00Added an answer on June 12, 2026 at 12:04 am

    Following SQLite3 official Documentation is not possible to automatically do a ON CONFLICT UPDATE but only a REPLACE that is like DELETE -> INSERT (new values).

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

Sidebar

Related Questions

This the problem in my book that I am trying to solve..I need to
I don't like JSF but I need to solve this problem with it, I
Well i need some help here i don't know how to solve this problem.
I need to solve a locking problem for this scenario: A multi CPU system.
This is a problem I've been struggling to solve for a while. I need
I'm hoping that this will be a useful page for getting started running php
I have solved this problem, I just need to know what to do. I
I need to build app with user messages (dialogs). I've solved this problem by
Need some help to solve this. I have a gridview and inside the gridview
I need to solve a problem within job booking software and am hoping to

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.