Skip to content
Snippets Groups Projects
Commit eee91f75 authored by Fredrik Noring's avatar Fredrik Noring
Browse files

Added values and extra modeflag Q.

Rev: lib/modules/Yabu.pmod/module.pmod:1.19
Rev: lib/modules/Yabu.pmod/test.pike:1.6
parent ddd211a2
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* associated with a unique key. * 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 ERR(msg) throw(({ "(Yabu) "+msg+"\n", backtrace() }))
#define IO_ERR(msg) throw(({ sprintf("(Yabu) %s, %s (%d)\n",msg,strerror(errno()),errno()),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 { ...@@ -85,7 +85,8 @@ static private class ProcessLock {
if(!rm(lock_file)) if(!rm(lock_file))
ERR("Lock removal failure (insufficient permissions?)"); ERR("Lock removal failure (insufficient permissions?)");
sleep(10);
sleep(has_value(mode, "Q") ? 0.5 : 10);
} }
ERR("Lock tryout error (insufficient permissions?)"); ERR("Lock tryout error (insufficient permissions?)");
} }
...@@ -609,6 +610,11 @@ class Transaction { ...@@ -609,6 +610,11 @@ class Transaction {
return list_keys(); return list_keys();
} }
array _values()
{
return map(_indices(), `[]);
}
void create(object table_in, int id_in, object keep_ref_in) void create(object table_in, int id_in, object keep_ref_in)
{ {
table = table_in; table = table_in;
...@@ -947,6 +953,11 @@ class Table { ...@@ -947,6 +953,11 @@ class Table {
return list_keys(); return list_keys();
} }
array _values()
{
return map(_indices(), `[]);
}
mapping(string:string|int) statistics() mapping(string:string|int) statistics()
{ {
LOCK(); LOCK();
...@@ -1066,6 +1077,11 @@ class _Table { ...@@ -1066,6 +1077,11 @@ class _Table {
return list_keys(); return list_keys();
} }
array _values()
{
return map(_indices(), `[]);
}
void destroy() void destroy()
{ {
if(table_destroyed) if(table_destroyed)
...@@ -1201,6 +1217,11 @@ class db { ...@@ -1201,6 +1217,11 @@ class db {
return list_tables(); return list_tables();
} }
array _values()
{
return map(_indices(), `[]);
}
/* Remove maximum one level of directories and files. */ /* Remove maximum one level of directories and files. */
static private void level2_rm(string f) static private void level2_rm(string f)
{ {
......
...@@ -42,7 +42,9 @@ int main(int argc, array argv) ...@@ -42,7 +42,9 @@ int main(int argc, array argv)
object transaction = table->transaction(); object transaction = table->transaction();
if(!equal(indices(table), ({ "Blixt" }))) 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" }))) if(!equal(indices(transaction), ({ "Blixt" })))
ERR("Table diff #2!"); ERR("Table diff #2!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment