Use Ruby's StringValueCStr() to convert to zero-terminated strings

Strings (database name, keys, values) are corrupted for me because they are not properly zero terminated. Ruby has a function called StringValueCStr() to get the proper zero-terminated string. This patch uses it everywhere instead of StringValuePtr().