question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conditional insert or replace -> with StorIO better?

See original GitHub issue

I have following procedure:

  1. execute sql-statement: select to_update from test where uuid='123-XYZ' (to_update is 0 or 1; or no-select-data)
  2. if result of 1. is 1 or no-select-result then I have to execute another sql (example): insert or update (...) values (...)

I’m wondering if this could be done with StorIO in an elegant way…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
nikitin-dacommented, May 2, 2016

@Rainer-Lang I guess, custom put resolver - it is only way to do it inside StorIO (@artem-zinnatullin, @karlicoss correct me if I’m wrong).

From my point of view it’s preferably to make such decision on a higher level (some domain model that represents business logic). Imagine if you will have to check not just test table to find out if value up to date. But also obtain some information from shared preferences or smth else. It will be improperly to wrap all these logic in StorIO. And in these cases you’ll have to completely rewrite your put resolver.

0reactions
Rainer-Langcommented, Jul 11, 2016

I found a workaround, so I don’t need this. Anyway, @nikitin-da thanks for your effort.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQLite conditional insert or replace - Stack Overflow
I'm trying to insert or update a record into a sqlite database, and only update the value if the new value is greater...
Read more >
Concurrency with Select-conditional Insert/Update/Delete
Clients compute new intervals for one variable and store them in that table. To preserve consistency (for a variable_id I don't want intervals ......
Read more >
Video: Intermediate conditional formatting - Microsoft Support
Training: Apply conditional formatting to specific cells, tables, ... and use formulas as the basis of a conditional formatting rule. ... Want more...
Read more >
Conditional text in document header - Microsoft Community
Hi I am doing a collection of notes for the finals, where I would like to present the heading 2 in the header....
Read more >
REPLACE - SingleStore Documentation
It is recommended to use the INSERT ON DUPLICATE KEY UPDATE statement instead of REPLACE , because it allows you to use more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found