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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:49:39+00:00 2026-06-16T05:49:39+00:00

Using Phonegap you can set a function to be called back if the whole

  • 0

Using Phonegap you can set a function to be called back if the whole database transaction or the individual SQL statement errors. I’d like to know how to get more information about the error.

I have one generic error-handling function, and lots of different SELECTs or INSERTs that may trigger it. How can I tell which one was at fault? It is not always obvious from the error message.

My code so far is…

function get_rows(tx) {
   tx.executeSql("SELECT * FROM Blah", [], lovely_success, statement_error);
}
function add_row(tx) {
   tx.executeSql("INSERT INTO Blah (1, 2, 3)", [], carry_on, statement_error);
}
function statement_error(tx, error) {
   alert(error.code + ' / ' + error.message);
}

From various examples I see the error callback will be passed a transaction object and an error object. I read that .code can have the following values:

  • UNKNOWN_ERR = 0
  • DATABASE_ERR = 1
  • VERSION_ERR = 2
  • TOO_LARGE_ERR = 3
  • QUOTA_ERR = 4
  • SYNTAX_ERR = 5
  • CONSTRAINT_ERR = 6
  • TIMEOUT_ERR = 7

Are there any other properties/methods of the error object?
What are the properties/methods of the transaction object at this point?

I can’t seem to find a good online reference for this. Certainly not on the Phonegap website!

  • 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-16T05:49:40+00:00Added an answer on June 16, 2026 at 5:49 am

    Transaction object

    The only thing you can do with the transaction object is call its .executeSql() method, as far as I can ascertain. I cannot find any properties of this object.

    Error object

    The error object has a .code property which contains a number. You can either check the numerical value (see my original question above) or use something like:
    if (error.code == error.DATABASE_ERR) alert('nasty database error')

    The .message property is a string and may return something like this:

    • could not prepare statement (1 near “wibble”: syntax error)
    • could not prepare statement (1 no such table: MyyTable)
    • could not prepare statement (1 table MyTable has no column named MyColunm)
    • could not execute statement (19 constraint failed)

    Other messages are possible! This is just the few I spotted when debugging in Chrome. I notice in Phonegap the messages are briefer: “no such table: MyyTable“

    There are two sets of success/error callbacks

    Also note that there is another database error callback on the initial call to .transaction(). Your function will only be returned an error object (no transaction object).

    The error’s .code will be zero and the .message will be “the statement callback raised an exception or statement error callback did not return false“.

    So remember to have your statement callbacks (function mentioned inside .executeSql such as my statement_error in the code example of my original question) return true or false depending on whether you want your transaction error callback (second function mentioned inside .transaction) to be hit. The ‘success’ callback you specified (third one inside .transaction) will be run if you return true (or don’t return anything).

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

Sidebar

Related Questions

I'm using the phonegap localNotifications plugin which specifies that I can set a notification
Using Phonegap with its SQL function, I get my query returns in the form
Can I use Sqlite with IOS using phonegap (with no limitations) ? If you
How can I get access to the iPhone clipboard whilst using PhoneGap? I cannot
I am new to phonegap. How can we load an image on html5 using
I want to build a phone app using phonegap that can access data on
I'm writing an app using phonegap. I can open the native android dialer using:
I created iOS app using PhoneGap version 0.9.6 long back. Now I am going
I'm using PhoneGap 1.4.1 to create an iPhone application. I can successfully perform the
I'm developing an app using phonegap/cordova (1.7.0), I can't figure out how to make

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.