benlilaj / gears

Automatically exported from code.google.com/p/gears
0 stars 1 forks source link

Expose sqlite attach/detach functionality in Database API. #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
SQLite supports ATTACH/DETACH statements which let you add named databases
to your database handle.  This is convenient for things like copying data
between databases, or segregating data into sets used in different ways
(perhaps if you had two applications served from the same origin which want
to share data).  This is disabled in Gears because it doesn't respect the
same-origin policy.

I propose:

attach([name])/detach([name])
Return value:   void
Parameters:     name - optional
Exceptions:     Throws an exception if an error occurs.

This will treat name exactly as open().  The corrosponding database would
be attached to the handle as name.  An example usage might be:

var db = google.gears.factory.create('beta.database', '1.0');
db.open();
db.attach('shared');
var rs = db.execute('SELECT username FROM shared.Users');
...

Original issue reported on code.google.com by Scott.Hess on 8 Jun 2007 at 5:59

GoogleCodeExporter commented 9 years ago

Original comment by gears.te...@gmail.com on 27 Jun 2007 at 7:23

GoogleCodeExporter commented 9 years ago

Original comment by othman@gmail.com on 5 Sep 2007 at 7:55