support unqlite_kv_append

This commit is contained in:
tokuhirom 2013-07-03 17:21:17 +09:00
parent 0ea8c2d0a2
commit 517a81ff38
2 changed files with 27 additions and 0 deletions

View file

@ -74,6 +74,30 @@ CODE:
OUTPUT:
RETVAL
SV*
kv_append(self, key_sv, data_sv)
SV *self;
SV *key_sv;
SV *data_sv;
PREINIT:
char *key_c;
STRLEN key_l;
char *data_c;
STRLEN data_l;
int rc;
CODE:
unqlite *pdb = XS_STATE(unqlite*, self);
key_c = SvPV(key_sv, key_l);
data_c = SvPV(data_sv, data_l);
rc = unqlite_kv_append(pdb, key_c, key_l, data_c, data_l);
if (rc==UNQLITE_OK) {
RETVAL = &PL_sv_yes;
} else {
RETVAL = &PL_sv_undef;
}
OUTPUT:
RETVAL
SV*
kv_delete(self, key_sv)
SV *self;

View file

@ -13,6 +13,9 @@ ok($db->kv_store("foo", "bar"));
is($db->kv_fetch('foo'), 'bar');
ok($db->kv_delete('foo'));
is($db->kv_fetch('foo'), undef);
$db->kv_store('yay', 'yap');
$db->kv_append('yay', 'po');
is($db->kv_fetch('yay'), 'yappo');
done_testing;