{"id":8347,"date":"2022-07-07T05:10:09","date_gmt":"2022-07-06T20:10:09","guid":{"rendered":"https:\/\/yumishin.com\/?p=8347"},"modified":"2022-07-07T05:10:09","modified_gmt":"2022-07-06T20:10:09","slug":"prepared-statement","status":"publish","type":"post","link":"https:\/\/yumishin.com\/?p=8347","title":{"rendered":"AWS lambda\u3067sql\u3092\u76f4\u66f8\u304d\u3059\u308b\u3068\u304d\u3001prepared statement\u3067\u66f8\u304b\u306a\u3044\u3068NG\u3060\u3063\u305f\u4ef6"},"content":{"rendered":"<h2 id=\"i-0\">AWS lambda\u3067sql\u3092\u76f4\u66f8\u304d\u3059\u308b\u3068\u304d\u3001prepared statement\u3067\u66f8\u304b\u306a\u3044\u3068NG\u3060\u3063\u305f\u4ef6<\/h2>\n<h3 id=\"i-1\">\u6982\u8981<\/h3>\n<p>AWS lambda\u306eSELECT\u6587\u306e\u4e2d\u3067\u3001\u5024\u3092\u76f4\u63a5\u4ee3\u5165\u3059\u308b\u66f8\u304d\u65b9\u3092\u3057\u3066\u3044\u305f\u304c\u3001\u52d5\u304b\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>SQL\u3092\u66f8\u304f\u3068\u304d\u306fprepared statement\u3067\u66f8\u304b\u306a\u3044\u3068\u30c0\u30e1\u3060\u3063\u305f\u3002<\/p>\n<h3 id=\"i-2\">\u8a73\u7d30<\/h3>\n<h4 id=\"i-3\">AWS lambda\u306eSELECT\u6587\u306e\u4e2d\u3067\u3001\u5024\u3092\u76f4\u63a5\u4ee3\u5165\u3059\u308b\u66f8\u304d\u65b9\u3092\u3057\u3066\u3044\u305f\u304c\u3001\u52d5\u304b\u306a\u304b\u3063\u305f\u3002<\/h4>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3001\u95a2\u9023\u3059\u308bIoT Device\u306e\u60c5\u5831\u3092\u63a2\u3057\u3066\u304f\u308bSQL\u3092\u66f8\u3044\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> AWS lambda\/index<\/span><\/p>\n<pre><code>text: `SELECT * FROM devices WHERE devices.name = \"${ device_name }\"`,<\/code><\/pre>\n<\/div>\n<p>\u52d5\u304b\u305d\u3046\u3068\u3057\u3066\u3082\u3001\u52d5\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u306f\u3001devices.name\u306e\u3068\u3053\u308d\u306b\u3001device_name\u3092\u5909\u6570\u5c55\u958b\u3057\u3066\u3001\u76f4\u63a5\u4ee3\u5165\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u90e8\u5206\u3067\u3059\u3002<\/p>\n<h4 id=\"i-4\">SQL\u3092\u66f8\u304f\u3068\u304d\u306fprepared statement\u3067\u66f8\u304b\u306a\u3044\u3068\u30c0\u30e1\u3060\u3063\u305f\u3002<\/h4>\n<p>\u7d50\u5c40\u3069\u306e\u3088\u3046\u306a\u66f8\u304d\u65b9\u3067\u52d5\u3044\u305f\u304b\u3068\u3044\u3046\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> AWS lambda\/index<\/span><\/p>\n<pre><code>text: `SELECT * FROM devices WHERE name = $1`,\nvalues: [device_name]<\/code><\/pre>\n<\/div>\n<p>\u3053\u306e\u66f8\u304d\u65b9\u3001\u3042\u308b\u306e\u306f\u77e5\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u540d\u524d\u306f\u77e5\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>prepared statemant\u3068\u3044\u3046\u66f8\u304d\u65b9\u3089\u3057\u304f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308b\u305d\u3046\u3067\u3059\u3002<\/p>\n<blockquote>\n<div class=\"d9FyLd\"><b>\u30d7\u30ea\u30da\u30a2\u30c9\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/b>&nbsp;\u3010<b>prepared statement<\/b>\u3011<\/div>\n<p><span class=\"hgKElc\"><b>\u30d7\u30ea\u30da\u30a2\u30c9\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/b>\u3068\u306f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u3067\u52d5\u7684\u306bSQL\u6587\u3092\u751f\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u304d\u3001\u53ef\u5909\u90e8\u5206\u3092\u5909\u6570\u306e\u3088\u3046\u306b\u3057\u305fSQL\u6587\u3092\u3042\u3089\u304b\u3058\u3081\u4f5c\u6210\u3057\u3066\u304a\u304d\u3001\u5024\u306e\u633f\u5165\u306f\u51e6\u7406\u7cfb\u306b\u884c\u308f\u305b\u308b\u65b9\u5f0f\u3002 \u5b9f\u884c\u52b9\u7387\u3092\u5411\u4e0a\u3055\u305b\u3001SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3092\u9632\u6b62\u3059\u308b\u52b9\u679c\u304c\u3042\u308b\u3002<\/span><\/p><\/blockquote>\n<p>\u3044\u3084\u306f\u3084\u3001\u3001\u3001<\/p>\n<p>\u3057\u304b\u3082\u3001\u3053\u306eprepared statement\u3092\u4f7f\u308f\u306a\u3044\u3068\u3001\u6319\u52d5\u3057\u306a\u3044\u3088\u3046\u306a\u4ed5\u7d44\u307f\u3082\u3042\u308b\u307f\u305f\u3044\u3067\u3059\u3002\u3002\u3002<\/p>\n<p>\u5024\u3092\u76f4\u63a5\u4ee3\u5165\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3001\u3001\u3001<\/p>\n<p>AWS lambda\u3082\u305d\u3093\u306a\u306e\u3042\u308b\u3093\u3067\u3057\u3087\u3046\u304b\u3001\u3001\u3001<\/p>\n<p>\u8abf\u3079\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3067\u3059\u306d\u3001\u3001\u3001<\/p>\n<p>\u3067\u306f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS lambda\u3067sql\u3092\u76f4\u66f8\u304d\u3059\u308b\u3068\u304d\u3001prepared statement\u3067\u66f8\u304b\u306a\u3044\u3068NG\u3060\u3063\u305f\u4ef6 \u6982\u8981 AWS lambda\u306eSELECT\u6587\u306e\u4e2d\u3067\u3001\u5024\u3092\u76f4\u63a5\u4ee3\u5165\u3059\u308b\u66f8\u304d\u65b9\u3092\u3057\u3066\u3044\u305f\u304c\u3001\u52d5\u304b\u306a\u304b\u3063\u305f\u3002 SQL\u3092\u66f8 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":8348,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[256],"tags":[],"class_list":["post-8347","post","type-post","status-publish","format-standard","has-post-thumbnail","category-it","entry"],"_links":{"self":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8347"}],"version-history":[{"count":1,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8347\/revisions"}],"predecessor-version":[{"id":8349,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8347\/revisions\/8349"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/media\/8348"}],"wp:attachment":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}