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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:14:19+00:00 2026-05-22T18:14:19+00:00

What is the most reliable way to determine what statements are querying versus modifying?

  • 0

What is the most reliable way to determine what statements are “querying” versus “modifying”? For example, SELECT versus UPDATE / INSERT / CREATE.

Parsing the statement myself seems the obvious first attempt, but I can’t help but think that this would be a flaky solution. Just looking for SELECT at the beginning doesn’t work, as PRAGMA can also return results, and I’m sure there are a multitude of ways that strategy could fail. Testing for zero rows returned from the cursor doesn’t work either, as a SELECT can obviously return zero results.

I’m working with SQLite via the Python sqlite3 module.

  • 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-22T18:14:19+00:00Added an answer on May 22, 2026 at 6:14 pm

    Use the sqlite3_changes API call, which is also available from SQL using the changes function.

    As TokenMacGuy mentioned, you can rollback the transaction containing the statement that caused the changes; the sqlite3_changes function will let you know if that is necessary.

    There is also the update_hook callback if you need more fine grained information abouth the tables and rows affected.

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

Sidebar

Related Questions

Most databases support some form of insert into select... statement. insert into a select
C# / .net framework What is the most reliable way to determine whether a
Problem I am trying to figure out the most reliable way to determine the
What is the most reliable way to determine the OS of a visitor to
What is the most reliable and secure way to determine what page either sent,
What is the most reliable way to determine whether the device accessing a site
Is there a reliable way to determine whether or not two files are the
What is the most reliable way to get the path of My Pictures as
What is the cleanest, most reliable way to run a Windows application as a
So based on this question I asked, what's the most reliable way of getting

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.