久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='oZcD5'><tr id='oZcD5'><dt id='oZcD5'><q id='oZcD5'><span id='oZcD5'><b id='oZcD5'><form id='oZcD5'><ins id='oZcD5'></ins><ul id='oZcD5'></ul><sub id='oZcD5'></sub></form><legend id='oZcD5'></legend><bdo id='oZcD5'><pre id='oZcD5'><center id='oZcD5'></center></pre></bdo></b><th id='oZcD5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='oZcD5'><tfoot id='oZcD5'></tfoot><dl id='oZcD5'><fieldset id='oZcD5'></fieldset></dl></div>
  • <legend id='oZcD5'><style id='oZcD5'><dir id='oZcD5'><q id='oZcD5'></q></dir></style></legend>

    <small id='oZcD5'></small><noframes id='oZcD5'>

    <tfoot id='oZcD5'></tfoot>

          <bdo id='oZcD5'></bdo><ul id='oZcD5'></ul>

        內爆一個在 python MySQLDB IN 子句中使用的列表

        imploding a list for use in a python MySQLDB IN clause(內爆一個在 python MySQLDB IN 子句中使用的列表)
        <tfoot id='ORzuB'></tfoot><legend id='ORzuB'><style id='ORzuB'><dir id='ORzuB'><q id='ORzuB'></q></dir></style></legend>
          <i id='ORzuB'><tr id='ORzuB'><dt id='ORzuB'><q id='ORzuB'><span id='ORzuB'><b id='ORzuB'><form id='ORzuB'><ins id='ORzuB'></ins><ul id='ORzuB'></ul><sub id='ORzuB'></sub></form><legend id='ORzuB'></legend><bdo id='ORzuB'><pre id='ORzuB'><center id='ORzuB'></center></pre></bdo></b><th id='ORzuB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ORzuB'><tfoot id='ORzuB'></tfoot><dl id='ORzuB'><fieldset id='ORzuB'></fieldset></dl></div>
            <tbody id='ORzuB'></tbody>
        1. <small id='ORzuB'></small><noframes id='ORzuB'>

            • <bdo id='ORzuB'></bdo><ul id='ORzuB'></ul>
                  本文介紹了內爆一個在 python MySQLDB IN 子句中使用的列表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我知道如何將列表映射到字符串:

                  I know how to map a list to a string:

                  foostring = ",".join( map(str, list_of_ids) )
                  

                  而且我知道我可以使用以下內容將該字符串放入 IN 子句中:

                  And I know that I can use the following to get that string into an IN clause:

                  cursor.execute("DELETE FROM foo.bar WHERE baz IN ('%s')" % (foostring))
                  

                  我需要的是使用 MySQLDB 安全地完成同樣的事情(避免 SQL 注入).在上面的例子中,因為 foostring 沒有作為參數傳遞給 execute,所以它很容易受到攻擊.我還必須在 mysql 庫之外引用和轉義.

                  What I need is to accomplish the same thing SAFELY (avoiding SQL injection) using MySQLDB. In the above example because foostring is not passed as an argument to execute, it is vulnerable. I also have to quote and escape outside of the mysql library.

                  (有一個相關SO問題,但是那里列出的答案要么不適用于 MySQLDB,要么容易受到 SQL 注入的影響.)

                  (There is a related SO question, but the answers listed there either do not work for MySQLDB or are vulnerable to SQL injection.)

                  推薦答案

                  直接使用list_of_ids:

                  format_strings = ','.join(['%s'] * len(list_of_ids))
                  cursor.execute("DELETE FROM foo.bar WHERE baz IN (%s)" % format_strings,
                                  tuple(list_of_ids))
                  

                  這樣你就不用自己引用了,也避免了各種sql注入.

                  That way you avoid having to quote yourself, and avoid all kinds of sql injection.

                  請注意,數據 (list_of_ids) 作為參數(不在查詢文本中)直接進入 mysql 的驅動程序,因此沒有注入.您可以在字符串中保留您想要的任何字符,無需刪除或引用字符.

                  Note that the data (list_of_ids) is going directly to mysql's driver, as a parameter (not in the query text) so there is no injection. You can leave any chars you want in the string, no need to remove or quote chars.

                  這篇關于內爆一個在 python MySQLDB IN 子句中使用的列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)

                    <bdo id='5zn2y'></bdo><ul id='5zn2y'></ul>

                      <tfoot id='5zn2y'></tfoot>
                        <tbody id='5zn2y'></tbody>
                      <legend id='5zn2y'><style id='5zn2y'><dir id='5zn2y'><q id='5zn2y'></q></dir></style></legend>

                          • <small id='5zn2y'></small><noframes id='5zn2y'>

                            <i id='5zn2y'><tr id='5zn2y'><dt id='5zn2y'><q id='5zn2y'><span id='5zn2y'><b id='5zn2y'><form id='5zn2y'><ins id='5zn2y'></ins><ul id='5zn2y'></ul><sub id='5zn2y'></sub></form><legend id='5zn2y'></legend><bdo id='5zn2y'><pre id='5zn2y'><center id='5zn2y'></center></pre></bdo></b><th id='5zn2y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5zn2y'><tfoot id='5zn2y'></tfoot><dl id='5zn2y'><fieldset id='5zn2y'></fieldset></dl></div>
                            主站蜘蛛池模板: 国产成人99久久亚洲综合精品 | 狠狠草视频 | 玖玖国产 | 国产目拍亚洲精品99久久精品 | 日韩精品久久一区二区三区 | 精品网站999www | 国产美女精品 | 丝袜美腿一区二区三区动态图 | 欧美精品在线看 | 夜夜艹 | 岛国在线免费观看 | 一级黄色片免费在线观看 | 精品视频一区二区 | 亚洲综合色 | 人人叉 | 亚洲天堂一区 | 久久久久国产一区二区 | 视频在线观看一区 | 男人的天堂久久 | 二区在线观看 | 日韩视频1| 亚洲欧美激情视频 | www.三级| 免费观看国产视频在线 | 日韩视频在线一区 | 久久亚洲欧美日韩精品专区 | 日韩成人在线观看 | 免费看一区二区三区 | 中文字幕精品一区二区三区精品 | 欧美精品一区二区三区视频 | 亚洲精品久久久久久首妖 | 亚洲精品美女视频 | 一级黄色毛片免费 | 中文字幕一区在线 | 51ⅴ精品国产91久久久久久 | 在线视频一区二区 | 波多野结衣二区 | 狠狠爱网址 | 国产男人的天堂 | 国产精品成人一区二区 | 国产精品精品视频 |