(self, sql)
| 115 | return self |
| 116 | |
| 117 | def execute(self, sql): |
| 118 | # 执行SQL语句返回受影响行 |
| 119 | if self.__DB_CONN is None: |
| 120 | status, err_msg = self.connect() |
| 121 | if status is False: |
| 122 | return err_msg |
| 123 | if self.__DB_CONN.closed or self.__DB_CUR.closed: # 判断是否关闭,关闭重新连接 |
| 124 | status, err_msg = self.connect() |
| 125 | if status is False: |
| 126 | return err_msg |
| 127 | try: |
| 128 | # print(sql) |
| 129 | result = self.__DB_CUR.execute(sql) |
| 130 | self.__DB_CONN.commit() |
| 131 | self.__Close() |
| 132 | return result |
| 133 | except Exception as ex: |
| 134 | |
| 135 | return ex |
| 136 | |
| 137 | def query(self, sql): |
| 138 |
no test coverage detected