{"id":348216,"date":"2023-06-01T09:00:16","date_gmt":"2023-06-01T09:00:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=348216"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=348216","title":{"rendered":"<span>\u0425\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u0440\u0430\u0431\u043b\u044f\u043c PDO: \u0447\u0442\u043e \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 PHP ORM<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u043b\u0435\u0440\u0438\u0439 \u0413\u043e\u0440\u0431\u0430\u0447\u0435\u0432. \u0414\u0430\u0432\u043d\u043e \u043f\u0438\u0448\u0443 \u043d\u0430 PHP, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u043e\u043c (\u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 <a href=\"https:\/\/yiiframework.com\"><u>Yii3 Framework<\/u><\/a>), \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u044e \u043c\u0438\u0442\u0430\u043f\u044b \u0432 \u0440\u043e\u0434\u043d\u043e\u043c \u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440\u0435 \u0438 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044e \u0441 \u0434\u043e\u043a\u043b\u0430\u0434\u0430\u043c\u0438 \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f\u0445.&nbsp;<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0435\u0433\u043e \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u043d\u0430 HighLoad++ 2022. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441\u0442\u0430\u0440\u0448\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0432 Delivery Club.&nbsp;<\/p>\n<p>\u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0442\u043e\u043c, \u043e \u0447\u0451\u043c \u0437\u043d\u0430\u044e \u0441\u0430\u043c. \u0423 \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u2014 \u0441\u0432\u044f\u0436\u0438\u0442\u0435\u0441\u044c \u0441\u043e \u043c\u043d\u043e\u0439.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/03e\/42c\/212\/03e42c212da64959834850205ce3996d.jpeg\" alt=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 Midjourney\" title=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 Midjourney\" width=\"780\" height=\"440\"><\/p>\n<div><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 Midjourney<\/figcaption><\/div>\n<\/figure>\n<h3>\u041a\u0430\u043a \u044f \u0438\u0437\u0443\u0447\u0430\u043b \u0411\u0414 \u0438 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u043e\u0440\u0430 \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c<\/h3>\n<p>\u0412\u0441\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441\u0442\u0430\u0434\u0438\u0438 \u043e\u0442\u0440\u0438\u0446\u0430\u043d\u0438\u044f, \u0433\u043d\u0435\u0432\u0430, \u0434\u0435\u043f\u0440\u0435\u0441\u0441\u0438\u0438\u2026 \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0411\u0414). \u0412 \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0436\u0435, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u043d\u043a\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445;<\/p>\n<\/li>\n<li>\n<p>\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0411\u0414 (dbf, dBase IV);<\/p>\n<\/li>\n<li>\n<p>\u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 SQL (\u043a\u043d\u0438\u0433\u0438, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f).<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0441 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u043b \u0432 \u0444\u0430\u0439\u043b\u0430\u0445. \u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0448\u0451\u043b \u043d\u0430 dbf, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0448\u0451\u043b \u043a SQL \u0438 \u043d\u0430\u0447\u0430\u043b \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043d\u0438\u0433\u0438 \u0438 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u044d\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u042f \u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a\u0438\u0435 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<pre><code class=\"php\">$sql = \"SELECT * FROM products WHERE id = {$id}\"<\/code><\/pre>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u00ab\u0438\u043d\u0442\u0432\u0430\u043b\u0438\u043b\u00bb, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<pre><code class=\"php\">$sql = 'SELECT * FROM products WHERE id = ' . @intval($id);<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u043b \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">$sql = \"SELECT * FROM products WHERE name = '{$name}'\";<\/code><\/pre>\n<p>\u0410 \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0432\u0437\u043b\u043e\u043c\u0430\u043b\u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0443\u0437\u043d\u0430\u043b \u043f\u0440\u043e SQL-\u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0422\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u043f\u043b\u044e\u0441 \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b\u0441\u044f \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438 \u0438 \u0441\u0442\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"php\">$name = mysql_real_escape_string($name); $sql = \"SELECT * FROM products WHERE name = '\". $name. \"'\";<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c mysql_ \u0437\u0430\u0434\u0435\u043f\u0440\u0435\u043a\u0435\u0439\u0442\u0438\u043b\u0438, \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u0438 \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445:<\/p>\n<pre><code class=\"php\">$stmt = $mysqli-&gt;prepare(\"SELECT * FROM products WHERE name = ?\"); $stmt-&gt;bind_param(\"s\", $name);<\/code><\/pre>\n<h3>\u041a\u0430\u043a \u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 PHP<\/h3>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e \u0433\u043e\u0434\u0430\u043c.<\/p>\n<ul>\n<li>\n<p>PHP 5.0 \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 ext\/mysqli (2003).<\/p>\n<\/li>\n<li>\n<p>PHP 5.1 \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f PDO_MySQL (2005).<\/p>\n<\/li>\n<li>\n<p>PHP 5.3 \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 mysqlnd \u0441 \u0440\u044f\u0434\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0443\u0445\u043e\u0434\u043e\u043c \u043e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 Oracle (2009).<\/p>\n<\/li>\n<li>\n<p>PHP 5.* \u2014 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 libmysqlclient (C++, Oracle) \u043d\u0430 mysqlnd (2013).<\/p>\n<\/li>\n<li>\n<p>PHP 5.5 \u2014 \u043c\u043e\u0434\u0443\u043b\u044c mysql_* \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c \u0438 \u0443\u0434\u0430\u043b\u0451\u043d \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 7 (2013).<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u043e\u0433\u0434\u0430 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f, \u0447\u0442\u043e \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u043e\u0440\u0430 \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c. \u041f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u0441\u0442\u0430\u043b \u0432\u044b\u0431\u043e\u0440: \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 MySQLi \u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PDO.&nbsp;<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f63\/82d\/cc8\/f6382dcc8690c30d8cfef10367afc784.png\" alt=\"\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 MySQLi \u0438 PDO_MySQL\" title=\"\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 MySQLi \u0438 PDO_MySQL\" width=\"1281\" height=\"558\"><\/p>\n<div><figcaption>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 MySQLi \u0438 PDO_MySQL<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 MySQLi \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u044b\u0435, \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0443\u043a\u0432\u0443 i, \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u043a\u043e\u0434\u0443 \u0438 \u0432\u0441\u0451 \u0441\u0442\u0430\u043b\u043e \u0431\u044b \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044f \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b \u0438 \u0444\u0440\u0430\u0437\u0443 \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0444\u043e\u0440\u0443\u043c\u043e\u0432:<\/p>\n<p><em>\u00ab\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f PDO, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u0421\u0423\u0411\u0414\u00bb<\/em><\/p>\n<h3>\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f\u2026<\/h3>\n<p>\u042f \u0436\u0438\u043b \u0432 \u043c\u0438\u0440\u0435 \u0440\u043e\u0437\u043e\u0432\u044b\u0445 \u043f\u043e\u043d\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b ORM, QueryBuilder\u2019\u044b \u0438 \u0434\u0435\u043b\u0430\u043b \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">$userQuery = (new Query())-&gt;select('id')-&gt;from('user');<\/code><\/pre>\n<p>\u041d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0434\u0430\u0436\u0435 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b MySQLi \u0441 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u043e\u043c:<\/p>\n<pre><code class=\"php\">$stmt-&gt;bind_param(\"ssssiisississ\", $name, $title, ...);<\/code><\/pre>\n<p>\u041d\u043e \u0432 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0431\u0443\u043a\u0432 \u201cs\u201d, \u201ci\u201d. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u0438\u043d\u0434\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443. \u0414\u0440\u0443\u0433\u043e\u0435 \u0434\u0435\u043b\u043e ORM.<\/p>\n<h3>ORM \u2014 \u043b\u0435\u043a\u0430\u0440\u0441\u0442\u0432\u043e \u043e\u0442 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c?<\/h3>\n<p>\u0423 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ORM \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u0434 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0438 \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043d\u0443\u0436\u0434\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u00ab\u0441\u044b\u0440\u044b\u0435\u00bb \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0432\u0435\u0434\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c QueryBuilder.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043d\u0438\u0436\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0442\u044c SQL.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0434\u0432\u0438\u0436\u043a\u0443 \u0411\u0414.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u0430\u043a\u0438\u0445 ORM: Eloquent, Doctrine, Cycle, Propel, RedBeanPHP, Yii DB \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u043e \u0443 ORM, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u043f\u044b\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u0439 \u0438\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ORM \u043e\u0442 Yii Framework \u0432\u0435\u0440\u0441\u0438\u0439 1 \u0438 2.<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u0442 \u0442\u043e\u0439 \u0436\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u00ab\u0441\u044b\u0440\u044b\u0445\u00bb \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0443\u0434\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u042d\u0442\u043e \u0436\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0440\u0430\u0434\u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0447\u0443\u0436\u043e\u0439 \u043a\u043e\u0434 \u0438 \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u00ab\u0442\u0430\u043a \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c\u00bb \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p>MySQL-first-\u043f\u043e\u0434\u0445\u043e\u0434 \u043a\u0430\u043a \u0441\u0430\u043c\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0431\u043e\u043b\u044c \u2014 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0443\u0441\u0442\u0430\u0440\u0435\u043b. \u041a\u043e\u0433\u0434\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 ORM, \u0431\u044b\u043b\u043e \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0441 MySQL, \u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0411\u0414 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u00ab\u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a \u0432 MySQL\u00bb.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0425\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u0440\u0430\u0431\u043b\u044f\u043c \u043a\u0430\u043a \u0441\u0442\u0438\u043b\u044c \u0436\u0438\u0437\u043d\u0438<\/h3>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435: \u043c\u043d\u0435 \u043c\u0435\u0448\u0430\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ORM \u0432\u0441\u044e \u0436\u0438\u0437\u043d\u044c.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0411\u0414 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 API, \u0438 \u043f\u0440\u043e ORM \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0437\u0430\u0431\u044b\u0442\u044c. \u041f\u0438\u0441\u0430\u043b\u0438 \u0441\u044b\u0440\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 API-\u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<p>\u041d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0445 \u044f \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f MySQL, MSSQL, PostgreSQL, Oracle \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043c\u0435\u043d\u044f \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443: \u044f \u043e\u0441\u043e\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0432\u0435\u0441\u044c \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0435\u043d. \u0410 \u0433\u0434\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u044f \u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 <a href=\"https:\/\/github.com\/terabytesoftw\"><u>Wilmer Arambula<\/u><\/a>, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043c <a href=\"https:\/\/github.com\/yiisoft\/db\"><u>Yii Database Library<\/u><\/a>. \u0410 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043b\u0435\u0436\u0438\u0442 PDO\u2026<\/p>\n<h3>\u0421\u043a\u0443\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/h3>\n<p>PDO \u0441 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u0430\u043c\u0438 \u2014 \u043f\u0443\u0442\u044c \u043a \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0412 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 PDO \u043d\u0435\u0442 \u043c\u0430\u0433\u0438\u0438, \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"php\">\/* \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0435\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 *\/ $sql = 'SELECT name, colour, calories FROM fruit WHERE calories &lt; :calories AND colour = :colour'; $sth = $dbh-&gt;prepare($sql, ['calories' =&gt; 150, 'colour' =&gt; 'red']); $sth-&gt;execute(); $red = $sth-&gt;fetchAll();<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: \u0432 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u044b \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u2014 \u0432\u0441\u0451 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PDO \u043f\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u0411\u0414 \u0437\u0430\u0448\u043a\u0430\u043b\u0438\u0432\u0430\u044e\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6c7\/265\/a91\/6c7265a91e58aabee4935603c6ebb5d8.png\" width=\"999\" height=\"660\"><\/figure>\n<p>\u0416\u0451\u043b\u0442\u044b\u043c \u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u0438\u043b \u0442\u043e, \u0441 \u0447\u0435\u043c \u0441\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438\u0437 PHP. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 PDO_ODBC \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u043b\u0438 \u0432 \u0411\u0414 \u0438 \u0447\u0435\u0440\u0435\u0437 PDO_ODBC.&nbsp;<\/p>\n<p>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u043e\u0431 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 DBMS \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c PDO. \u042f \u0432\u0435\u0434\u044c \u0435\u0449\u0451 \u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e PDO \u043e\u0431\u0435\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u0440\u043e\u0431\u0430\u0445 \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0434\u0435\u0442\u0430\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0440\u043e\u0437\u043d\u044c (LIMIT 10 OFFSET 10 vs LIMIT 10, 10).<\/p>\n<\/li>\n<li>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442, \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 SQL \u0442\u043e\u0436\u0435 \u043d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0431\u044b\u0432\u0430\u0435\u0442, \u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e&#8230;<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0449\u0451 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u2014 \u044d\u0442\u043e \u043e\u0431\u0438\u043b\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 PDO.<\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0435\u0436\u0438\u043c \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 FETCH_ASSOC \u0438\u043b\u0438 FETCH_OBJ:<\/p>\n<pre><code class=\"php\">$sth = $dbh-&gt;prepare(\"SELECT name, colour FROM fruit\"); $sth-&gt;execute();  \/* \u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0441\u0442\u0440\u043e\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 *\/ print(\"\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0441\u0442\u0440\u043e\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430:\\n\"); $result = $sth-&gt;fetchAll(); print_r($result);<\/code><\/pre>\n<p>\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043b\u0438 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0432\u0441\u0451. \u041d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432. <\/p>\n<h4>FETCH_KEY_PAIR<\/h4>\n<pre><code class=\"php\">SELECT `username`, `email` FROM `users`  \/* [     'login1' =&gt; 'email1@mail.ru',     'login2' =&gt; 'email2@mail.ru', ] *\/<\/code><\/pre>\n<p>\u0420\u0435\u0436\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 \u0441\u0442\u0438\u043b\u0435 &#171;Key-value&#187; \u0441\u043b\u0435\u0434\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043a\u043b\u044e\u0447, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<h4>FETCH_UNIQUE<\/h4>\n<pre><code class=\"php\">SELECT `id`, `username`, `email` FROM `users`  \/* [   1 =&gt; ['username' =&gt; 'login101', 'email' =&gt; 'email1@mail.ru', ],   2 =&gt; ['username' =&gt; 'login102', 'email' =&gt; 'email2@mail.ru', ], ] *\/<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043a\u0430\u043a \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0434\u043d\u043e, \u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.&nbsp;<\/p>\n<h4>FETCH_GROUP<\/h4>\n<pre><code class=\"php\">SELECT `group`, `id`, `username` FROM `users`  \/* [     'reader' =&gt; [         ['id' =&gt; 1, 'username' =&gt; 'login101'],         ['id' =&gt; 3, 'username' =&gt; 'login103'],     ],     'writer' =&gt; [         ['id' =&gt; 2, 'username' =&gt; 'login102'],         ['id' =&gt; 4, 'username' =&gt; 'login104'],     ], ] *\/<\/code><\/pre>\n<p>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0432\u0443\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043c\u0435\u043d\u044e.&nbsp;<\/p>\n<h4>FETCH_NAMED<\/h4>\n<p>FETCH_NAMED \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e FETCH_ASSOC, \u0435\u0441\u043b\u0438 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"php\">SELECT u.`name`, u.`email`, g.`name`   FROM `users` u   INNER JOIN `groups` g ON g.`id` = u.`group_id`  $stmt-&gt;fetch(PDO::FETCH_NAMED); \/* [     'name' =&gt; [         0 =&gt; 'login101',         1 =&gt; 'writer',     ],     'email' =&gt; 'email1@mail.ru', ] *\/<\/code><\/pre>\n<p>\u0418\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 SELECT *, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JOIN \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439 \u0441\u043e\u0432\u043f\u0430\u043b\u0438. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f FETCH_NAMED \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438. <\/p>\n<p><em>\u041d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SELECT *, \u043d\u043e \u0432 \u0436\u0438\u0437\u043d\u0438 \u0432\u0441\u044f\u043a\u043e\u0435 \u0431\u044b\u0432\u0430\u0435\u0442.<\/em><\/p>\n<h4>FETCH_CLASSTYPE<\/h4>\n<pre><code class=\"php\">SELECT   CONCAT(UCASE(LEFT(`group`, 1)), SUBSTRING(`group`, 2)),     `username`, `email`   FROM `users`  $stmt-&gt;fetch(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE); \/* object(Reader)#3 (1) {   [\"username\"] =&gt; string(8) \"login101\",   [\"email\"] =&gt; string(14) \"email1@mail.ru\", } *\/<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a\u0430\u043a \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 PDO \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0432 PHP, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u043c\u0430\u043f\u043f\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430.&nbsp;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0442\u043e\u0436\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u0440\u0435\u0436\u0438\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b PDO, \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/phpdelusions.net\/pdo\/fetch_modes\"><u>\u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438<\/u><\/a>.<\/p>\n<p>\u0420\u0430\u0437 \u043c\u044b \u043a\u043e\u0441\u043d\u0443\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 PHP 8.2, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043c\u043e\u0433\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 PHP 9 \u0441 \u044d\u0442\u0438\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0431\u0443\u0434\u0443\u0442 \u0435\u0449\u0451 \u0431\u00f3\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h3>\u0410 \u0435\u0441\u0442\u044c \u043b\u0438 \u0435\u0449\u0451 \u00ab\u0437\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438\u00bb?<\/h3>\n<ul>\n<li>\n<p>PDO::ATTR_ORACLE_NULLS \u2014&#187;&#187; =&gt; NULL, NULL =&gt;&#187;&#187; <br \/>\u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c NULL, \u0432\u043c\u0435\u0441\u0442\u043e NULL \u2014 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 Oracle, \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u044d\u0442\u043e \u0441 PostgreSQL \u2014 \u0442\u043e\u0436\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<ul>\n<li>\n<p>PDO::ATTR_CASE \u2014 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0438\u043c\u0451\u043d \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043a\u043b\u044e\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c, \u043d\u0438\u0436\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0438\u043b\u0438 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0438 \u0432 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 PHP \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u043e\u0432\u044b\u0435 \u0444\u043b\u0430\u0433\u0438:<\/p>\n<ul>\n<li>\n<p>MYSQL_ATTR_LOCAL_INFILE_DIRECTORY&nbsp;<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u0432\u0440\u043e\u0434\u0435 open_basedir \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"sql\">LOAD DATA LOCAL INFILE 'path\/to\/file\/file.txt'<\/code><\/pre>\n<p>\u0415\u0441\u0442\u044c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438 \u00ab\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438\u00bb:<\/p>\n<ul>\n<li>\n<p>PDO::MYSQL_ATTR_MULTI_STATEMENTS \u2014 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 SQL-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u0441\u0435 \u0431\u043e\u0440\u044e\u0442\u0441\u044f, \u0430 \u044d\u0442\u0438\u043c \u0444\u043b\u0430\u0433\u043e\u043c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c, \u043d\u043e \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u0433\u043e\u0432\u043e\u0440\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>PDO::ATTR_FETCH_CATALOG_NAMES \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0411\u0414 \u043a \u0438\u043c\u0435\u043d\u0430\u043c \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>PDO::ATTR_FETCH_TABLE_NAMES \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0435 \u0435\u0451 \u0438\u043c\u0435\u043d\u0438 \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445. \u0412 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0422\u0410\u0411\u041b\u0418\u0426\u0410.\u0418\u041c\u042f \u041f\u041e\u041b\u042f.<\/p>\n<h3>\u041f\u0440\u043e ATTR_CASE<\/h3>\n<p>\u041a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437 \u043a \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u2014 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (<a href=\"https:\/\/github.com\/yiisoft\/yii2\/issues\/18171\">https:\/\/github.com\/yiisoft\/yii2\/issues\/18171<\/a>). \u042d\u0442\u043e \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043c\u0438\u043d\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e MySQL 8.0.21. \u0420\u0430\u043d\u044c\u0448\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0441\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0432 \u0442\u043e\u043c \u0436\u0435 \u0432\u0438\u0434\u0435. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 MySQL 8.0.21 \u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u0430\u043a, \u043a\u0430\u043a \u0438\u043c\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0411\u0414. \u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u0432 INFORMATION_SCHEMA \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0434\u043b\u044f \u0438\u043c\u0451\u043d \u043a\u043e\u043b\u043e\u043d\u043e\u043a, \u0430 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u2014 \u043d\u0438\u0436\u043d\u0438\u0439.<\/p>\n<pre><code class=\"php\">SELECT `constraint_name` from `information_schema`.`key_column_usage`;  \/* MySQL &lt; 8.0.21 fields name: array(1) {   'constraint_name' =&gt; \"name_of_contraint\" }  MySQL 8.0.21 fields name: array(1) {   'CONSTRAINT_NAME' =&gt; \"name_of_contraint\" } *\/<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PDO::ATTR_CASE, \u043d\u043e \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438\u043c\u0451\u043d \u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043a \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443.<\/p>\n<h3>\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 JSON \u0432 BLOB \u043f\u043e\u043b\u044f\u0445<\/h3>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0438\u0448\u0435\u0442 Role-based access control (RBAC) \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0411\u0414 (\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u043e\u043b\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u0438 \u0442.\u043f.).<\/p>\n<pre><code class=\"php\">$sql_insert = &lt;&lt;&lt;SQL     insert into `pdo_types`(`blob_col`) values(:blob_data); SQL;  $sql_read = &lt;&lt;&lt;SQL     select `blob_col` from `pdo_types`; SQL;<\/code><\/pre>\n<p>\u041b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c JSON \u0432 \u043d\u0435\u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e BLOB-\u043f\u043e\u043b\u0435.<\/p>\n<h4>MySQL<\/h4>\n<p>\u0421 MySQL \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e (\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438):<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">$blobData = \"test `s_t_r_i_n_g`\"; $pdo-&gt;prepare($sql_insert)-&gt;execute([':blob_data' =&gt; $blobData]);<\/code><\/pre>\n<ul>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">$stmt = $pdo-&gt;query($sql_read); $result = $stmt-&gt;fetch(PDO::FETCH_COLUMN); var_dump($result);<\/code><\/pre>\n<ul>\n<li>\n<p>\u0420\u0430\u0434\u0443\u0435\u043c\u0441\u044f:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">string(18) \"test `s_t_r_i_n_g`\"<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0442\u0438\u043f\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0432\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u0438 \u0432\u0441\u0451 \u043e\u0442\u043b\u0438\u0447\u043d\u043e.<\/p>\n<h4>PostgreSQL<\/h4>\n<ul>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">$blobData = \"test `s_t_r_i_n_g`\"; $pdo-&gt;prepare($sql_insert)-&gt;execute([':blob_data' =&gt; $blobData]);<\/code><\/pre>\n<ul>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">$stmt = $pdo-&gt;query($sql_read); $result = $stmt-&gt;fetch(PDO::FETCH_COLUMN); var_dump($result);<\/code><\/pre>\n<ul>\n<li>\n<p>\u0423\u0434\u0438\u0432\u043b\u044f\u0435\u043c\u0441\u044f:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">resource(9) of type (stream)<\/code><\/pre>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u2014 \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c \u0443\u0436\u0435 \u043d\u0435 \u0441\u0442\u0440\u043e\u043a\u0430. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0434\u043b\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043e \u043a\u0430\u043a resource. \u041c\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u044d\u0442\u043e\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u044f\u0442\u044c\u0441\u044f.<\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u043e\u0442\u0438\u043a\u0438 \u2014 Oracle<\/h4>\n<p>\u0421 \u043c\u043e\u0438\u043c \u043b\u044e\u0431\u0438\u043c\u044b\u043c Oracle \u0443 \u043d\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u0430\u0436\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">$blobData = \"test `s_t_r_i_n_g`\"; $pdo-&gt;prepare($sql_insert)-&gt;execute([':blob_data' =&gt; $blobData]);<\/code><\/pre>\n<ul>\n<li>\n<p>\u0423\u0434\u0438\u0432\u043b\u044f\u0435\u043c\u0441\u044f:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1465 OCIStmtExecute: ORA-01465: invalid hex number<\/code><\/pre>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0435\u0441\u0442\u044c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u041d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u0435\u043d \u0438\u043d\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:<\/p>\n<blockquote>\n<p><em>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 Oracle \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0443. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0443 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0430\u0447\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 LOB \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0431\u0430\u0437\u0435 \u0441 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0434\u043b\u0438\u043d\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u043d\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/em><\/p>\n<\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">$sql_insert = &lt;&lt;&lt;SQL     insert into \"pdo_types\"(\"blob_col\") values(empty_blob()) returning \"blob_col\" into :blob_data SQL;  $blobData = \"test `s_t_r_i_n_g`\"; $fp = fopen('php:\/\/memory', 'rwb'); fwrite($fp, $blobData); fseek($fp, 0);  $stmt = $pdo-&gt;prepare($sql_insert); $pdo-&gt;beginTransaction();     $stmt-&gt;bindValue(':blob_data', $fp, PDO::PARAM_LOB);     $stmt-&gt;execute(); $pdo-&gt;commit();<\/code><\/pre>\n<p>\u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f PDO::PARAM_LOB. \u0412\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043e\u0434\u043d\u043e\u043c\u043e\u043c\u0435\u043d\u0442\u043d\u044b\u043c.<\/p>\n<p>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 PostgreSQL, \u0432 Oracle \u043d\u0430\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f stream.&nbsp;<\/p>\n<h4>Rewind<\/h4>\n<pre><code class=\"php\">$stmt = $pdo-&gt;query($sql_read); $handle = $stmt-&gt;fetch(PDO::FETCH_COLUMN);  $contents = ''; while (!feof($handle)) {     $contents .= fread($handle, 2); } rewind($handle); while (!feof($handle)) {     $contents .= fread($handle, 2); }<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u2014 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e rewind \u0438 fseek. \u041f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u0443\u0432\u0438\u0434\u0435\u043b: \u043e\u043d\u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0451 \u0436\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439.<\/p>\n<h3>\u0427\u0438\u043d\u0438\u043c BLOB \u043f\u043e\u043b\u044f \u0438 Oracle<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 (\u0430 \u043a\u0430\u043a \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 JSON\/base64), \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432. \u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0441\u0442\u044b\u043b\u044c \u0441 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 \u043c\u043e\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u2014 \u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 BLOB \u043f\u043e\u043b\u0435:<\/p>\n<pre><code class=\"php\">$stmt = $db-&gt;prepare(\"INSERT INTO t1(blob_col) VALUES (TO_BLOB(UTL_RAW.CAST_TO_RAW(:blob_col)))\"); $stmt-&gt;bindParam(':blob_col', $blobData);<\/code><\/pre>\n<p>\u041d\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0451 \u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044f\u0445 (base64 \u0432 CLOB, \u0430 json \u0432 JSON).<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e ID<\/h3>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0447\u0430\u0441\u0442\u043e \u0440\u0435\u0448\u0430\u0435\u043c, \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 ID \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"php\">public PDO::lastInsertId(?string $name = null): string|false<\/code><\/pre>\n<p>\u041d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u043c\u0435\u0442\u043e\u0434, \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/p>\n<blockquote>\n<p><em>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435:&nbsp;<\/em><\/p>\n<p><em>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 PDO \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0432\u044b\u0434\u0430\u0442\u044c \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0435\u0439 \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439\u00bb.<\/em><\/p>\n<\/blockquote>\n<p>\u041d\u0435 \u0432\u0441\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u044b \u044d\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Microsoft SQL Server. \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443 \u0434\u0430\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u043e <a href=\"https:\/\/stackoverflow.com\/questions\/13747481\/pdo-lastinsertid-not-working-for-ms-sql\"><u>Stackoverflow<\/u><\/a>:<\/p>\n<blockquote>\n<p><em>I am running an insert query using PDO and then getting the newly created Id with lastInsertId(). This is all working on my localhost environment. When I move the exact same code onto a server, the lastInsertId() is always returning blank, even though the insert statement works and inserts the new row into the database.<\/em><\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430? \u041e\u0442\u0432\u0435\u0442 \u0435\u0441\u0442\u044c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<blockquote>\n<p><em>Remarks: <\/em><\/p>\n<p><em>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 PDO \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 2.0 \u0414\u0440\u0430\u0439\u0432\u0435\u0440\u044b Microsoft SQL Server \u0434\u043b\u044f \u0420\u041d\u0420.<\/em><\/p>\n<p><em>\u041c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 2.0 \u0438 4.3 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0437\u0430\u043f\u0438\u0441\u0438. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 5.0, \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u043a\u0430\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439. \u0415\u0441\u043b\u0438 \u0438\u043c\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u043e\u0441\u043b\u0435 4.3, lastinsertid \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 SQL Server 2012 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445.<\/em><\/p>\n<\/blockquote>\n<h3>\u0421\u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f \u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u0434\u043e\u0440\u043e\u0436\u043d\u0438\u043a?<\/h3>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 MSSQL \u0432 Yii \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u0438 \u0434\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\u0445. \u0427\u0438\u043d\u0438\u043b\u0438 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0431\u043e\u0440 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.&nbsp;<\/p>\n<pre><code class=\"php\">class mssqlPDO extends \\PDO {     \/**      * Returns value of the last inserted ID.      * @param string|null $sequence the sequence name. Defaults to null.      * @return int last inserted ID value.      *\/     public function lastInsertId($sequence = null)     {         $sql = 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)';         return $this-&gt;query($sql)-&gt;fetchColumn();     } }<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443 \u044d\u0442\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0435\u0441\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438: \u0447\u0442\u043e-\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0447\u0442\u043e-\u0442\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e \u0438\u0437\u043b\u0435\u0447\u0435\u043d\u0438\u044e lastInsertId \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0432\u0430\u0441 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0441\u0438\u0442 \u0442\u0440\u0438\u0433\u0433\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0436\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0411\u0414. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u0442 ID, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0442\u0430\u0432\u0438\u043b\u0438, \u0430 ID, \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443.<\/p>\n<blockquote>\n<p><em>For example, there are two tables, T1 and T2, and an INSERT trigger is defined on T1. When a row is inserted to T1, the trigger fires and inserts a row in T2. This scenario illustrates two scopes: the insert on T1, and the insert on T2 by the trigger<\/em><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/ru-RU\/sql\/t-sql\/functions\/scope-identity-transact-sql?view=sql-server-2016\"><em><u>https:\/\/docs.microsoft.com\/ru-RU\/sql\/t-sql\/functions\/scope-identity-transact-sql?view=sql-server-2016<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<ul>\n<li>\n<p>IDENT_CURRENT \u2014 returns the last identity value generated for a specific table in any session and any scope.<\/p>\n<\/li>\n<li>\n<p>@@IDENTITY \u2014 returns the last identity value generated for any table in the current session, across all scopes.<\/p>\n<\/li>\n<li>\n<p>SCOPE_IDENTITY \u2014 returns the last identity value generated for any table in the current session and the current scope.<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u0434\u043e\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043a\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 lastInsertId, \u0430 \u043a\u0442\u043e \u043d\u0435\u0442.<\/p>\n<pre><code class=\"php\">$pdo1-&gt;prepare($sql_insert)-&gt;execute([':n' =&gt; 101]); $pdo2-&gt;prepare($sql_insert)-&gt;execute([':n' =&gt; 102]);  echo 'lastInsertId1 = '.var_export($pdo1-&gt;lastInsertId(), true).PHP_EOL; echo 'lastInsertId2 = '.var_export($pdo2-&gt;lastInsertId(), true).PHP_EOL; \/\/ lastInsertId1 = '1' \/\/ lastInsertId2 = '2'<\/code><\/pre>\n<p>MySQL, PostgreSQL \u0438 MSSQL \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 ID \u043d\u0435\u0442. \u042f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0434\u0432\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0432 \u043d\u0438\u0445 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b, \u0442\u043e\u0442 \u043b\u0438 ID \u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>\u0421 Oracle \u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"powershell\">PHP Fatal error:  Uncaught PDOException: SQLSTATE[IM001]: Driver does not support this function: driver does not support lastInsertId()<\/code><\/pre>\n<h3>\u041d\u043e \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f\u2026<\/h3>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 MSSQL. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b PHP 8.0 + Oracle XE 11g r2 + instantclient21_3 \u0438 \u043f\u0440\u044f\u043c\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a sequence \u2014 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c ID.<\/p>\n<pre><code class=\"php\">$stmt1 = $pdo1-&gt;query('SELECT \"pdo_types_SEQ\".CURRVAL FROM DUAL'); $result1 = $stmt1-&gt;fetchColumn();  $stmt2 = $pdo2-&gt;query('SELECT \"pdo_types_SEQ\".CURRVAL FROM DUAL'); $result2 = $stmt2-&gt;fetchColumn();  \/\/ result1 = '1' \/\/ result2 = '2'<\/code><\/pre>\n<p>\u0414\u0430\u043c \u043e\u0431\u0449\u0443\u044e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044e \u2014 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 PDO::lastInsertId, \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435:<\/p>\n<ul>\n<li>\n<p>PostgreSQL \u2014 RETURNING &#171;id&#187;<\/p>\n<\/li>\n<li>\n<p>MSSQL \u2014 OUTPUT <a href=\"http:\/\/INSERTED.ID\">INSERTED.ID<\/a>&nbsp;<\/p>\n<\/li>\n<li>\n<p>Oracle \u2014 RETURNING id INTO :id<\/p>\n<\/li>\n<li>\n<p>MariaDB (\u0441 \u0432\u0435\u0440\u0441\u0438\u0438 10.5.0) \u2014 RETURNING <code>id<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0432\u0441\u0435\u0445 DBMS \u0435\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u0440\u043e\u043c\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 MySQL. \u0412 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 MSSQL \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440.&nbsp;<\/p>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435 lastInsertId \u2014 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430. \u0421\u043b\u0443\u0447\u0430\u0439 \u0438\u0437 \u0436\u0438\u0437\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b\u0438: \u00ab\u0412\u044b \u043d\u0430\u043c \u043f\u0438\u0441\u044c\u043c\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0438 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0435 \u0444\u0430\u0439\u043b\u0438\u043a. \u0410 \u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u043c \u0431\u044b\u043b\u0430 \u043d\u0435 32 \u0438\u043b\u0438 40-\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0430\u044f UUID \u0430\u0431\u0440\u0430\u043a\u0430\u0434\u0430\u0431\u0440\u0430, \u0430 \u0446\u0438\u0444\u0435\u0440\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u043b\u0438 \u0438\u0445 \u043d\u0430\u043c \u043f\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u00bb. \u0414\u0430\u0436\u0435 \u043b\u044e\u0434\u0438 \u0432\u043d\u0435 IT, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0443\u0436\u0435 \u0437\u043d\u0430\u044e\u0442 \u043f\u0440\u043e \u043d\u0430\u0448 lastInsertId.<\/p>\n<h3>\u0415\u0449\u0451 \u043f\u043e\u0440\u0446\u0438\u044f \u043d\u0435\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432<\/h3>\n<ul>\n<li>\n<p>PDO::MYSQL_ATTR_INIT_COMMAND \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f SET NAMES \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 charset=utf8mb4 \u0432 DSN \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 \u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 DSN \u0441\u0442\u0440\u043e\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SET NAMES. \u041a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 MySQL, \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MYSQL_ATTR_INIT_COMMAND \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 SET NAMES, \u0438 \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<ul>\n<li>\n<p>\u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0439\u0442\u0435 PDO::ATTR_EMULATE_PREPARES.&nbsp;<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u044f) \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c EMULATE_PREPARES, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 SQL-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0439\u0442\u0435, \u0445\u043e\u0442\u044c \u0442\u0430\u043a \u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c multi-statements. \u041f\u043e-\u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u0432\u0440\u0435\u0434\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430.<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0441\u043e\u0432\u0435\u0442\u043e\u043c. \u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a MySQL \u0434\u0432\u0430\u0436\u0434\u044b. PDO \u0431\u0443\u0434\u0435\u0442 \u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442.<\/p>\n<ul>\n<li>\n<p>\u041d\u0435 \u043b\u0435\u043d\u0438\u0442\u0435\u0441\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:  \u0435\u0441\u043b\u0438 \u0443\u0436 \u0431\u0438\u043d\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435, \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c.&nbsp;<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">bindValue('attr', $value, PDO::PARAM_INT); \/\/ \u043b\u0443\u0447\u0448\u0435 \u0442\u0430\u043a, \u0447\u0435\u043c execute(['attr' =&gt; $value]).&nbsp;<\/code><\/pre>\n<ul>\n<li>\n<p>MYSQL_ATTR_USE_BUFFERED_QUERY=false \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.&nbsp;<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u043f\u0435\u0440\u0435\u0435\u0445\u0430\u043b\u0438 \u043d\u0430 mysqlnd \u2014 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u0421\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u2014 \u0438 \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u0412\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0439\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043e\u0431\u044a\u0451\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e.<\/p>\n<ul>\n<li>\n<p>\u0418\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435.&nbsp;<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0435 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0447\u043a\u0443 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u043d\u043e \u0435\u0441\u043b\u0438 \u0443\u0436 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>execute() \u0441\u043e\u043e\u0431\u0449\u0438\u0442 \u043e\u0431&nbsp;\u043e\u0448\u0438\u0431\u043a\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432&nbsp;\u043f\u0435\u0440\u0432\u043e\u043c SQL\u2011\u0437\u0430\u043f\u0440\u043e\u0441\u0435, \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 resultSet, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u0442\u0430\u043c \u043e\u0448\u0438\u0431\u043a\u0443;<\/p>\n<\/li>\n<li>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 nextRowSet() \u0434\u043b\u044f&nbsp;\u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430; <\/p>\n<\/li>\n<li>\n<p>nextRowSet()&nbsp;\u2014 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0431\u0440\u0430\u0442\u044c (columnCount()).<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u043e nextRowSet()<\/h3>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0438\u043c\u0435\u044e\u0449\u0435\u0439 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 ID:<\/p>\n<pre><code class=\"php\">$sql_insert = &lt;&lt;&lt;SQL SET NOCOUNT ON; DECLARE @tmp TABLE ([id] int); INSERT INTO [table]([val]) OUTPUT INSERTED.id INTO @tmp VALUES('12'); SELECT * FROM @temporary_inserted; SQL;  $stmt = $pdo-&gt;query($sql_insert); do {     $result = $stmt-&gt;fetch(PDO::FETCH_ASSOC);     echo 'columnCount = ' . var_export($stmt-&gt;columnCount(), true) . PHP_EOL;     echo 'result = ' . var_export($result, true) . PHP_EOL; } while ($stmt-&gt;nextRowset());<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b MSSQL \u043d\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u043b \u043d\u0430\u043c \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u00ab\u042f \u0432\u0441\u0442\u0430\u0432\u0438\u043b \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443\u00bb, \u00ab\u042f \u0438\u0437\u043c\u0435\u043d\u0438\u043b 0 \u0441\u0442\u0440\u043e\u043a\u00bb \u0438 \u0442.\u0434., \u043c\u044b \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u043c \u044d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u2018SET NOCOUNT ON\u2019.  \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u043d\u0435\u0451 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e OUTPUT INSERTED, \u0430 \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0438\u0437 \u043d\u0435\u0451 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443. \u0422\u0430\u043a \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 ID.&nbsp;<\/p>\n<p>\u041f\u043e\u043c\u043d\u044f \u043f\u0440\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.<\/p>\n<h3>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432<\/h3>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 MSSQL \u0432 PHP \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0415\u0441\u0442\u044c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043e\u0442 Microsoft \u0438 \u0435\u0441\u0442\u044c DBLIB \u2014 Free TDS. \u0420\u0430\u043d\u044c\u0448\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0442\u0430\u0440\u0435\u043d\u044c\u043a\u0438\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 SyBase, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e \u043d\u0435\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c.&nbsp;<\/p>\n<p>\u0414\u0432\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0447\u0443\u0442\u044c \u0440\u0430\u043d\u0435\u0435:<\/p>\n<p>PDO_SQLSRV<\/p>\n<pre><code class=\"powershell\">columnCount = 1 result = array (   'id' =&gt; '4', )<\/code><\/pre>\n<p>PDO_DBLIB<\/p>\n<pre><code class=\"powershell\">columnCount = 0 result = false  columnCount = 0 result = false  columnCount = 1 result = array (   'id' =&gt; 5, )<\/code><\/pre>\n<p>\u0421 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u043e\u0442 Microsoft \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0430 \u0432\u043e\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 DBLib \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0438. \u041d\u0435 \u0431\u0443\u0434\u0435\u0442 resultSet, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u043e \u0438 \u0442\u0430\u043a \u0431\u044b\u043b\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. \u0420\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 nextRowSet. \u0412\u043e\u0442 issue \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/bugs.php.net\/bug.php?id=69592\"><u>Column rowsets to be skipped automatically<\/u><\/a>&nbsp;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/FreeTDS\/freetds\/issues\/156\"><u>Empty result set reported for TDS INFO messages<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<h4>\u0410 \u0432\u044b \u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e&#8230;<\/h4>\n<p>\u041d\u043e \u0438 \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0417\u043d\u0430\u043b\u0438 \u043b\u0438 \u0432\u044b, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f PDO + \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043e\u0442 Microsoft, \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 2100 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"powershell\">PDOException: SQLSTATE[IMSSP]: Tried to bind parameter number 2101.  SQL Server supports a maximum of 2100 parameters.<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c batch insert, \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c. \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443&nbsp;\u0435\u0441\u0442\u044c issue: <a href=\"https:\/\/github.com\/microsoft\/msphpsql\/issues\/410\"><u>https:\/\/github.com\/microsoft\/msphpsql\/issues\/410<\/u><\/a><u>.<\/u><\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u0442\u043e\u043b\u043a\u0430\u0435\u0442 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e DBLIB, \u0445\u043e\u0442\u044f Microsoft \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c.&nbsp;<\/p>\n<h3>\u0415\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043b\u043e\u0447\u0435\u0439<\/h3>\n<p>\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0441\u0442\u0438. \u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c SELECT? \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0432\u0435\u0440\u0441\u0438\u044f PHP 7.4\/8.0, \u0441 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.&nbsp;<\/p>\n<pre><code class=\"php\">\/\/ SELECT * FROM simple_table WHERE id=1 var_dump($result);  \/* array(4) {   'int_col'     =&gt; string(4) \"-123\"   'bigint_col'  =&gt; string(10) \"8817806877\"   'float_col'   =&gt; string(11) \"-12345.6789\"   'numeric_col' =&gt; string(6) \"-33.22\" } *\/<\/code><\/pre>\n<p>\u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 8.1 \u043d\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b \u043b\u043e\u0436\u0430\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438, int \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0411\u0414, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a int, \u0430 \u043d\u0435 \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0430. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0444\u043b\u0430\u0433 PDO::EMULATE_PREPARES \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e).<\/p>\n<pre><code class=\"php\">\/\/ SELECT * FROM simple_table WHERE id=1 var_dump($result);  \/* array(4) {   [\"int_col\"]     =&gt; int(-123)   [\"bigint_col\"]  =&gt; int(8817806877)   [\"float_col\"]   =&gt; float(-12345.6789)   [\"numeric_col\"] =&gt; string(6) \"-33.22\" } *\/<\/code><\/pre>\n<p>\u0423 \u0441\u0435\u0431\u044f \u043c\u044b \u043e\u0431\u043e\u0448\u043b\u0438\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0444\u043b\u0430\u0433\u0430 PDO::ATTR_STRINGIFY_FETCHES \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435.<\/p>\n<pre><code class=\"php\">$pdo = new PDO('mysql:......;charset=utf8', 'username', 'password');  \/\/ \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 8.1 $pdo-&gt;setAttribute(PDO::ATTR_STRINGIFY_FETCHES, 1);  \/\/ \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435 \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 8.0 \u0444\u043b\u0430\u0433 \u0432\u043a\u043b\u044e\u0447\u0435\u043d. \u0421 8.1 \u0444\u043b\u0430\u0433 \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442. $pdo-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);  \/* array(4) {   'int_col'     =&gt; string(4) \"-123\"   'bigint_col'  =&gt; string(10) \"8817806877\"   'float_col'   =&gt; string(11) \"-12345.6789\"   'numeric_col' =&gt; string(6) \"-33.22\" } *\/<\/code><\/pre>\n<p>\u0421\u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u044c, \u0432\u0441\u0451 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u0434\u043b\u044f Yii2, \u043d\u043e \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u0441\u0442\u0432\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u043f\u043e\u043a\u0438\u043d\u0443\u043b\u043e: \u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u0430\u043b\u043e \u0442\u0430\u043a? \u042f \u043f\u043e\u0448\u0451\u043b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0438 \u043d\u0430\u0448\u0451\u043b \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u2014 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0411\u0414, \u0438 \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0435\u0441\u0442\u044c, \u043c\u044b \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ZVAL.&nbsp;<\/p>\n<pre><code class=\"cpp\">#if SIZEOF_ZEND_LONG==4     if ((L64(2147483647) &lt; (int64_t) lval) || (L64(-2147483648) &gt; (int64_t) lval)) {         DBG_INF(\"stringify\");         tmp_len = sprintf((char *)&amp;tmp, \"%\" PRIi64, lval);     } else #endif \/* SIZEOF *\/     {         ZVAL_LONG(zv, (zend_long) lval); \/* the cast is safe, we are in the range *\/     } }  if (tmp_len) { \/\/ \u0412\u041e\u0422 \u042d\u0422\u041e \u041c\u0415\u0421\u0422\u041e     ZVAL_STRINGL(zv, tmp, tmp_len); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cpp\">#if SIZEOF_ZEND_LONG==4     if ((L64(2147483647) &lt; (int64_t) lval) || (L64(-2147483648) &gt; (int64_t) lval)) {         DBG_INF(\"stringify\");         ZVAL_STR(zv, zend_i64_to_str(lval));     } else #endif \/* SIZEOF *\/     {         ZVAL_LONG(zv, (zend_long) lval); \/* the cast is safe, we are in the range *\/     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0432\u043b\u0435\u0437\u0443\u0442 \u0432 int64, \u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0438\u0445 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443. \u0412\u0438\u0434\u0438\u043c\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u043d\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b \u00ab\u043a\u0440\u0430\u0441\u043d\u0435\u0442\u044c\u00bb.<\/p>\n<h3>\u0421\u043b\u0430\u0431\u0430\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f.<\/h3>\n<p>\u042f \u0432\u043a\u043b\u044e\u0447\u0438\u043b PDO::ATTR_EMULATE_PREPARES \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043b\u0430\u0433 PDO::FETCH_BOUND (\u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443), \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043b \u044d\u0442\u043e \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441 \u0442\u0438\u043f\u043e\u043c int, \u043d\u043e \u043a\u043e \u043c\u043d\u0435 \u0438\u0437 PDO \u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u2014 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c TypeError (\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u2014 \u043d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u0430\u043a).&nbsp;<\/p>\n<pre><code class=\"php\">declare(strict_types=1);  class TypesCheck {     private int $n = 1;      public function check(PDO $pdo)     {         $stmt = $pdo-&gt;query('select int_col from pdo_types');         $stmt-&gt;bindColumn(1, $this-&gt;n, PDO::PARAM_INT);         $this-&gt;anyWork($this-&gt;n); \/\/ int(1)         $stmt-&gt;fetch(PDO::FETCH_BOUND);         var_dump($this-&gt;n); \/\/ string(3) \"101\"         $this-&gt;anyWork($this-&gt;n);         \/\/ PHP Fatal error:  Uncaught TypeError: TypesCheck::anyWork()...     }      private function anyWork(int $value) { \/* any actions *\/ } }<\/code><\/pre>\n<h3>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 PDO<\/h3>\n<p>\u0418 \u0442\u0443\u0442 \u043d\u0435 \u0443\u0434\u0435\u0440\u0436\u0443\u0441\u044c \u043e\u0442 \u0440\u044f\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0421\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 PDO::ATTR_ERRMODE (PDO::ERRMODE_SILENT, \u0438 \u0442.\u0434.). \u0412\u043a\u043b\u044e\u0447\u0430\u0439\u0442\u0435 \u0440\u0435\u0436\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a PDO::ERRMODE_EXCEPTION, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0439\u0442\u0435.<\/p>\n<\/li>\n<li>\n<p>DDL \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043d\u0435 \u0432\u0441\u0435 DBMS \u2014 \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u043b\u0447\u0430\u043b\u0438\u0432\u044b\u0439 autocommit (MySQL, Oracle, MSSQL).&nbsp;<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 PDO \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442, \u0447\u0442\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0438 \u043d\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u0421 \u044d\u0442\u0438\u043c \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u044e\u0430\u043d\u0441\u044b.&nbsp;<\/p>\n<\/li>\n<li>\n<p>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f (\u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u0438\u0445 DBMS). \u0412 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 savepoint.&nbsp;<\/p>\n<\/li>\n<\/ul>\n<h3>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/h3>\n<p>\u0421\u0432\u043e\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0447\u0435\u0441\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 *_handle_in_transaction \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0443 PostgreSQL \u0438 MySQL, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 PHP 8.0. \u041e\u043d\u0438 \u0443\u0437\u043d\u0430\u044e\u0442 \u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u043b\u0438 \u0435\u0451 \u0447\u0435\u0440\u0435\u0437 SQL. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0443\u0437\u043d\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0444\u043b\u0430\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u043f\u043e\u043c\u043e\u0449\u044c\u044e PDO-\u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, beginTransaction.<\/p>\n<pre><code class=\"cpp\">if (pdo_is_in_transaction(dbh)) {   zend_throw_exception_ex(php_pdo_get_exception(), 0,         \"There is already an active transaction\");   RETURN_THROWS(); }  ...    static bool pdo_is_in_transaction(pdo_dbh_t *dbh) { if (dbh-&gt;methods-&gt;in_transaction) { return dbh-&gt;methods-&gt;in_transaction(dbh); } return dbh-&gt;in_txn; \/\/ boolean \u0444\u043b\u0430\u0433 } ... \/\/ \u0410 \u0432\u043e\u0442 \u043c\u0435\u0442\u043e\u0434: dbh-&gt;methods-&gt;in_transaction static bool pdo_mysql_in_transaction(pdo_dbh_t *dbh) {   pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh-&gt;driver_data;   PDO_DBG_ENTER(\"pdo_mysql_in_transaction\");   PDO_DBG_RETURN((pdo_mysql_get_server_status(H-&gt;server) &amp; SERVER_STATUS_IN_TRANS) != 0); }<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 PDO::beginTransaction \u2014 \u0432\u0441\u0451 \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u043b\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u201cbegin transaction\u201d, \u0442\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043e\u0431 \u044d\u0442\u043e\u043c \u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0437\u043d\u0430\u043b. \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u043d\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0441\u0445\u043e\u0434\u0438\u043b\u0438, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0438 \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c \u2014 \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043c\u044b \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<h3>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438 MyISAM<\/h3>\n<p>\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u044f \u0411\u0414 \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f InnoDB, \u0430 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441 \u0442\u0438\u043f\u043e\u043c MyISAM:<\/p>\n<p>\u041c\u044b \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u0434\u0435\u043b\u0430\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u0438 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e. PDO \u044d\u0442\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043c\u0435\u0442 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u2014 \u043e\u043d \u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430-\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u0441\u044f.&nbsp;<\/p>\n<pre><code class=\"php\">$pdo1-&gt;beginTransaction(); \/\/ true $insertResult1 = $pdo1-&gt;prepare($sql_insert)-&gt;execute([':n' =&gt; 111]); $pdo1-&gt;rollBack(); \/\/ true  $st = $pdo1-&gt;prepare('SELECT id,int_col FROM type WHERE int_col=:n'); $st-&gt;execute(['n' =&gt; 111]); var_dump($st-&gt;fetch(PDO::FETCH_ASSOC));  \/* array(2) {   'id' =&gt; string(1) \"3\"   'int_col' =&gt; string(3) \"111\" } *\/<\/code><\/pre>\n<p>\u0425\u043e\u0442\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e MyISAM-\u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0432\u0435\u0434\u044c \u0432 \u0446\u0435\u043b\u043e\u043c \u0442\u043e \u0443 \u043d\u0430\u0441 InnoDB.<\/p>\n<h3>\u0421\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438.<\/h3>\n<p>\u0415\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439 \u0438\u0437 \u043c\u0438\u0440\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432. \u0420\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u043f\u0438\u0441\u0430\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0441\u0442\u044b\u043b\u0438\u043a \u0434\u043b\u044f SyBase:<\/p>\n<pre><code class=\"php\">$pdo = new PDO('dsn_string', 'username', 'password'); $pdo-&gt;exec('BEGIN TRANSACTION'); $pdo-&gt;exec('COMMIT TRANSACTION'); $pdo-&gt;exec('ROLLBACK TRANSACTION');<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u0435\u0441\u043b\u0438 \u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0435\u0441\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 DBMS), \u0434\u0430\u0436\u0435 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f PDO.<\/p>\n<h3>PDO::quote \u0438 \u00bf&#8217;<\/h3>\n<p>\u0415\u0449\u0451 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u043e\u0432 \u0441\u0435\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043f\u0440\u043e PDO::quote \u0438 \u00bf&#8217;. \u041f\u0440\u0438\u043c\u0435\u0440 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 GBK, \u0442\u043e \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0437\u043d\u0430\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u043a\u0430\u0432\u044b\u0447\u043a\u0430, \u0438 mysql_real_escape_string \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u0412\u0435\u0434\u044c \u0432\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u0430\u043f\u043e\u0441\u0442\u0440\u043e\u0444\u0430\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u00ab\\\u00bb \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0441\u043b\u044d\u0448. \u0422\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0442\u0435\u043d\u0430 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u043e.&nbsp;<\/p>\n<pre><code class=\"cpp\">\/\/ ext\/pdo_mysql\/mysql_driver.c  if (use_national_character_set) {     *quotedlen = mysql_real_escape_string_quote(H-&gt;server, *quoted + 2, unquoted,         unquotedlen, '\\'');     (*quoted)[0] = 'N';     (*quoted)[1] = '\\'';      ++*quotedlen; \/* N prefix *\/ } else {     *quotedlen = mysql_real_escape_string_quote(H-&gt;server, *quoted + 1, unquoted,         unquotedlen, '\\'');     (*quoted)[0] = '\\''; }  (*quoted)[++*quotedlen] = '\\''; (*quoted)[++*quotedlen] = '\\0';<\/code><\/pre>\n<h3>0x-\u0442\u0435\u0440\u0438\u0447\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u0440\u044f\u043c\u043e \u0432 SQL-\u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0435\u0437 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0430 \u0438 \u043d\u0435 \u0431\u043e\u044f\u0442\u044c\u0441\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439? \u041e\u0442\u0432\u0435\u0442: \u0434\u0430, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 MSSQL, \u043f\u0440\u0438\u0447\u0451\u043c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c: <\/p>\n<pre><code class=\"php\">\/\/ \u0414\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u044d\u043a\u0440\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0445\u0435\u043a\u0441\u043e\u043c - \u0444\u0438\u0447\u0430 \u043c\u0441\u0441\u043a\u043b $string = '0x' . bin2hex($value); $sql = \"INSERT INTO [table]([varchar_col]) VALUES($string)\";  \/\/ \u041d\u0443 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 BLOB \u043f\u043e\u043b\u0435 MSSQL if (is_string($value)) {     return new Expression('CONVERT(VARBINARY(MAX), '.             ('0x'. bin2hex($value)) .')'); }<\/code><\/pre>\n<p>MSSQL hex-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442. \u0422\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443 \u043d\u0430\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0445 \u0441\u0430\u043c\u044b\u0445 \u0440\u043e\u043b\u0435\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441 JSON. \u041c\u044b \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 expression, \u0438 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u043c\u043e\u0435\u043c\u0443 \u043a\u043e\u043b\u043b\u0435\u0433\u0435 \u0438 \u0434\u0440\u0443\u0433\u0443 <a href=\"https:\/\/mneti.com\"><u>\u0410\u043d\u0434\u0440\u0435\u044e \u0420\u044b\u0447\u043a\u043e\u0432\u0443<\/u><\/a> \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0443\u0447\u0438\u043b \u044d\u0442\u043e\u043c\u0443 \u0447\u0443\u0434\u0435\u0441\u043d\u043e\u043c\u0443 \u0445\u0430\u043a\u0443.<\/p>\n<h3>\u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0430<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0440\u0435\u0448\u0438\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e ORM, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b. \u0418 \u0431\u0443\u0434\u0435\u0442\u0435 \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u043e \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0421\u0430\u0448\u0435 \u041c\u0430\u043a\u0430\u0440\u043e\u0432\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u043b \u043c\u043d\u0435 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u0443\u0442\u044c\u0441\u044f \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u043c\u0443, \u0438 Wilmer Arambula, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u0440\u043f\u0438\u0442 \u043d\u0430\u0448 \u0441 \u043d\u0438\u043c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0441\u043f\u043e\u0440\u044b.&nbsp;<\/p>\n<p>\u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c!<\/p>\n<details class=\"spoiler\">\n<summary>\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0421\u0442\u0440\u0430\u043d\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b, \u043d\u043e \u0431\u0443\u0434\u0435\u043c \u0447\u0435\u0441\u0442\u043d\u044b \u2014 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0438 \u0434\u043e\u043a\u043b\u0430\u0434\u0430, \u043d\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/phpdelusions.net\/pdo\">https:\/\/phpdelusions.net\/pdo<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/phpdelusions.net\/pdo\/fetch_modes\">https:\/\/phpdelusions.net\/pdo\/fetch_modes<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.php.net\/manual\/ru\/refs.database.php\">https:\/\/www.php.net\/manual\/ru\/refs.database.php<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/docs.microsoft.com\/ru-RU\/sql\/t-sql\/functions\/scope-identity-transact-sql?view=sql-server-2016\">https:\/\/docs.microsoft.com\/ru-RU\/sql\/t-sql\/functions\/scope-identity-transact-sql?view=sql-server-2016<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/141127\/\">https:\/\/habr.com\/ru\/post\/141127\/<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-describe-table\/\">https:\/\/www.sqlitetutorial.net\/sqlite-describe-table\/<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/137664\">https:\/\/habr.com\/ru\/post\/137664<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/vk\/blog\/234125\/\">https:\/\/habr.com\/ru\/company\/vk\/blog\/234125\/<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/134099\/are-pdo-prepared-statements-sufficient-to-prevent-sql-injection\/\">https:\/\/stackoverflow.com\/questions\/134099\/are-pdo-prepared-statements-sufficient-to-prevent-sql-injection\/<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.flaticon.com\/ru\/free-icons\/\">https:\/\/www.flaticon.com\/ru\/free-icons\/<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/yiisoft\/yii2\/issues\/18171\">https:\/\/github.com\/yiisoft\/yii2\/issues\/18171<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/13747481\/pdo-lastinsertid-not-working-for-ms-sql\">https:\/\/stackoverflow.com\/questions\/13747481\/pdo-lastinsertid-not-working-for-ms-sql<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/docs.microsoft.com\/ru-RU\/sql\/t-sql\/functions\/scope-identity-transact-sql?view=sql-server-2016\">https:\/\/docs.microsoft.com\/ru-RU\/sql\/t-sql\/functions\/scope-identity-transact-sql?view=sql-server-2016<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/bugs.php.net\/bug.php?id=69592\">https:\/\/bugs.php.net\/bug.php?id=69592<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/FreeTDS\/freetds\/issues\/156\">https:\/\/github.com\/FreeTDS\/freetds\/issues\/156<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/microsoft\/msphpsql\/issues\/410\">https:\/\/github.com\/microsoft\/msphpsql\/issues\/410<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/mneti.ru\">https:\/\/mneti.ru<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043b\u044e\u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a *sql drivers \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u0432 \u043d\u0435\u0439 \u0435\u0441\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/oleg-bunin\/articles\/727930\/\"> https:\/\/habr.com\/ru\/companies\/oleg-bunin\/articles\/727930\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u043b\u0435\u0440\u0438\u0439 \u0413\u043e\u0440\u0431\u0430\u0447\u0435\u0432. \u0414\u0430\u0432\u043d\u043e \u043f\u0438\u0448\u0443 \u043d\u0430 PHP, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u043e\u043c (\u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 <a href=\"https:\/\/yiiframework.com\"><u>Yii3 Framework<\/u><\/a>), \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u044e \u043c\u0438\u0442\u0430\u043f\u044b \u0432 \u0440\u043e\u0434\u043d\u043e\u043c \u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440\u0435 \u0438 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044e \u0441 \u0434\u043e\u043a\u043b\u0430\u0434\u0430\u043c\u0438 \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f\u0445.&nbsp;<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0435\u0433\u043e \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u043d\u0430 HighLoad++ 2022. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441\u0442\u0430\u0440\u0448\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0432 Delivery Club.&nbsp;<\/p>\n<p>\u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0442\u043e\u043c, \u043e \u0447\u0451\u043c \u0437\u043d\u0430\u044e \u0441\u0430\u043c. \u0423 \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u2014 \u0441\u0432\u044f\u0436\u0438\u0442\u0435\u0441\u044c \u0441\u043e \u043c\u043d\u043e\u0439.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 Midjourney<\/figcaption><\/div>\n<\/figure>\n<h3>\u041a\u0430\u043a \u044f \u0438\u0437\u0443\u0447\u0430\u043b \u0411\u0414 \u0438 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u043e\u0440\u0430 \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c<\/h3>\n<p>\u0412\u0441\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441\u0442\u0430\u0434\u0438\u0438 \u043e\u0442\u0440\u0438\u0446\u0430\u043d\u0438\u044f, \u0433\u043d\u0435\u0432\u0430, \u0434\u0435\u043f\u0440\u0435\u0441\u0441\u0438\u0438\u2026 \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0411\u0414). \u0412 \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0436\u0435, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u043d\u043a\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445;<\/p>\n<\/li>\n<li>\n<p>\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0411\u0414 (dbf, dBase IV);<\/p>\n<\/li>\n<li>\n<p>\u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 SQL (\u043a\u043d\u0438\u0433\u0438, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f).<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0441 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u043b \u0432 \u0444\u0430\u0439\u043b\u0430\u0445. \u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0448\u0451\u043b \u043d\u0430 dbf, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0448\u0451\u043b \u043a SQL \u0438 \u043d\u0430\u0447\u0430\u043b \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043d\u0438\u0433\u0438 \u0438 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u044d\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u042f \u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a\u0438\u0435 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<pre><code class=\"php\">$sql = \"SELECT * FROM products WHERE id = {$id}\"<\/code><\/pre>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u00ab\u0438\u043d\u0442\u0432\u0430\u043b\u0438\u043b\u00bb, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<pre><code class=\"php\">$sql = 'SELECT * FROM products WHERE id = ' . @intval($id);<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u043b \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">$sql = \"SELECT * FROM products WHERE name = '{$name}'\";<\/code><\/pre>\n<p>\u0410 \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0432\u0437\u043b\u043e\u043c\u0430\u043b\u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0443\u0437\u043d\u0430\u043b \u043f\u0440\u043e SQL-\u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0422\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u043f\u043b\u044e\u0441 \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b\u0441\u044f \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438 \u0438 \u0441\u0442\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"php\">$name = mysql_real_escape_string($name); $sql = \"SELECT * FROM products WHERE name = '\". $name. \"'\";<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c mysql_ \u0437\u0430\u0434\u0435\u043f\u0440\u0435\u043a\u0435\u0439\u0442\u0438\u043b\u0438, \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u0438 \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445:<\/p>\n<pre><code class=\"php\">$stmt = $mysqli-&gt;prepare(\"SELECT * FROM products WHERE name = ?\"); $stmt-&gt;bind_param(\"s\", $name);<\/code><\/pre>\n<h3>\u041a\u0430\u043a \u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 PHP<\/h3>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e \u0433\u043e\u0434\u0430\u043c.<\/p>\n<ul>\n<li>\n<p>PHP 5.0 \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 ext\/mysqli (2003).<\/p>\n<\/li>\n<li>\n<p>PHP 5.1 \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f PDO_MySQL (2005).<\/p>\n<\/li>\n<li>\n<p>PHP 5.3 \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 mysqlnd \u0441 \u0440\u044f\u0434\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0443\u0445\u043e\u0434\u043e\u043c \u043e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 Oracle (2009).<\/p>\n<\/li>\n<li>\n<p>PHP 5.* \u2014 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 libmysqlclient (C++, Oracle) \u043d\u0430 mysqlnd (2013).<\/p>\n<\/li>\n<li>\n<p>PHP 5.5 \u2014 \u043c\u043e\u0434\u0443\u043b\u044c mysql_* \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c \u0438 \u0443\u0434\u0430\u043b\u0451\u043d \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 7 (2013).<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u043e\u0433\u0434\u0430 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f, \u0447\u0442\u043e \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u043e\u0440\u0430 \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c. \u041f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u0441\u0442\u0430\u043b \u0432\u044b\u0431\u043e\u0440: \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 MySQLi \u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PDO.&nbsp;<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 MySQLi \u0438 PDO_MySQL<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 MySQLi \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u044b\u0435, \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0443\u043a\u0432\u0443 i, \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u043a\u043e\u0434\u0443 \u0438 \u0432\u0441\u0451 \u0441\u0442\u0430\u043b\u043e \u0431\u044b \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044f \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b \u0438 \u0444\u0440\u0430\u0437\u0443 \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0444\u043e\u0440\u0443\u043c\u043e\u0432:<\/p>\n<p><em>\u00ab\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f PDO, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u0421\u0423\u0411\u0414\u00bb<\/em><\/p>\n<h3>\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f\u2026<\/h3>\n<p>\u042f \u0436\u0438\u043b \u0432 \u043c\u0438\u0440\u0435 \u0440\u043e\u0437\u043e\u0432\u044b\u0445 \u043f\u043e\u043d\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b ORM, QueryBuilder\u2019\u044b \u0438 \u0434\u0435\u043b\u0430\u043b \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">$userQuery = (new Query())-&gt;select('id')-&gt;from('user');<\/code><\/pre>\n<p>\u041d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0434\u0430\u0436\u0435 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b MySQLi \u0441 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u043e\u043c:<\/p>\n<pre><code class=\"php\">$stmt-&gt;bind_param(\"ssssiisississ\", $name, $title, ...);<\/code><\/pre>\n<p>\u041d\u043e \u0432 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0431\u0443\u043a\u0432 \u201cs\u201d, \u201ci\u201d. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u0438\u043d\u0434\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443. \u0414\u0440\u0443\u0433\u043e\u0435 \u0434\u0435\u043b\u043e ORM.<\/p>\n<h3>ORM \u2014 \u043b\u0435\u043a\u0430\u0440\u0441\u0442\u0432\u043e \u043e\u0442 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c?<\/h3>\n<p>\u0423 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ORM \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u0434 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0438 \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043d\u0443\u0436\u0434\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u00ab\u0441\u044b\u0440\u044b\u0435\u00bb \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0432\u0435\u0434\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c QueryBuilder.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043d\u0438\u0436\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0442\u044c SQL.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0434\u0432\u0438\u0436\u043a\u0443 \u0411\u0414.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u0430\u043a\u0438\u0445 ORM: Eloquent, Doctrine, Cycle, Propel, RedBeanPHP, Yii DB \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u043e \u0443 ORM, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u043f\u044b\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u0439 \u0438\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ORM \u043e\u0442 Yii Framework \u0432\u0435\u0440\u0441\u0438\u0439 1 \u0438 2.<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u0442 \u0442\u043e\u0439 \u0436\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u00ab\u0441\u044b\u0440\u044b\u0445\u00bb \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0443\u0434\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u042d\u0442\u043e \u0436\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0440\u0430\u0434\u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0447\u0443\u0436\u043e\u0439 \u043a\u043e\u0434 \u0438 \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u00ab\u0442\u0430\u043a \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c\u00bb \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p>MySQL-first-\u043f\u043e\u0434\u0445\u043e\u0434 \u043a\u0430\u043a \u0441\u0430\u043c\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0431\u043e\u043b\u044c \u2014 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0443\u0441\u0442\u0430\u0440\u0435\u043b. \u041a\u043e\u0433\u0434\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 ORM, \u0431\u044b\u043b\u043e \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0441 MySQL, \u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0411\u0414 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u00ab\u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a \u0432 MySQL\u00bb.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0425\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u0440\u0430\u0431\u043b\u044f\u043c \u043a\u0430\u043a \u0441\u0442\u0438\u043b\u044c \u0436\u0438\u0437\u043d\u0438<\/h3>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435: \u043c\u043d\u0435 \u043c\u0435\u0448\u0430\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ORM \u0432\u0441\u044e \u0436\u0438\u0437\u043d\u044c.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0411\u0414 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 API, \u0438 \u043f\u0440\u043e ORM \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0437\u0430\u0431\u044b\u0442\u044c. \u041f\u0438\u0441\u0430\u043b\u0438 \u0441\u044b\u0440\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 API-\u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<p>\u041d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0445 \u044f \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f MySQL, MSSQL, PostgreSQL, Oracle \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043c\u0435\u043d\u044f \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443: \u044f \u043e\u0441\u043e\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0432\u0435\u0441\u044c \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0435\u043d. \u0410 \u0433\u0434\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u044f \u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 <a href=\"https:\/\/github.com\/terabytesoftw\"><u>Wilmer Arambula<\/u><\/a>, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043c <a href=\"https:\/\/github.com\/yiisoft\/db\"><u>Yii Database Library<\/u><\/a>. \u0410 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043b\u0435\u0436\u0438\u0442 PDO\u2026<\/p>\n<h3>\u0421\u043a\u0443\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/h3>\n<p>PDO \u0441 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u0430\u043c\u0438 \u2014 \u043f\u0443\u0442\u044c \u043a \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0412 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 PDO \u043d\u0435\u0442 \u043c\u0430\u0433\u0438\u0438, \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"php\">\/* \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0435\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 *\/ $sql = 'SELECT name, colour, calories FROM fruit WHERE calories &lt; :calories AND colour = :colour'; $sth = $dbh-&gt;prepare($sql, ['calories' =&gt; 150, 'colour' =&gt; 'red']); $sth-&gt;execute(); $red = $sth-&gt;fetchAll();<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: \u0432 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u044b \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u2014 \u0432\u0441\u0451 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PDO \u043f\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u0411\u0414 \u0437\u0430\u0448\u043a\u0430\u043b\u0438\u0432\u0430\u044e\u0442:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0416\u0451\u043b\u0442\u044b\u043c \u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u0438\u043b \u0442\u043e, \u0441 \u0447\u0435\u043c \u0441\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438\u0437 PHP. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 PDO_ODBC \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u043b\u0438 \u0432 \u0411\u0414 \u0438 \u0447\u0435\u0440\u0435\u0437 PDO_ODBC.&nbsp;<\/p>\n<p>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u043e\u0431 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 DBMS \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c PDO. \u042f \u0432\u0435\u0434\u044c \u0435\u0449\u0451 \u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e PDO \u043e\u0431\u0435\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u0440\u043e\u0431\u0430\u0445 \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0434\u0435\u0442\u0430\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0440\u043e\u0437\u043d\u044c (LIMIT 10 OFFSET 10 vs LIMIT 10, 10).<\/p>\n<\/li>\n<li>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442, \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 SQL \u0442\u043e\u0436\u0435 \u043d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0431\u044b\u0432\u0430\u0435\u0442, \u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e&#8230;<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0449\u0451 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u2014 \u044d\u0442\u043e \u043e\u0431\u0438\u043b\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 PDO.<\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0435\u0436\u0438\u043c \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 FETCH_ASSOC \u0438\u043b\u0438 FETCH_OBJ:<\/p>\n<pre><code class=\"php\">$sth = $dbh-&gt;prepare(\"SELECT name, colour FROM fruit\"); $sth-&gt;execute();  \/* \u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0441\u0442\u0440\u043e\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 *\/ print(\"\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0441\u0442\u0440\u043e\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430:\\n\"); $result = $sth-&gt;fetchAll(); print_r($result);<\/code><\/pre>\n<p>\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043b\u0438 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0432\u0441\u0451. \u041d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432. <\/p>\n<h4>FETCH_KEY_PAIR<\/h4>\n<pre><code class=\"php\">SELECT `username`, `email` FROM `users`  \/* [     'login1' =&gt; 'email1@mail.ru',     'login2' =&gt; 'email2@mail.ru', ] *\/<\/code><\/pre>\n<p>\u0420\u0435\u0436\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 \u0441\u0442\u0438\u043b\u0435 &#171;Key-value&#187; \u0441\u043b\u0435\u0434\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043a\u043b\u044e\u0447, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<h4>FETCH_UNIQUE<\/h4>\n<pre><code class=\"php\">SELECT `id`, `username`, `email` FROM `users`  \/* [   1 =&gt; ['username' =&gt; 'login101', 'email' =&gt; 'email1@mail.ru', ],   2 =&gt; ['username' =&gt; 'login102', 'email' =&gt; 'email2@mail.ru', ], ] *\/<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043a\u0430\u043a \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0434\u043d\u043e, \u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.&nbsp;<\/p>\n<h4>FETCH_GROUP<\/h4>\n<pre><code class=\"php\">SELECT `group`, `id`, `username` FROM `users`  \/* [     'reader' =&gt; [         ['id' =&gt; 1, 'username' =&gt; 'login101'],         ['id' =&gt; 3, 'username' =&gt; 'login103'],     ],     'writer' =&gt; [         ['id' =&gt; 2, 'username' =&gt; 'login102'],         ['id' =&gt; 4, 'username' =&gt; 'login104'],     ], ] *\/<\/code><\/pre>\n<p>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0432\u0443\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043c\u0435\u043d\u044e.&nbsp;<\/p>\n<h4>FETCH_NAMED<\/h4>\n<p>FETCH_NAMED \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e FETCH_ASSOC, \u0435\u0441\u043b\u0438 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"php\">SELECT u.`name`, u.`email`, g.`name`   FROM `users` u   INNER JOIN `groups` g ON g.`id` = u.`group_id`  $stmt-&gt;fetch(PDO::FETCH_NAMED); \/* [     'name' =&gt; [         0 =&gt; 'login101',         1 =&gt; 'writer',     ],     'email' =&gt; 'email1@mail.ru', ] *\/<\/code><\/pre>\n<p>\u0418\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 SELECT *, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JOIN \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439 \u0441\u043e\u0432\u043f\u0430\u043b\u0438. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f FETCH_NAMED \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438. <\/p>\n<p><em>\u041d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SELECT *, \u043d\u043e \u0432 \u0436\u0438\u0437\u043d\u0438 \u0432\u0441\u044f\u043a\u043e\u0435 \u0431\u044b\u0432\u0430\u0435\u0442.<\/em><\/p>\n<h4>FETCH_CLASSTYPE<\/h4>\n<pre><code class=\"php\">SELECT   CONCAT(UCASE(LEFT(`group`, 1)), SUBSTRING(`group`, 2)),     `username`, `email`   FROM `users`  $stmt-&gt;fetch(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE); \/* object(Reader)#3 (1) {   [\"username\"] =&gt; string(8) \"login101\",   [\"email\"] =&gt; string(14) \"email1@mail.ru\", } *\/<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a\u0430\u043a \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 PDO \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0432 PHP, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u043c\u0430\u043f\u043f\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430.&nbsp;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0442\u043e\u0436\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u0440\u0435\u0436\u0438\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b PDO, \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/phpdelusions.net\/pdo\/fetch_modes\"><u>\u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438<\/u><\/a>.<\/p>\n<p>\u0420\u0430\u0437 \u043c\u044b \u043a\u043e\u0441\u043d\u0443\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 PHP 8.2, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043c\u043e\u0433\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 PHP 9 \u0441 \u044d\u0442\u0438\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0431\u0443\u0434\u0443\u0442 \u0435\u0449\u0451 \u0431\u00f3\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h3>\u0410 \u0435\u0441\u0442\u044c \u043b\u0438 \u0435\u0449\u0451 \u00ab\u0437\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438\u00bb?<\/h3>\n<ul>\n<li>\n<p>PDO::ATTR_ORACLE_NULLS \u2014&#187;&#187; =&gt; NULL, NULL =&gt;&#187;&#187; <br \/>\u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c NULL, \u0432\u043c\u0435\u0441\u0442\u043e NULL \u2014 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 Oracle, \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u044d\u0442\u043e \u0441 PostgreSQL \u2014 \u0442\u043e\u0436\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<ul>\n<li>\n<p>PDO::ATTR_CASE \u2014 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0438\u043c\u0451\u043d \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043a\u043b\u044e\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c, \u043d\u0438\u0436\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0438\u043b\u0438 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0438 \u0432 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 PHP \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u043e\u0432\u044b\u0435 \u0444\u043b\u0430\u0433\u0438:<\/p>\n<ul>\n<li>\n<p>MYSQL_ATTR_LOCAL_INFILE_DIRECTORY&nbsp;<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u0432\u0440\u043e\u0434\u0435 open_basedir \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"sql\">LOA<\/code><\/pre>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\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-348216","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348216","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=348216"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348216\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=348216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=348216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=348216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}