Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance SQL Query to Perform Insert or Update in a Single Operation #596

Open
jibedoubleve opened this issue Dec 30, 2024 · 0 comments
Open
Assignees
Labels
internal refactoring Code changes, not behaviour changes
Milestone

Comments

@jibedoubleve
Copy link
Owner

Refactoring

This code can be updated to use the update or create query in SQLite

    private class Sql
    {
        // ...
        public const string UpdateDbVersion = "update settings set s_value = '{0}' where lower(s_key) = 'db_version'";
       // ...
    }

How to

Here's an example:

INSERT INTO settings (s_key, s_value)
VALUES ('db_version', '{0}')
ON CONFLICT(s_key) DO UPDATE SET
    s_value = '{0}'
WHERE lower(s_key) = 'db_version';
@jibedoubleve jibedoubleve added the internal refactoring Code changes, not behaviour changes label Dec 30, 2024
@jibedoubleve jibedoubleve added this to the vMaybe milestone Dec 30, 2024
@jibedoubleve jibedoubleve self-assigned this Dec 30, 2024
@jibedoubleve jibedoubleve modified the milestones: vMaybe, vNext, 3.1.0 Dec 30, 2024
@jibedoubleve jibedoubleve changed the title Update SQL Enhance SQL Query to Perform Insert or Update in a Single Operation Jan 3, 2025
@jibedoubleve jibedoubleve modified the milestones: 3.1.0, 3.0.0 Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal refactoring Code changes, not behaviour changes
Projects
None yet
Development

No branches or pull requests

1 participant