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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:34:59+00:00 2026-06-15T03:34:59+00:00

When I update a row with a few counters columns in that row I

  • 0

When I update a row with a few counters columns in that row I need to do:

mutator.incrementCounter(rowid1, "cf1", "counter1", value);
mutator.incrementCounter(rowid1, "cf1", "counter2", value);
mutator.incrementCounter(rowid1, "cf1", "counter3", value);

How do I do all these 3 above just in 1 update? Since I don’t want to hit the database 3 times. I only want to hit the database 1 time. Also, the reason that I use incrementCounter is to have strong consistency (incrementCounter is more consistent than addCounter). Can you please provide some code for it? Thank you!

  • 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-15T03:35:01+00:00Added an answer on June 15, 2026 at 3:35 am

    I asked what research you did so far, because it seems to me that you did not do any. I would normally walk away at this point, but for some reason, I’m choosing to answer anyway.


    Let’s look up the Mutator documentation. It starts with:

    A Mutator inserts or deletes values from the cluster. There are two main ways to use a mutator: 1. Use the insert/delete methods to immediately insert of delete values. or 2. Use the addInsertion/addDeletion methods to schedule batch operations and then execute() all of them in batch. The class is not thread-safe.

    The class summary says that Mutator supports performing multiple operations in a single batch, and it points you to add* methods to do it. (You tagged your question with “batch”, so you know this is the feature you need.) The very first thing under the class summary is the addCounter() function, described as:

    Schedule an increment of a CounterColumn to be inserted in batch mode by Mutator.execute()

    Problem solved.

    Alternately, you could use your IDE to explore your current code, which works but is inefficient. The one-line summary available on the incrementCounter() calls says that it is a convenience method, strongly suggesting that there are other ways to increment counters. Browsing the Mutator interface even with just your auto-complete would quickly lead you to addCounter(), since there’s only a few counter-related functions, and addCounter() is alphabetically first.

    A third option, if you prefer to totally ignore documentation, would be to go straight to the incrementCounter() implementation. incrementCounter() is quickly revealed to be addCounter() followed by execute().

    Any of these approaches would let you conclude that you could increment multiple counters at once by calling addCounter() multiple times followed by a single execute().


    The fourth option, of course, is to come straight to Stack Overflow and ask for code. This will usually get you sent to whathaveyoutried.com, and only occasionally get you answers such as this one explaining in detail all the ways in which you could have answered your own question. I’ll end my response now with a snippet from that article:

    The problem is that this person’s problem-solving technique is to ask for the solution. Not to seek advice on how to approach the task, or ask for the names of likely classes to look into, or a link to an example – but to just ask for the code, fully formed and ready to go. This is not problem solving, and software engineering is entirely about problem solving.

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

Sidebar

Related Questions

I have a Datagridview that contains few columns and data in each row. I
I want to always update the value of an update row in the database.
I need to generate a fixed width file with few of the columns in
I have a few columns in a table that are added to my publication
Using a hector Mutator I update some row over N sequential operation. Is there
I'm trying to update a row in my database but it's not running. Below
Is it possible to update first row and with WHERE clause. I Tried: UPDATE
I there a way to update a row without mentioning fields name ? I
I was wondering what the syntax was in PHP to update a row in
Is it a good practice to have timestamps for the last row update in

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.