#!/usr/bin/env python
# -*- coding: utf8 -*-
import MysqLdb
import time
import os,sys,
String
def CallProc(id,onlinetim
E):
'''调用存储过程,
输入参数:编号,在线时间,输出:帐号,密码;
使用输出参数方式'''
accname=''
accpwd=''
conn = MysqLdb.connect(host='localhost',user='root',passwd='111111',db='ceshi')
cur =conn.
cursor()
cur.callproc('proctest',(id,onlinetime,accname,accpwd))
cur.execute('
SELEct @_proc
test_2,@_proc
test_3')
data=cur.fetchall()
if Data:
for rec in data:
accname=rec
[0]accpwd=rec[1]
cur.close()
conn.close(
);return accname,accpwd
def CallProct(id,onlinetim
E):
'''调用存储过程,
输入参数:编号,在线时间,输出:帐号,密码;
使用
SELEct返回记录方式'''
accname=''
accpwd=''
conn = MysqLdb.connect(host='localhost',db='ceshi')
cur =conn.
cursor()
cur.nextset()
cur.execute('call ptest(%s,%s)',onlinetim
E))
data=cur.fetchall()
if Data:
for rec in data:
accname=rec
[0]accpwd=rec[1]
cur.close()
conn.close(
);return accname,accpwd
name,pwd=CallProct(1,0)
pr
int name,pwd