code cleanup, improve DB_rbdms sql generation