{"id":199012,"date":"2013-10-28T11:45:03","date_gmt":"2013-10-28T07:45:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=199012"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=199012","title":{"rendered":"<span class=\"post_title\">DSL \u043d\u0430 JavaScript \u0434\u043b\u044f C++ \u0438\u043b\u0438 \u043a\u043e\u0434\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e!<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0421 \u0434\u043e\u0431\u0440\u044b\u043c \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u043e\u043c, \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>  \u041a\u043e\u0432\u044b\u0440\u044f\u043b\u0441\u044f \u0434\u0430\u0432\u0435\u0447\u0430 \u0441 \u043e\u0434\u043d\u0438\u043c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c, \u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0434\u043e \u043d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043c\u043e\u0449\u043d\u044b\u043c, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0430 Python-\u0435. \u041d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u043d\u0430\u044f \u043c\u043e\u0449\u044c \u0432\u044b\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043a\u0440\u0430\u0439\u043d\u0435 \u044d\u043a\u0441\u0442\u0440\u0430\u0432\u0430\u0433\u0430\u043d\u0442\u043d\u044b\u0435 \u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 5% \u0441\u043b\u0443\u0447\u0430\u0435\u0432. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043f\u0430\u0447\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0434\u0430\u0436\u0435 \u0432 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0441\u0441\u0438\u043c\u0438\u0437\u043c \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0447\u0435\u043c-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c. \u0418 \u0442\u0443\u0442 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b\u0430\u0441\u044c \u043c\u043d\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0438\u0437 \u043c\u043e\u0435\u0433\u043e \u0434\u0430\u043b\u0435\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u0434\u0435\u043b\u044e\u0441\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h1>\n<p>  \u0411\u044b\u043b\u043e \u044d\u0442\u043e \u0434\u0430\u0432\u043d\u043e <strike>\u0438 \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430<\/strike>, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u0432\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u043c\u0435\u043c\u0443\u0430\u0440\u043e\u0432. \u041e\u0442\u0440\u044f\u0434\u0438\u043b\u0438 \u043d\u0430\u0441 \u0432 \u043f\u043e\u043c\u043e\u0449\u044c \u043e\u0442\u0434\u0435\u043b\u0443 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0430\u0443\u0442\u0441\u043e\u0440\u0441\u0438\u043d\u0433\u043e\u043c. \u041f\u0440\u043e\u0435\u043a\u0442 \u0431\u044b\u043b \u0443\u0436\u0435 \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438, \u0447\u0442\u043e-\u0442\u043e \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u0431\u044b\u043b\u043e \u0443\u0436\u0435 \u043f\u043e\u0437\u0434\u043d\u043e (\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e). \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0431\u0438\u0437\u043d\u0435\u0441 \u0443\u0440\u043e\u0432\u043d\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u043c\u0441\u044f \u0432 20 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430\u0445. \u041d\u0430 \u0421++. \u041f\u043e\u0434 \u0432\u0438\u043d\u0434\u0443 \u0438 \u043b\u0438\u043d\u0443\u043a\u0441. 20 \u0442\u0430\u0431\u043b\u0438\u0447\u0435\u043a \u0432 \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u0435 \u0438\u043b\u0438 \u041e\u0440\u0430\u043a\u043b\u0435. \u00ab\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0431\u0438\u0437\u043d\u0435\u0441 \u0443\u0440\u043e\u0432\u043d\u044f\u00bb \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u044d\u0432\u0444\u0435\u043c\u0438\u0437\u043c \u043a \u0442\u0443\u043f\u0435\u0439\u0448\u0435\u043c\u0443 \u043d\u0430\u0431\u043e\u0440\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u0435\u0439, \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438.<br \/>  \u041a \u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u044f \u0443\u0436\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e! \u042d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0443\u043d\u044b\u043b\u043e\u0441\u0442\u0438 \u043f\u043e\u0431\u0438\u043b\u0430 \u0432\u0441\u0435 \u0440\u0435\u043a\u043e\u0440\u0434\u044b. \u0412 \u043e\u0434\u043d\u043e\u0447\u0430\u0441\u044c\u0435 \u044f \u043f\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u0435\u0431\u044f \u0432 \u0448\u043a\u0443\u0440\u0435 \u0442\u0435\u0445 \u043b\u044e\u0434\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430, \u0438 \u043c\u0435\u043d\u044f \u044d\u0442\u043e, \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e, \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432\u043e\u043e\u0434\u0443\u0448\u0435\u0432\u043b\u044f\u043b\u043e. \u041d\u0430 \u044d\u0442\u043e\u043c \u0444\u043e\u043d\u0435 \u0443 \u043c\u043e\u0438\u0445 \u043a\u043e\u043b\u043b\u0435\u0433 \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e \u2014 \u043e\u043d\u0438, \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c, \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u043b\u0438 \u043a\u0443\u0447\u0443 \u0421++(\u0421) \u043b\u0438\u0431 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0438\u0445 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0411\u0414 \u0438 \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445, \u0432\u043e\u043f\u0440\u0435\u043a\u0438 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u044f\u043c, \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u041e\u0440\u0430\u043a\u043b\u043e\u043c \u0438 \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u043e\u043c.<\/p>\n<h1>\u0418\u0434\u0435\u044f<\/h1>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/552\/d72\/9bc\/552d729bcf6ff980768266aecec53f6a.jpg\"\/><br \/>  \u0423\u0431\u0435\u0436\u0434\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0443\u043f\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u044f, \u043f\u043e\u0442\u0438\u0445\u043e\u043d\u044c\u043a\u0443 \u043f\u043e\u0434\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0430 \u043c\u0435\u043d\u044f \u043a \u043c\u044b\u0441\u043b\u0438, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u043d\u0430 \u043a\u043e\u0433\u043e-\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u0441\u0432\u0430\u043b\u0438\u0442\u044c. \u0418\u0437 \u043c\u043e\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u0443\u0447\u0430\u0441\u0442\u044c\u044e \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440, \u0442\u0430\u043a \u0447\u0442\u043e, \u0432 \u0438\u0442\u043e\u0433\u0435, \u0435\u043c\u0443 \u0432\u044b\u043f\u0430\u043b\u0430 \u0447\u0435\u0441\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u0434. \u041d\u0430\u043f\u0440\u044f\u0433\u0430\u043b\u043e \u0432\u043e \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u0437\u0430\u0442\u0435\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0435 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043c\u0443\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043e \u0447\u0435\u043c-\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u043c \u0438 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u043c. \u0418\u0437 \u0438\u043d\u043a\u0443\u0431\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0438\u0434\u0435\u044e \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0432\u044b\u0432\u0435\u043b\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0432\u043e\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043e \u0434\u0435\u0431\u0443\u0433\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u044d\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 JSP, \u0431\u0438\u043d\u0430\u043c\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u043c \u0443\u0436\u0430\u0441\u043e\u043c \u043b\u0435\u0442\u044f\u0449\u0438\u043c \u043d\u0430 \u043a\u0440\u044b\u043b\u044c\u044f\u0445 \u043d\u043e\u0447\u0438. \u0414\u0435\u0431\u0443\u0433\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043c\u043d\u0435 \u043a\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u0441\u044f \u0438\u0437 JSP (java server pages) \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0437 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438:  <\/p>\n<pre><code class=\"html\">&lt;ul&gt; &lt;% for (int i = 0; i &lt; 10; i++) { %&gt;   &lt;li&gt; &lt;%= i %&gt; &lt;% } %&gt; &lt;\/ul&gt; <\/code><\/pre>\n<p>  \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"java\">out.println(&quot;&lt;ul&gt;&quot;); for (int i = 0; i &lt; 10; i++) {   out.print(&quot;&lt;li&gt;&quot;);   out.print(i);   out.println(); } out.println(&quot;&lt;\/ul&gt;&quot;); <\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 JSP \u043a\u043e\u0434\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0433\u0435\u043d\u0435\u0440\u0438\u0442 HTML \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442, \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u0432\u0441\u0435, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 &lt;% %&gt; \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u043c, \u0430 \u0432\u0441\u0435, \u0447\u0442\u043e \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 out.print(&quot;&lt;\u0442\u0435\u043a\u0441\u0442&gt;&quot;), \u043d\u0443 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0430\u0445\u0430\u0440\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c HTML \u043d\u0430 \u0421++, \u0430 \u0436\u0430\u0432\u0443 \u043d\u0430 \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435 \u0438, \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 C++ \u043a\u043e\u0434. \u00ab\u0427\u0442\u043e-\u0442\u043e \u0435\u0449\u0435\u00bb \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u044f \u2014 windows scripting host \u0443\u0436\u0435 \u0431\u044b\u043b \u043d\u0430 \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u043b\u0434 \u043c\u0430\u0448\u0438\u043d\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c java script (\u0438\u043b\u0438 ECMAScript, \u043a\u0430\u043a \u0435\u0433\u043e \u0442\u0430\u043c).<\/p>\n<h1>\u041f\u0440\u043e\u0442\u043e\u0442\u0438\u043f<\/h1>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u00ab\u0431\u043b\u0438\u0437\u043a\u043e\u0435 \u043a \u0442\u0435\u043a\u0441\u0442\u0443\u00bb \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u2014 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0443\u0436\u0435 \u0441\u0442\u0435\u0440\u043b\u043e\u0441\u044c \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438. \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0411\u0414 \u0443 \u043d\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043a\u0438\u0434\u0430\u0442\u044c \u0443\u044e\u0442\u043d\u044b\u0439 \u043b\u0438\u043d\u0443\u0445 \u044d\u043d\u0432\u0430\u0439\u0440\u043c\u0435\u043d\u0442 windows scripting host \u0442\u043e\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0443\u044e \u0442\u0438\u043f\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u043a\u0443 \u0441 Employee, Department etc.<br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 standalone \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 JS \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0439 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u2014 rhino (\u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e v8 \u0431\u044b\u043b \u0432\u0442\u043e\u0440\u044b\u043c). \u0418\u0442\u0430\u043a, \u0441\u0442\u0430\u0432\u0438\u043c rhino, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b codegen.js, \u043f\u0438\u0448\u0435\u043c \u0442\u0443\u0434\u0430 print(2*2); rhino codegen.js: 4, voila!  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">codegen.js<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">if (arguments.length &lt; 1) {   print(&quot;Usage: codegen.js &lt;template&gt;&quot;);   quit(); }   function produce_text(text) {   return &quot;__codegen_output += '&quot; + text.replace(&quot;'&quot;, &quot;\\\\'&quot;, 'g').replace('\\n', '\\\\n', 'g').replace('\\r', '\\\\r', 'g').replace('\\t', '\\\\t', 'g') + &quot;';\\n&quot;; }   function produce_code(code) {   if (code[0] == '=')   {     return '__codegen_output += ' + code.substr(1) + ';\\n';   }   return code + '\\n'; }   remainder = readFile(arguments[0]); var code = 'var __codegen_output = &quot;&quot;; '; while (remainder.length) {   var begin = remainder.indexOf('&lt;%');   if (begin &gt;= 0)   {     code += produce_text(remainder.substr(0, begin));     remainder = remainder.substr(begin + 2);     var end = remainder.indexOf('%&gt;');     if (end &gt;= 0)     {       code += produce_code(remainder.substr(0, end));       remainder = remainder.substr(end + 2);     }     else     {       code += produce_code(remainder);       remainder = '';     }   }   else   {     code += produce_text(remainder);     remainder = '';   } } code += 'print(__codegen_output);'   eval(code); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p> \u2014 \u0442\u0443\u043f\u0435\u0439\u0448\u0430\u044f, \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u2014 50 \u0441\u0442\u0440\u043e\u043a \u2014 \u0432\u0435\u0441\u044c \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440. \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c:<br \/>  \u0444\u0430\u0439\u043b template:  <\/p>\n<pre><code>&lt;% var className = 'MyClass'; var fields = ['Name', 'Description', 'AnotherOne', 'LastOne']; %&gt;  class &lt;%= className %&gt; {   private:   &lt;% for(var i = 0; i &lt; fields.length; i++) { %&gt;     int &lt;%= fields[i] %&gt;;   &lt;% } %&gt; }; <\/code><\/pre>\n<pre>rhino codegen.js tempalte:<\/pre>\n<p>  <\/p>\n<pre><code>class MyClass {   private:      int Name;      int Description;      int AnotherOne;      int LastOne;  }; <\/code><\/pre>\n<p>  \u0412 &lt;% %&gt; \u0443 \u043d\u0430\u0441 \u043b\u044e\u0431\u043e\u0439 js \u043a\u043e\u0434, &lt;%= expr %&gt; \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f expr. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u2014 \u044d\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e, \u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0438\u043c\u0435\u0435\u0442 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u2014 \u043a\u043e\u0434 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0442\u043d\u044b\u0439 \u0438 \u0431\u0435\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e. \u041d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0441\u043a\u0440\u0438\u043f\u043a\u0443 \u0432 \u044d\u0442\u043e\u043c \u0438\u0433\u0440\u0430\u0435\u0442 \u0441\u0430\u043c JS \u2014 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u043d \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435.<br \/>  \u0444\u0430\u0439\u043b template:  <\/p>\n<pre><code class=\"javascript\">&lt;% var model = [   {     name: 'Employee',     fields: {       Id: { type: 'int' },       Name: { type: 'string' }     }   } ];  var cppTypeMap = {   'int': 'int',   'string': 'std::string' }; %&gt;  &lt;% for (var i = 0; i &lt; model.length; i++)    {      var entity = model[i];%&gt;      struct &lt;%= entity.name %&gt; {   &lt;% for (var field in entity.fields)      { %&gt;   &lt;%= cppTypeMap[entity.fields[field].type] %&gt; &lt;%= field %&gt;;   &lt;% } %&gt; }; &lt;% } %&gt; <\/code><\/pre>\n<pre>rhino codegen.js template:<\/pre>\n<p>  <\/p>\n<pre><code>struct Employee {    int Id;    std::string Name;  }; <\/code><\/pre>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 model \u044d\u0442\u043e, \u043f\u043e \u0441\u0443\u0442\u0438, \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 DSL (domain specific language). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0435\u043d \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0433\u043e \u0432\u0441\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c.  <\/p>\n<pre><code class=\"javascript\">var model = [   {     name: 'Department',     fields: {       Id: { type: 'int' },       Name: { type: 'string'}     },     primaryKey: 'Id'   },   {     name: 'Employee',     fields: {       Id: { type: 'int' },       Name: { type: 'string' },       DepartmentId: { type: 'int', references: 'Department' }     },     primaryKey: 'Id'   } ]; <\/code><\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0437 \u0411\u0414 \u043f\u043e \u043a\u043b\u044e\u0447\u0443, \u043f\u043e \u0441\u0432\u044f\u0437\u043d\u044b\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c \u0438 \u0442.\u0434. \u0422\u0430\u043a\u0436\u0435 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c sql \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043a\u043e\u0434: <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">model<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">var model = [   {     name: 'Department',     fields: {       Id: { type: 'int' },       Name: { type: 'string'}     },     primaryKey: 'Id'   },   {     name: 'Employee',     fields: {       Id: { type: 'int' },       Name: { type: 'string' },       DepartmentId: { type: 'int', references: 'Department' }     },     primaryKey: 'Id'   } ]; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448 DSL, <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">cpp.template<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">&lt;%   load('model');   var cppTypeMap = {   'int': 'int',   'string': 'std::string' };     function fieldType(entity, field) {   return cppTypeMap[entity.fields[field].type]; }   %&gt;   &lt;% for (var i = 0; i &lt; model.length; i++)    {       var entity = model[i];%&gt; struct &lt;%= entity.name %&gt; {   &lt;% for (var field in entity.fields)      { %&gt;   &lt;%= fieldType(entity, field) %&gt; &lt;%= field %&gt;;   &lt;% } %&gt;   &lt;% var fieldList = [];      for (var field in entity.fields)        fieldList.push(field);   %&gt;   static &lt;%= entity.name %&gt; ByKey(&lt;%= fieldType(entity, entity.primaryKey) %&gt; key, pqxx::work& tr)   {     if (!tr.prepared(&quot;&lt;%= entity.name %&gt;ByKey&quot;).exists())     {       tr.conn().prepare(&quot;&lt;%= entity.name %&gt;ByKey&quot;,          &quot;select &lt;%= fieldList.join() %&gt; from &lt;%= entity.name %&gt; where &lt;%= entity.primaryKey %&gt; = $1&quot;);     }     pqxx::result rows = tr.prepared(&quot;&lt;%= entity.name %&gt;ByKey&quot;)(key).exec(query);     &lt;%= entity.name %&gt; result;     &lt;% for (var j = 0; j &lt; fieldList.length; j++)        { %&gt;     result.&lt;%= fieldList[j] %&gt; = rows[0][&lt;%= j %&gt;].as&lt;&lt;%= fieldType(entity, fieldList[j]) %&gt;&gt;();     &lt;% } %&gt;     return result;   }     &lt;% for (var field in entity.fields)        if (entity.fields[field].references)        {           var ref = entity.fields[field].references; %&gt;   &lt;%= ref %&gt; Get&lt;%= ref %&gt;()   {     return &lt;%= ref %&gt;::ByKey(&lt;%= field %&gt;);   }     static std::vector&lt;&lt;%= entity.name %&gt;&gt; By&lt;%= ref %&gt;(&lt;%= fieldType(entity, field) %&gt; key)   {     if (!tr.prepared(&quot;&lt;%= entity.name %&gt;By&lt;%= ref %&gt;&quot;).exists())     {       tr.conn().prepare(&quot;&lt;%= entity.name %&gt;By&lt;%= ref %&gt;&quot;,          &quot;select &lt;%= fieldList.join() %&gt; from &lt;%= entity.name %&gt; where &lt;%= field %&gt; = $1&quot;);     }     pqxx::result rows = tr.prepared(&quot;&lt;%= entity.name %&gt;By&lt;%= ref %&gt;&quot;)(key).exec(query);     std::vector&lt;&lt;%= entity.name %&gt;&gt; result;     for (pqxx::result::size_type i = 0; i &lt; rows.size(); i++)     {       &lt;%= entity.name %&gt; row;     &lt;% for (var j = 0; j &lt; fieldList.length; j++)        { %&gt;       row.&lt;%= fieldList[j] %&gt; = rows[i][&lt;%= j %&gt;].as&lt;&lt;%= fieldType(entity, fieldList[j]) %&gt;&gt;();     &lt;% } %&gt;       result.push_back(row);     }     return result;   }   &lt;%   } %&gt; }; &lt;% } %&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p> \u2014 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043b\u044e\u0441\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">sql.template<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">&lt;%   load('model');   var sqlTypeMap = {   'int': 'integer',   'string': 'text' };     function fieldType(entity, field) {   return sqlTypeMap[entity.fields[field].type]; }   %&gt;   &lt;% for (var i = 0; i &lt; model.length; i++)    {       var entity = model[i];%&gt; CREATE TABLE &lt;%= entity.name %&gt; (   &lt;% for (var field in entity.fields)      {        var ref = entity.fields[field].references; %&gt;   &lt;%= field %&gt; &lt;%= fieldType(entity, field) %&gt;&lt;% if (ref) { %&gt; REFERENCES &lt;%= ref %&gt;&lt;% } %&gt;,   &lt;% } %&gt;   PRIMARY KEY (&lt;%= entity.primaryKey %&gt;) ); &lt;% } %&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p> \u2014 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0411\u0414.<\/p>\n<pre>rhino codegen.js cpp.template:<\/pre>\n<p>  <\/p>\n<pre><code>struct Department {      int Id;      std::string Name;         static Department ByKey(int key, pqxx::work& tr)   {     if (!tr.prepared(&quot;DepartmentByKey&quot;).exists())     {       tr.conn().prepare(&quot;DepartmentByKey&quot;,          &quot;select Id,Name from Department where Id = $1&quot;);     }     pqxx::result rows = tr.prepared(&quot;DepartmentByKey&quot;)(key).exec(query);     Department result;          result.Id = rows[0][0].as&lt;int&gt;();          result.Name = rows[0][1].as&lt;std::string&gt;();          return result;   }     };  struct Employee {      int Id;      std::string Name;      int DepartmentId;         static Employee ByKey(int key, pqxx::work& tr)   {     if (!tr.prepared(&quot;EmployeeByKey&quot;).exists())     {       tr.conn().prepare(&quot;EmployeeByKey&quot;,          &quot;select Id,Name,DepartmentId from Employee where Id = $1&quot;);     }     pqxx::result rows = tr.prepared(&quot;EmployeeByKey&quot;)(key).exec(query);     Employee result;          result.Id = rows[0][0].as&lt;int&gt;();          result.Name = rows[0][1].as&lt;std::string&gt;();          result.DepartmentId = rows[0][2].as&lt;int&gt;();          return result;   }       Department GetDepartment()   {     return Department::ByKey(DepartmentId);   }    static std::vector&lt;Employee&gt; ByDepartment(int key)   {     if (!tr.prepared(&quot;EmployeeByDepartment&quot;).exists())     {       tr.conn().prepare(&quot;EmployeeByDepartment&quot;,          &quot;select Id,Name,DepartmentId from Employee where DepartmentId = $1&quot;);     }     pqxx::result rows = tr.prepared(&quot;EmployeeByDepartment&quot;)(key).exec(query);     std::vector&lt;Employee&gt; result;     for (pqxx::result::size_type i = 0; i &lt; rows.size(); i++)     {       Employee row;            row.Id = rows[i][0].as&lt;int&gt;();            row.Name = rows[i][1].as&lt;std::string&gt;();            row.DepartmentId = rows[i][2].as&lt;int&gt;();            result.push_back(row);     }     return result;   }    }; <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u0447\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u0438 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b, \u043d\u043e \u043e\u0431\u0435\u0449\u0430\u044e, \u0447\u0442\u043e \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043e\u043a \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u043c\u0443 \u0441 \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u043e\u043c. \ud83d\ude42<\/p>\n<pre>rhino codegen.js sql.template:<\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">CREATE TABLE Department (      Id integer,      Name text,      PRIMARY KEY (Id) );  CREATE TABLE Employee (      Id integer,      Name text,      DepartmentId integer REFERENCES Department,      PRIMARY KEY (Id) ); <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445, \u044f \u0434\u0443\u043c\u0430\u044e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u044f \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b. \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e ORM&#8217;\u043e\u0432 \u0443\u043c\u0435\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u044f\u0437\u044b\u043a, \u043f\u0443\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c DSL, \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u042d\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0442\u0430\u043a \u0441\u0442\u0440\u0430\u0448\u043d\u043e, \u043a\u0430\u043a \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u044d\u0442\u0430\u043f\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043b\u0438 \u043d\u0430 \u043f\u0430\u0440\u0441\u0435\u0440\u0435 \u2014 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0435\u043b\u0430\u0435\u0442 JS \u0434\u0432\u0438\u0436\u043e\u043a, \u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435 \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u043f\u043b\u044e\u0441\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439, \u0430 \u0442\u044f\u0436\u0435\u0441\u0442\u0438 \u043f\u0443\u0441\u0442\u044c \u0442\u0430\u0441\u043a\u0430\u0435\u0442 \u043f\u043b\u044e\u0441\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/acronis\/blog\/199012\/\"> http:\/\/habrahabr.ru\/company\/acronis\/blog\/199012\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0421 \u0434\u043e\u0431\u0440\u044b\u043c \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u043e\u043c, \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>  \u041a\u043e\u0432\u044b\u0440\u044f\u043b\u0441\u044f \u0434\u0430\u0432\u0435\u0447\u0430 \u0441 \u043e\u0434\u043d\u0438\u043c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c, \u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0434\u043e \u043d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043c\u043e\u0449\u043d\u044b\u043c, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0430 Python-\u0435. \u041d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u043d\u0430\u044f \u043c\u043e\u0449\u044c \u0432\u044b\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043a\u0440\u0430\u0439\u043d\u0435 \u044d\u043a\u0441\u0442\u0440\u0430\u0432\u0430\u0433\u0430\u043d\u0442\u043d\u044b\u0435 \u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 5% \u0441\u043b\u0443\u0447\u0430\u0435\u0432. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043f\u0430\u0447\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0434\u0430\u0436\u0435 \u0432 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0441\u0441\u0438\u043c\u0438\u0437\u043c \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0447\u0435\u043c-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c. \u0418 \u0442\u0443\u0442 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b\u0430\u0441\u044c \u043c\u043d\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0438\u0437 \u043c\u043e\u0435\u0433\u043e \u0434\u0430\u043b\u0435\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u0434\u0435\u043b\u044e\u0441\u044c.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-199012","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/199012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=199012"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/199012\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}