Error Processing SQL: Undefined

2,593 views
Skip to first unread message

Kevin Brooks

unread,
Mar 4, 2011, 11:28:14 PM3/4/11
to phon...@googlegroups.com
I am having trouble with executeSql. Every time call the method from a
Database object, I receive an error that says, "Error Processing SQL:
Undefined". It doesn't matter what I have as the actual SQL Statement.
Do I need to include something for this to work?

Thanks,
Kevin

KenCorbettJr

unread,
Mar 5, 2011, 3:15:36 PM3/5/11
to phonegap
Kevin,

I'm not sure why you are having this problem. You shouldn't have to
include anything, it actually sounds like a syntax error to me. But
rather than try and dissect your code to discover where the problem
is, I would just recommend working with a JavaScript library which
will take care of a lot of things for you like html5sql. You can get
it over on github: https://github.com/kencorbettjr/html5sql.

Now as I disclaimer, I am the author of html5sql so I am a little
biased, but the library makes it a whole lot easier to process some
SQL and get the result. Take a look at the documentation on the
github page for directions about how to use and if you have any
questions just reply to me here, or send me an email. The usage is
similar to the native executeSql function you have been trying to use.

Hopefully this helps.

Ken Corbett

Nick McCloud

unread,
Mar 5, 2011, 3:57:29 PM3/5/11
to phonegap
Post some code Kevin, then we may be able to spot the issue

Kevin Brooks

unread,
Mar 5, 2011, 8:09:30 PM3/5/11
to phon...@googlegroups.com
Hi Nick,

Here are the methods in question. Thanks for the help.

function onDeviceReady()
{
var db = window.openDatabase("grptracker", "1.0", "Group
Tracker DB", 1000000);
db.transaction(populateDB, errorCB, successCB);
}
function populateDB(tx)
{
tx.executeSql('DROP TABLE tblGROUPS');
tx.executeSql('CREATE TABLE IF NOT EXISTS tblGROUPS (id
unique, name TEXT, expire NUMERIC, descrip TEXT)');
}

function errorCB(tx, err)
{
alert("Error processing SQL: "+err);
}

function successCB()
{
alert("success!");

Simon MacDonald

unread,
Mar 5, 2011, 9:43:43 PM3/5/11
to phon...@googlegroups.com
I have had problems in the past trying to drop a table that doesn't
exist. Try removing that line and running your code to see what
happens.

Simon Mac Donald
http://hi.im/simonmacdonald

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

Kevin Brooks

unread,
Mar 5, 2011, 10:01:06 PM3/5/11
to phon...@googlegroups.com
Thank you Simon that did the trick.
Reply all
Reply to author
Forward
0 new messages