[svn:parrot] r44453 - in trunk: src/dynpmc t/dynpmc
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Wed Feb 24 09:49:42 UTC 2010
Author: fperrad
Date: Wed Feb 24 09:49:39 2010
New Revision: 44453
URL: https://trac.parrot.org/parrot/changeset/44453
Log:
[gdbmhash] add methods open/close.
This allows to remove database file without problem on Windows
Modified:
trunk/src/dynpmc/gdbmhash.pmc
trunk/t/dynpmc/gdbmhash.t
Modified: trunk/src/dynpmc/gdbmhash.pmc
==============================================================================
--- trunk/src/dynpmc/gdbmhash.pmc Wed Feb 24 08:11:58 2010 (r44452)
+++ trunk/src/dynpmc/gdbmhash.pmc Wed Feb 24 09:49:39 2010 (r44453)
@@ -390,6 +390,40 @@
return;
}
+
+/*
+
+=back
+
+=head2 Specific Methods
+
+=over 4
+
+=item C<void open(STRING* value)>
+
+Open a or create a new dbm file.
+
+=cut
+
+*/
+
+ METHOD void open(STRING* value) {
+ VTABLE_set_string_native(interp, SELF, value);
+ }
+
+/*
+
+=item C<void close()>
+
+Close current dbm file.
+
+=cut
+
+*/
+
+ METHOD void close() {
+ gdbm_close(PMC_dbfh(SELF));
+ }
}
/*
Modified: trunk/t/dynpmc/gdbmhash.t
==============================================================================
--- trunk/t/dynpmc/gdbmhash.t Wed Feb 24 08:11:58 2010 (r44452)
+++ trunk/t/dynpmc/gdbmhash.t Wed Feb 24 09:49:39 2010 (r44453)
@@ -128,6 +128,7 @@
hash_size = hash_1
is(hash_size, 13, 'After 15 assignments and 2 deletes GDBMHash has size 13')
+ hash_1."close"()
unlink('gdbm_hash_1')
.end
@@ -151,6 +152,7 @@
HASH1_IS_3:
ok(1, 'After one insert the GDBMHash is')
+ hash_1."close"()
unlink('gdbm_hash_2')
.end
@@ -178,6 +180,7 @@
val_pmc = hash_1["Schluessel"]
is(val_pmc, 'Wert urspruenglich', 'modify an entry')
+ hash_1."close"()
unlink('gdbm_hash_3')
.end
@@ -207,6 +210,7 @@
exist_flag = exists hash_1[key_out]
is(exist_flag, 1, 'exists keyed')
+ hash_1."close"()
unlink('gdbm_hash_4')
.end
@@ -236,6 +240,7 @@
val_pmc = hash_1[key_out]
is(val_pmc, 'Wert', 'set string with string key')
+ hash_1."close"()
unlink('gdbm_hash_5')
.end
@@ -268,6 +273,7 @@
val_pmc = hash_1[key2]
is(val_pmc, 'Wert', 'set string with pmc key')
+ hash_1."close"()
unlink('gdbm_hash_6')
.end
@@ -300,6 +306,7 @@
val_pmc = hash_1[key_out]
is(val_pmc, 'Wert', 'set pmc with string key')
+ hash_1."close"()
unlink('gdbm_hash_7')
.end
@@ -335,6 +342,7 @@
val_pmc = hash_1[key2]
is(val_pmc, 'Wert', 'set pmc with pmc key')
+ hash_1."close"()
unlink('gdbm_hash_8')
.end
@@ -364,6 +372,7 @@
val_pmc = hash_1[key_out]
is(val_pmc, -11012005, 'set intval with a string key')
+ hash_1."close"()
unlink('gdbm_hash_9')
.end
@@ -396,6 +405,7 @@
val_pmc = hash_1[key2]
is(val_pmc, -1101.2005, 'set float with a pmc key')
+ hash_1."close"()
unlink('gdbm_hash_10')
.end
@@ -420,6 +430,7 @@
exist_flag = exists hash_1["a"]
is(exist_flag, 0, 'delete keyed')
+ hash_1."close"()
unlink('gdbm_hash_11')
.end
More information about the parrot-commits
mailing list