[ 
https://issues.apache.org/jira/browse/CB-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13597186#comment-13597186
 ] 

Nolan Lawson commented on CB-592:
---------------------------------

May I ask why this was resolved as "won't fix"?  I've run into this same issue 
on several Android devices, and it occurs consistently for me (not 
intermittently).  Basically, I am unable to use the Cordova SQLite API at all, 
as described by the documentation.

I'm using PhoneGap Build and PhoneGap v.2.2.0.

All I do is create a database:

{code:JavaScript}
var db = window.openDatabase('myDatabase', '1.0', "My Database", 1000000);
{code}

Then I call a simple chain of two queries on it:

{code:JavaScript}

function query(tx) {
    tx.executeSql('select 1 from sqlite_master');
}

function onError() {
    ....
}

function onSuccess() {
    db.transaction(query2, onError2, onSuccess2);
}

function query2(tx) {
    tx.executeSql('create table mytable(mycolumn text)');
}

function onError2() {
    ....
}

function onSuccess2() {
    ....
}

db.transaction(query, onError, onSuccess);
{code}

The table below shows the Android devices that I tested this on, and the 
failure I got in each.

||Device||Android||Working?||Result||Logcat|| SQLError object||
|Galaxy Nexus|4.1.1|{color:green}Yes{color}|Logs an error, but still works.| 
{{SQLiteLog  E  (23) not authorized}}||
|Nexus One|2.3.7|{color:red}No{color}|Calls the {{onError2}} message 
above.|{{Database  I  sqlite returned: error code = 23, msg = not 
authorized}}|{code:JavaScript} {"message":"not authorized","code":1} {code}|
|HTC Magic|2.1-update1|{color:red}No{color}|Calls the {{onError2}} message 
above.|None|{code:JavaScript} {"code":1,"message":"not authorized"} {code}|
|Galaxy Tab 8.9|4.0.4|{color:red}No{color}|Calls the {{onError2}} message 
above.|{{SqliteDatabaseCpp  I  sqlite returned: error code = 23, msg = not 
authorized, db=xxx}}|{code:JavaScript} {"code":5,"message":"not authorized"} 
{code}|
|Samsung GT-I9001|2.3.6|{color:red}No{color}|Calls the {{onError2}} message 
above.|None|{code:JavaScript} {"message":"not authorized", "code":1} {code}|

(I've also tested on an Ipod Touch (5th generation) with no issues.)

I don't know whether this is a bug in the native Web SQL Database 
implementation or the Cordova implementation, but it's basically a deal-breaker 
for me when it comes to PhoneGap on Android.  Without SQLite, I'm not sure what 
kind of app I can make beyond Hello World.

Really hoping that this is just an oversight in the documentation, or that I'm 
doing something stupid.
                
> SQLITE Error code = 23, msg = not authorized (Intermittently)
> -------------------------------------------------------------
>
>                 Key: CB-592
>                 URL: https://issues.apache.org/jira/browse/CB-592
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CordovaJS
>    Affects Versions: 1.6.1
>         Environment: Android 3.1. Cordova 1.6.1 but also older versions (also 
> appears to be the same in "phonegap" 1.3.0. Motorola Xoom. Eclipse. JQuery 
> Mobile.
>            Reporter: Carl Mason
>            Assignee: Joe Bowser
>            Priority: Minor
>
> Intermittently receiving the error message, when executing an update 
> statement on SQLLite database. 
> 04-27 10:22:38.288: I/SqliteDatabaseCpp(1428): sqlite returned: error code = 
> 23, msg = not authorized, db=/data/data/com.packagename/databases/webview.db
> (example)
> tx.executeSql('UPDATE JOB SET postcode = "' + $("#tbPostcode").val() + '" 
> WHERE id = "' + window.localStorage.getItem("job_id") +'"', [], querySuccess, 
> errorCB);
> It appears it could be to do with the version variable in openDatabase(..).
> When I fire openDatabase on a FIRST execution with a version "1.0", create 
> some tables and insert some data - I will get the above error intermittently 
> when trying to update. However, if I then change all of the database 
> interaction to a version "1.1" (or anything different) deploy the application 
> and execute a second time - and go on to create a second database and start 
> updating/interacting with the database the error goes away. Obviously this is 
> not a feasible workaround when deploying an app live. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to