Add select method (algorithm copy from https://github.com/EgorKluch/pics-gallery/blob/master/core/Mysql.js)