Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
my_flask_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c945b37e
authored
Mar 19, 2024
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加测试类
1 parent
f39fd62b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
test05.py
test06.py
test05.py
0 → 100644
View file @
c945b37
from
config_dev
import
Config
import
mysql.connector
as
cpy
from
logger
import
log
config
=
{
"host"
:
Config
.
host
,
"port"
:
Config
.
port
,
"user"
:
Config
.
user
,
"password"
:
Config
.
password
,
"database"
:
Config
.
database
,
"use_pure"
:
True
,
}
def
execute_sql
(
sql
):
with
cpy
.
connect
(
**
config
)
as
cnx
:
with
cnx
.
cursor
(
buffered
=
True
)
as
cur
:
result
=
cur
.
execute
(
sql
)
print
(
result
)
log
.
info
(
"sql 执行结束"
)
if
__name__
==
"__main__"
:
# sql = "SELECT * FROM sys_order_ocr_sn_result"
sql
=
"UPDATE sys_order_ocr_sn_result SET file_id = 457 WHERE id = 16;"
execute_sql
(
sql
)
# end main
test06.py
0 → 100644
View file @
c945b37
import
pymysql
from
config_dev
import
Config
conn_dev
=
pymysql
.
connect
(
host
=
Config
.
host
,
port
=
Config
.
port
,
user
=
Config
.
user
,
password
=
Config
.
password
,
database
=
Config
.
database
,
charset
=
"utf8"
,
)
cursor_dev
=
conn_dev
.
cursor
()
# 定义要执行的SQL语句
SQL
=
"""
select * from sys_order_file_ocr_sn_01 sofon limit 2000
"""
# 执行SQL语句
cursor_dev
.
execute
(
SQL
)
# 获取查询结果
result
=
cursor_dev
.
fetchall
()
for
index
,
row
in
enumerate
(
result
):
print
(
row
)
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment