zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    TinyOS功率编程指南
    深度学习入门资料
    通信常识
    CTF入门
    前端开发工具之服务器选择
    Spring
    NoSQL -- MongoDB
    NoSQL -- Redis
    mysql alter table修改表结构添加多个字段的几个写法
    gongle 访问助手安装
  • 原文地址:https://www.cnblogs.com/Anec/p/10469920.html
Copyright © 2011-2022 走看看