Build insert and update with equery.

Thanks to tonghu008@gmail