sqlgen: convert if/elif switch to dispatch table