码迷,mamicode.com
首页 > 数据库 > 详细

python 模块 DButils

时间:2019-03-04 12:46:47      阅读:506      评论:0      收藏:0      [点我收藏+]

标签:cti   base   dbutil   python 模块   exec   port   word   locking   div   

 

# 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)

 

python 模块 DButils

标签:cti   base   dbutil   python 模块   exec   port   word   locking   div   

原文地址:https://www.cnblogs.com/Anec/p/10469920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!