Simplified code by using Emysql converter.
comment
Even more simplerer.