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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:29:11+00:00 2026-06-17T18:29:11+00:00

I am trying to perform a delete of a row in sqlite db using

  • 0

I am trying to perform a delete of a row in sqlite db using nodejs and node-sqlite3 package.

When I run the delete command, and manually check the entries, I can see that the query successfully deleted that row but I cant seem to write the code that confirms this.

This is the query

db.run("DELETE FROM Table1 WHERE id=? AND username=?", [id, user], function(error) {
console.log(error);
});

Regardless of a wrong or right input, it outputs null to the console. If the right details are given, it deletes it and prints null, if wrong id and user are given, it still prints null.

Any ideas on what might be wrong?

Thanks

  • 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-17T18:29:12+00:00Added an answer on June 17, 2026 at 6:29 pm

    There is nothing wrong in the node and node-sqlite3 behaviour here.
    Here are two parts to explain first regarding node and other regarding Sqlite.

    Node

    Your callback is getting called after execution of the statement. So nothing wrong here, since your callback is getting called (as proved by ‘null’ as output).

    Sqlite

    Delete query in Sqlite deletes if condition given in where clause evaluates to true, otherwise nothing is deleted.

    Referring from node-sqlite3 documentation’s Database#run api:

    callback (optional): If given, it will be called when an error occurs
    during any step of the statement preparation or execution, and after
    the query was run. If an error occurred, the first (and only)
    parameter will be an error object containing the error message. If
    execution was successful, the first parameter is null.

    So, in your case query execution succeeds without any error, resulting in error argument to callback function null as you see in output.

    Further, if you want to check if any row was actually removed, you can use changes property as mentioned in the documentation:

    If execution was successful, it contains two properties named “lastID”
    and “changes” which contain the value of the last inserted row ID and
    the number of rows affected by this query respectively. Note that
    “lastID” only contains valid information when the query was a
    successfully completed INSERT statement and “changes” only contains
    valid information when the query was a successfully completed UPDATE
    or DELETE statement. In all other cases, the content of these
    properties is inaccurate and should not be used. The .run() function
    is the only query method that sets these two values; all other query
    methods such as .all() or .get() don’t retrieve these values.

    Hope it helps…

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

Sidebar

Related Questions

I'm trying perform a relatively basic TCP socket send/receive operation on Windows CE using
I'm using Linq to SQL for the Database operations, and am trying to perform
I'm trying to execute such command in mysql: DELETE FROM product_description, product, product_to_store, url_alias
I'm trying to delete the node in BST which have two child nodes. For
I'm trying to use the NpgsqlCommandBuilder to automatically generate SQL commands to perform insert/update/delete
I am trying to delete a document by using a term in lucene index.
I'm trying to delete one row of data from a MySQL database (innodb) in
I'm trying to perform a bulk delete of an object, Feature, which has a
I am trying to delete an old row from a sql-server-ce database (based on
i'm trying to perform all operations(push, pop, peep, update, show) on stack using array

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.