1. <small id='rqK7O'></small><noframes id='rqK7O'>

      <legend id='rqK7O'><style id='rqK7O'><dir id='rqK7O'><q id='rqK7O'></q></dir></style></legend>
      • <bdo id='rqK7O'></bdo><ul id='rqK7O'></ul>

        <i id='rqK7O'><tr id='rqK7O'><dt id='rqK7O'><q id='rqK7O'><span id='rqK7O'><b id='rqK7O'><form id='rqK7O'><ins id='rqK7O'></ins><ul id='rqK7O'></ul><sub id='rqK7O'></sub></form><legend id='rqK7O'></legend><bdo id='rqK7O'><pre id='rqK7O'><center id='rqK7O'></center></pre></bdo></b><th id='rqK7O'></th></span></q></dt></tr></i><div id='rqK7O'><tfoot id='rqK7O'></tfoot><dl id='rqK7O'><fieldset id='rqK7O'></fieldset></dl></div>
        <tfoot id='rqK7O'></tfoot>

        Python MYSQL 更新语句

        Python MYSQL update statement(Python MYSQL 更新语句)
      1. <legend id='4EGxE'><style id='4EGxE'><dir id='4EGxE'><q id='4EGxE'></q></dir></style></legend>

              <tbody id='4EGxE'></tbody>

            <small id='4EGxE'></small><noframes id='4EGxE'>

            • <bdo id='4EGxE'></bdo><ul id='4EGxE'></ul>

              <i id='4EGxE'><tr id='4EGxE'><dt id='4EGxE'><q id='4EGxE'><span id='4EGxE'><b id='4EGxE'><form id='4EGxE'><ins id='4EGxE'></ins><ul id='4EGxE'></ul><sub id='4EGxE'></sub></form><legend id='4EGxE'></legend><bdo id='4EGxE'><pre id='4EGxE'><center id='4EGxE'></center></pre></bdo></b><th id='4EGxE'></th></span></q></dt></tr></i><div id='4EGxE'><tfoot id='4EGxE'></tfoot><dl id='4EGxE'><fieldset id='4EGxE'></fieldset></dl></div>
              <tfoot id='4EGxE'></tfoot>

                  本文介绍了Python MYSQL 更新语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试使这个 Python MYSQL 更新语句正确(带变量):

                  I'm trying to get this Python MYSQL update statement correct(With Variables):

                  cursor.execute ("UPDATE tblTableName SET Year=%s" % Year ", Month=%s" % Month ", Day=%s" % Day ", Hour=%s" % Hour ", Minute=%s" Minute "WHERE Server=%s " % ServerID)   
                  

                  有什么想法我哪里出错了吗?

                  Any ideas where I'm going wrong?

                  推荐答案

                  应该是:

                  cursor.execute ("""
                     UPDATE tblTableName
                     SET Year=%s, Month=%s, Day=%s, Hour=%s, Minute=%s
                     WHERE Server=%s
                  """, (Year, Month, Day, Hour, Minute, ServerID))
                  

                  您可以通过基本的字符串操作来实现,

                  You can also do it with basic string manipulation,

                  cursor.execute ("UPDATE tblTableName SET Year=%s, Month=%s, Day=%s, Hour=%s, Minute=%s WHERE Server='%s' " % (Year, Month, Day, Hour, Minute, ServerID))
                  

                  但是这种方式是不鼓励的,因为它会让您对 SQL 注入持开放态度.因为以正确的方式tm来做这件事很容易(和类似).正确地做.

                  but this way is discouraged because it leaves you open for SQL Injection. As it's so easy (and similar) to do it the right waytm. Do it correctly.

                  唯一需要注意的是,某些数据库后端不遵循相同的字符串替换约定(想到 SQLite).

                  The only thing you should be careful, is that some database backends don't follow the same convention for string replacement (SQLite comes to mind).

                  这篇关于Python MYSQL 更新语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)

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

                        1. <small id='iWAXL'></small><noframes id='iWAXL'>

                            <bdo id='iWAXL'></bdo><ul id='iWAXL'></ul>
                              <tbody id='iWAXL'></tbody>