add some common func, improve join support in sql builder