Merge pull request #11 from 30x/XAPID-1093

Xapid 1093
diff --git a/README.md b/README.md
index 7a4d0cd..c7587cf 100644
--- a/README.md
+++ b/README.md
@@ -55,5 +55,5 @@
 
 ## apid.Data() service
 This service provides the primitives to perform SQL operations on the database. It also provides the
-provision to alter DB connection pool settings via ConfigDBMaxConns, ConfigDBIdleConns andonfigDBConnsTimeout configuration parameters. They currently are defaulted to 1000, 1000 and 120 seconds respectively.
+provision to alter DB connection pool settings via ConfigDBMaxConns, ConfigDBIdleConns and configDBConnsTimeout configuration parameters. They currently are defaulted to 1000 connections, 1000 connections and 120 seconds respectively.
 More details on this can be found at https://golang.org/pkg/database/sql
diff --git a/data/data.go b/data/data.go
index 7fed43d..d5c893c 100644
--- a/data/data.go
+++ b/data/data.go
@@ -99,8 +99,18 @@
 	return d.dbVersionForID(id, version)
 }
 
-// will set DB to close and delete when no more references
-func (d *dataService) ReleaseDB(id, version string) {
+// will set DB to close and delete when no more references for commonDBID, provided version
+func (d *dataService) ReleaseDB(version string) {
+	d.ReleaseDBForID(commonDBID, version)
+}
+
+// will set DB to close and delete when no more references for commonDBID, commonDBVersion
+func (d *dataService) ReleaseCommonDB() {
+	d.ReleaseDBForID(commonDBID, commonDBVersion)
+}
+
+// will set DB to close and delete when no more references for any ID
+func (d *dataService) ReleaseDBForID(id, version string) {
 	versionedID := VersionedDBID(id, version)
 
 	dbMapSync.Lock()
@@ -116,7 +126,7 @@
 		runtime.SetFinalizer(dbm.db, finalizer)
 		dbMap[versionedID] = nil
 	} else {
-		log.Error("Cannot find DB handle for ver {%s} to release", version)
+		log.Errorf("Cannot find DB handle for ver {%s} to release", version)
 	}
 
 	return
diff --git a/data_service.go b/data_service.go
index b467918..7a5a3d0 100644
--- a/data_service.go
+++ b/data_service.go
@@ -26,7 +26,9 @@
 	DBVersionForID(id, version string) (db DB, err error)
 
 	// will set DB to close and delete when no more references
-	ReleaseDB(id, version string)
+	ReleaseDB(version string)
+	ReleaseCommonDB()
+	ReleaseDBForID(id, version string)
 }
 
 type DB interface {