第一个print就打印不出来,求大神帮我看下
import pymssql
class MSSQL:
def _init_(self,host,user,pwd,db):
print '666666'
self.host = host
self.user= user
self.pwd=pwd
self.db=db
print '66666666'
def _GetConnect(self):
if not self.db:
raise(NameError,"没有设置数据库信息")
self.conn=pymssql.connect(host=self.host,user=self.user,password=self.pwd,database=self.db,charset="utf8")
cur=self.conn.cursor()
if not cur:
raise(NameError,"连接数据库失败")
else:
return cur
print '22222222222'
def ExecQuery(self,sql):
ms= MSSQL(host="rds9462bhypwu91tzupvo.mysql.rds.aliyuncs.com ",user="msddevread",pwd="5SsvwfO8OHLo_6-Z",db="msd")
reslist = ms.ExecQuery("SELECT * FROM t_user_red_packet limit 100")
print '1111111111111111111111111111'
for i in reslist:
print i
cur = self._GetConnect()
cur.execute(sql)
reslist= cur.fetchall()
self.conn.close()
return reslist