python 模块 DButils

 

# DButils 为了解决多客户端都需要操作数据库的问题.
# import pymysql
# from DBUtils.PooledDB import PooledDB
#
# POOL = PooledDB(creator=pymysql,
#                 mincached=2,
#                 maxcached=5,
#                 maxshared=3,
#                 maxconnections=6,
#                 blocking=True,
#                 maxusage=None,
#                 ping=4,
#                 host='172.16.2.106',
#                 port=3306,
#                 user='root',
#                 password='123456',
#                 database='anec',
#                 charset='utf8'
#                 )
#
# coon = POOL.connection()
# cursor = coon.cursor(cursor=pymysql.cursors.DictCursor)

# info_msg = {
#     'cx':'select * from text where id=1',
#     'cr':'insert into text(id,name,phone,enail) values(2,"alex","123123213","123@qewq.com")'
# }

# 查询数据
# cursor.execute('select * from text ')
# ret = cursor.fetchall()

# 增加数据
# cursor.execute('insert into text(id,name,phone,enail) values(2,"alex","123123213","123@qewq.com")')
# coon.commit()

#
# 删除一条数据
# cursor.execute('delete from text where id=2')
# coon.commit()

# 修改数据
# cursor.execute('update text set phone = 18711068587 where id=1')
# coon.commit()

# cursor.execute('select * from text')
# ret = cursor.fetchall()
# coon.close()
# print(ret)

 

转载于:https://www.cnblogs.com/Anec/p/10469920.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值