summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNic Ferier <nic@ferrier.me.uk>2013-01-08 18:56:26 +0000
committerNic Ferier <nic@ferrier.me.uk>2013-01-08 18:56:26 +0000
commit820b7a546424c300098b698c516e86d776b38715 (patch)
tree50ad71a94c309882da669d24f519f971bf028d62
parentf7f0b2276412c0025de278abc94b521b34b60f45 (diff)
added db-copy to copy one db to the other.
-rw-r--r--db.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/db.el b/db.el
index f18cf19..f45e315 100644
--- a/db.el
+++ b/db.el
@@ -116,6 +116,19 @@ The query is as specified by `kvquery->func'.
This is `db-map' with an identity function."
(db-map 'kvidentity db query))
+
+;;; Generic utility functions
+
+(defun db-copy (src-db dest-db)
+ "Copy the data from SRC-DB into DEST-DB."
+ (db-map (lambda (key value)
+ ;;(unless (db-get key dest-db)
+ (progn
+ (db-put key value dest-db))) src-db))
+
+
+;;; Hash implementation
+
(defun db-hash (reference)
"Make a db-hash database.