history.c: use dynamic size for db request