#: -*- coding: utf-8 -*-

import MySQLdb
from DBUtils.PooledDB import PooledDB

DB_HOST = '192.168.1.96'
DB_USER = 'dtwork'
DB_PASSWD = 'chenjie'
DB_DATABASE = 'db_uuseefm_com'
DB_PORT = 3306
DB_CHARSET = 'utf8'
DB_POOL_ARGS = (10,10,30,100,True,0,None)

conn_args = {
    'host': DB_HOST,
    'user': DB_USER,
    'passwd': DB_PASSWD,
    'db': DB_DATABASE,
    'port': DB_PORT,
    'charset': DB_CHARSET
}
pool = PooledDB(MySQLdb, *DB_POOL_ARGS, **conn_args)

#: 连接数据库
db = pool.connection()
#: 获取数据查询游标
cursor = db.cursor()

args = ('getcomments',(1781, 1, 2))
# cursor.callproc('getcomments',(1781, ))
cursor.callproc(*args)
print cursor.rowcount
result = cursor.fetchall()

print result