From eee91f756ea09ba2eec8ca6487a72d6890c26603 Mon Sep 17 00:00:00 2001 From: Fredrik Noring <noring@nocrew.org> Date: Tue, 15 Feb 2000 15:28:14 +0100 Subject: [PATCH] Added values and extra modeflag Q. Rev: lib/modules/Yabu.pmod/module.pmod:1.19 Rev: lib/modules/Yabu.pmod/test.pike:1.6 --- lib/modules/Yabu.pmod/module.pmod | 25 +++++++++++++++++++++++-- lib/modules/Yabu.pmod/test.pike | 4 +++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/modules/Yabu.pmod/module.pmod b/lib/modules/Yabu.pmod/module.pmod index c686bc1ae3..7a10cd6752 100644 --- a/lib/modules/Yabu.pmod/module.pmod +++ b/lib/modules/Yabu.pmod/module.pmod @@ -4,7 +4,7 @@ * associated with a unique key. */ -constant cvs_id = "$Id: module.pmod,v 1.18 2000/01/29 12:37:31 noring Exp $"; +constant cvs_id = "$Id: module.pmod,v 1.19 2000/02/15 14:28:14 noring Exp $"; #define ERR(msg) throw(({ "(Yabu) "+msg+"\n", backtrace() })) #define IO_ERR(msg) throw(({ sprintf("(Yabu) %s, %s (%d)\n",msg,strerror(errno()),errno()),backtrace() })) @@ -85,7 +85,8 @@ static private class ProcessLock { if(!rm(lock_file)) ERR("Lock removal failure (insufficient permissions?)"); - sleep(10); + + sleep(has_value(mode, "Q") ? 0.5 : 10); } ERR("Lock tryout error (insufficient permissions?)"); } @@ -609,6 +610,11 @@ class Transaction { return list_keys(); } + array _values() + { + return map(_indices(), `[]); + } + void create(object table_in, int id_in, object keep_ref_in) { table = table_in; @@ -947,6 +953,11 @@ class Table { return list_keys(); } + array _values() + { + return map(_indices(), `[]); + } + mapping(string:string|int) statistics() { LOCK(); @@ -1066,6 +1077,11 @@ class _Table { return list_keys(); } + array _values() + { + return map(_indices(), `[]); + } + void destroy() { if(table_destroyed) @@ -1201,6 +1217,11 @@ class db { return list_tables(); } + array _values() + { + return map(_indices(), `[]); + } + /* Remove maximum one level of directories and files. */ static private void level2_rm(string f) { diff --git a/lib/modules/Yabu.pmod/test.pike b/lib/modules/Yabu.pmod/test.pike index a414c45eb1..29ffde9f5d 100644 --- a/lib/modules/Yabu.pmod/test.pike +++ b/lib/modules/Yabu.pmod/test.pike @@ -42,7 +42,9 @@ int main(int argc, array argv) object transaction = table->transaction(); if(!equal(indices(table), ({ "Blixt" }))) - ERR("Table diff #1!"); + ERR("Table diff #1A!"); + if(!equal(values(table), ({ "Gordon" }))) + ERR("Table diff #1B!"); if(!equal(indices(transaction), ({ "Blixt" }))) ERR("Table diff #2!"); -- GitLab