-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpexpect_test.py
More file actions
24 lines (22 loc) · 837 Bytes
/
Copy pathpexpect_test.py
File metadata and controls
24 lines (22 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding: gbk -*-
print('中文测试')
import mysql.connector
def Query_SMS_Box_Count(platname):
print('查询MAS平台对接系统短信积压数量')
cn = mysql.connector.connect(user = 'root',password = 'ceb1234',host = '127.0.0.1' ,database = 'mas')
cursor = None
try:
cursor = cn.cursor()
query = ('select count(*) from mas_sms_outbox where service_id= ' + '\''+platname + '\''+';')
#print(query)
cursor.execute(query)
result_list = cursor.fetchone()
except mysql.connector.error as err:
print("execute query table failed.")
print("error: {}".format(err.msg))
cursor.close()
cn.close()
return result_list
if __name__ == '__main__':
s = Query_SMS_Box_Count('ITIL')
print('result is '+ str(s[0]))