generate sql by js