I investigated this. Your sample code works fine for me on Chrome
4.0.206.1. I had to make a few minor changes to replace references to
"this._database" with "database", but other than that works as
expected. Here is what I did:

a. put the two attached files in a directory
b. rename background.html.txt to background.html
c. go to chrome://extensions/
d. "load unpacked extension" -> select the folder
e. click "inspect" link on newly loaded extension's background.html
f. look at last console output
g. restart chrome
h. go to c.

Each time I inspected, I saw the number of rows found by the last
query incremented by 1.

Attached is my modified version of your extension. See if it works for you.

If you can create a simple testcase (including manifest) that exhibits
the problem you are seeing I will try again to reproduce it.

Note: I did find a confusing bug while I was investigating this
between databases and the "load unpacked extension" feature of
chrome://extensions/. If you were using this, it might be related to
the problem you saw. Details here: http://crbug.com/21281.

- a

On Tue, Sep 8, 2009 at 6:28 AM, Scott Ferguson<[email protected]> wrote:
>
> Just bumping this since it was posted before a holiday weekend.  Can
> somebody provide input on the issues Bill and I are seeing?
>
> On Sep 3, 10:23 pm, Bill <[email protected]> wrote:
>> Apologies for the duplicate post. Scott actually posted the same
>> problem (we are working together on this project) and my comment
>> needed approval first.
>>
>> On Sep 3, 3:24 pm, Bill <[email protected]> wrote:
>>
>>
>>
>> > Has anyone had problems with the latest build of Chromium?  We are
>> > having issues where our insert statements are returning a result of:
>>
>> > SQLResultSet
>> > insertId: 1
>> > rows: SQLResultSetRowList
>> > length: 0
>> > rowsAffected: 1
>>
>> > And Our Select statements are all empty.
>>
>> > Is this a problem with our code or is this an issue with chromium.  I
>> > am on build 25308 and as far as I can tell our SQL statements are
>> > correct.  I can post more if need be.
>>
>> > On Sep 2, 10:49 am, Scott Ferguson <[email protected]> wrote:
>>
>> > > Cool thanks!  It looks like it doesn't work currently out of context
>> > > of the extension, but within the extension's commandline it works
>> > > totally fine.
>>
>> > > On Sep 1, 11:39 pm, Marcos Aruj <[email protected]> wrote:
>>
>> > > > this._database =
>> > > >       window.openDatabase("test", "1.0", "test Database",  250 * 1024);
>>
>> > > > if (!this._database) {
>> > > >   // TODO: handle error.
>>
>> > > > }
>>
>> > > > //Arguments is an Array.
>>
>> > > > this._database.transaction(function(aTransaction) {
>> > > >   aTransaction.executeSql(aSQLQuery, aSQLArguments, successCallback,
>> > > > errorCallback);
>>
>> > > > });
>>
>> > > > successCallback : function (aTransaction, aResult) {
>> > > >   var length = aResult.rows.length; //number of rows in result set.
>> > > >   var rowsAffected = aResult.rowsAffected; //rows affected, applies for
>> > > > update, delete statements...
>>
>> > > > }
>>
>> > > > errorCallback : function(aTransaction, aError) {
>> > > >   var message = aError.message;// error message
>>
>> > > > }
>>
>> > > > Hope this helps.
>>
>> > > > Best regards,
>>
>> > > > Marcos
>>
>> > > > On Tue, Sep 1, 2009 at 8:40 PM, Scott Ferguson <[email protected]> 
>> > > > wrote:
>>
>> > > > > Could you provide a quick demonstration of how to useopenDatabase()?
>> > > > > Documentation is sketchy right now, it'd be much appreciated.
>>
>> > > > > On Sep 1, 5:00 pm, "Mike H." <[email protected]> wrote:
>> > > > > > i made an ad blocking extension two months ago that uses the 
>> > > > > > database and
>> > > > > > its working fine... i meant to release it but haven't gotten 
>> > > > > > around to
>> > > > > it.
>>
>> > > > > > On Tue, Sep 1, 2009 at 4:10 PM, Scott Ferguson 
>> > > > > > <[email protected]>
>> > > > > wrote:
>>
>> > > > > > > So I see thatopenDatabase() is an available call but is it 
>> > > > > > > working in
>> > > > > > > the latest Chromium builds?  Or maybe I just can't find the
>> > > > > > > appropriate API documentation for it?
>>
>> > > > --
>> > > > Marcos Aruj Alvarez
>> > > > Ingeniero de Software
>> > > > -------------------------------
>> > > > [email protected]
>> > > > -----
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

<script>
var database = window.openDatabase("testDatabase", "0.1", "Test Database", 250 
* 1024);

if (!database) {
   console.log("Error opening database");
}

// Create settings table
database.transaction(function(query) {
   query.executeSql('CREATE TABLE settings(id INTEGER PRIMARY KEY 
AUTOINCREMENT, username VARCHAR(50), password VARCHAR(50))',
                    []);
});

// Write a user
database.transaction(function(query) {
   query.executeSql('INSERT INTO settings(username, password) VALUES (?, ?)',
                    ['Scott', 'password'],
                    function(transaction, result) {
                        console.log(result);
                    },
                    function(transaction, error) {
                        console.log(error);
                    });
});

// Read the table
database.transaction(function(query) {
   query.executeSql('SELECT * FROM settings',
                    [],
                    function(transaction, result) {
                       console.log(transaction);
                       console.log(result.rows);
                    },
                    function(transaction, error) {
                        console.log(error);
                    });
});
</script>

Attachment: manifest.json
Description: Binary data

Reply via email to