1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Add oo1.JsStorageDb() as a convenience wrapper for oo1.DB(...,'kvvfs'). Minor doc cleanups.

FossilOrigin-Name: 8a7998709f859a562cf6829485cb9921f8823af0efabe003741348ab1169fb89
This commit is contained in:
stephan
2022-09-30 11:01:44 +00:00
parent 53d4e01d06
commit f6c686c9f4
8 changed files with 49 additions and 34 deletions

View File

@ -1638,7 +1638,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Object.defineProperty(Stmt.prototype, 'pointer', prop);
Object.defineProperty(DB.prototype, 'pointer', prop);
}
/** The OO API's public namespace. */
sqlite3.oo1 = {
version: {
@ -1650,5 +1650,24 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
dbCtorHelper
}/*oo1 object*/;
if(util.isMainWindow()){
/**
Functionally equivalent to DB(storageName,'c','kvvfs') except
that it throws if the given storage name is not one of 'local'
or 'session'.
*/
sqlite3.oo1.JsStorageDb = function(storageName='session'){
if('session'!==storageName && 'local'!==storageName){
toss3("JsStorageDb db name must be one of 'session' or 'local'.");
}
dbCtorHelper.call(this, {
filename: storageName,
flags: 'c',
vfs: "kvvfs"
});
};
sqlite3.oo1.JsStorageDb.prototype = Object.create(DB.prototype);
}
});