Permalink
Browse files

Prefixing databases

  • Loading branch information...
1 parent 381642c commit 656cc08353c12a2b4eff60ffc1c05861fbd46eee @benrudolph benrudolph committed with Apr 7, 2013
Showing with 5 additions and 4 deletions.
  1. +1 −1 src/pouch.adapter.js
  2. +4 −3 src/pouch.js
View
@@ -26,7 +26,7 @@ var PouchAdapter = function(opts, callback) {
// Don't call Pouch.open for ALL_DBS
// Pouch.open saves the db's name into ALL_DBS
- if (opts.name === Pouch.ALL_DBS) {
+ if (opts.name === Pouch.prefix + Pouch.ALL_DBS) {
callback(err, db);
} else {
Pouch.open(opts, function(err) {
View
@@ -81,8 +81,9 @@ Pouch.DEBUG = false;
Pouch.adapters = {};
Pouch.plugins = {};
-Pouch.parseAdapter = function(name) {
+Pouch.prefix = '_pouch';
+Pouch.parseAdapter = function(name) {
var match = name.match(/([a-z\-]*):\/\/(.*)/);
if (match) {
// the http adapter expects the fully qualified name
@@ -98,7 +99,7 @@ Pouch.parseAdapter = function(name) {
for (var i = 0; i < preferredAdapters.length; ++i) {
if (preferredAdapters[i] in Pouch.adapters) {
return {
- name: name,
+ name: Pouch.prefix + name,
adapter: preferredAdapters[i]
};
}
@@ -192,7 +193,7 @@ Pouch.realDBName = function(adapter, name) {
return [adapter, "://", name].join('');
};
Pouch.allDBName = function(adapter) {
- return [adapter, "://", Pouch.ALL_DBS].join('');
+ return [adapter, "://", Pouch.prefix + Pouch.ALL_DBS].join('');
};
Pouch.open = function(opts, callback) {

0 comments on commit 656cc08

Please sign in to comment.