зеркало из https://github.com/mozilla/pjs.git
Bug 714367 - Add an explicit getOpenedUnsharedDatabase to storage/test/unit/head_storage.js. r=mak.
This commit is contained in:
Родитель
3b5dbcb2a8
Коммит
344f0e38ed
|
@ -120,20 +120,30 @@ var gDBConn = null;
|
|||
|
||||
/**
|
||||
* Get a connection to the test database. Creates and caches the connection
|
||||
* if necessary, otherwise reuses the existing cached connection.
|
||||
* if necessary, otherwise reuses the existing cached connection. This
|
||||
* connection shares its cache.
|
||||
*
|
||||
* @param unshared {boolean}
|
||||
* whether or not to open a connection to the database that doesn't share
|
||||
* its cache; if true, we use mozIStorageService::openUnsharedDatabase
|
||||
* to create the connection; otherwise we use openDatabase.
|
||||
* @returns the mozIStorageConnection for the file.
|
||||
*/
|
||||
function getOpenedDatabase(unshared)
|
||||
function getOpenedDatabase()
|
||||
{
|
||||
if (!gDBConn) {
|
||||
gDBConn = getService()
|
||||
[unshared ? "openUnsharedDatabase" : "openDatabase"]
|
||||
(getTestDB());
|
||||
gDBConn = getService().openDatabase(getTestDB());
|
||||
}
|
||||
return gDBConn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a connection to the test database. Creates and caches the connection
|
||||
* if necessary, otherwise reuses the existing cached connection. This
|
||||
* connection doesn't share its cache.
|
||||
*
|
||||
* @returns the mozIStorageConnection for the file.
|
||||
*/
|
||||
function getOpenedUnsharedDatabase()
|
||||
{
|
||||
if (!gDBConn) {
|
||||
gDBConn = getService().openUnsharedDatabase(getTestDB());
|
||||
}
|
||||
return gDBConn;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
function test_table_creation()
|
||||
{
|
||||
var msc = getOpenedDatabase(true);
|
||||
var msc = getOpenedUnsharedDatabase();
|
||||
|
||||
msc.executeSimpleSQL(
|
||||
"CREATE VIRTUAL TABLE recipe USING fts3(name, ingredients)");
|
||||
|
@ -52,7 +52,7 @@ function test_table_creation()
|
|||
|
||||
function test_insertion()
|
||||
{
|
||||
var msc = getOpenedDatabase(true);
|
||||
var msc = getOpenedUnsharedDatabase();
|
||||
|
||||
msc.executeSimpleSQL("INSERT INTO recipe (name, ingredients) VALUES " +
|
||||
"('broccoli stew', 'broccoli peppers cheese tomatoes')");
|
||||
|
@ -74,7 +74,7 @@ function test_insertion()
|
|||
|
||||
function test_selection()
|
||||
{
|
||||
var msc = getOpenedDatabase(true);
|
||||
var msc = getOpenedUnsharedDatabase();
|
||||
|
||||
var stmt = msc.createStatement(
|
||||
"SELECT rowid, name, ingredients FROM recipe WHERE name MATCH 'pie'");
|
||||
|
|
Загрузка…
Ссылка в новой задаче