python调用mysql存储过程没有反应
ringa_lee
ringa_lee 2017-04-17 17:49:40
0
2
608

建表:

drop table if exists `Account`;
CREATE TABLE `Account` (
`id` BIGINT(20) NOT NULL,
`Name` VARCHAR(100) NOT NULL,
`pwd` VARCHAR(100) NOT NULL,
`times` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'
)ENGINE=InnoDB

插入数据:

INSERT INTO `Account` (`id`, `Name`, `pwd`, `times`) VALUES
(1, 'Messiah', '59data', 0),
(2, 'zmx', 'data', 0),
(3, '59store', '盖亚', 1);

建立储存过程:

DELIMITER //
DROP PROCEDURE IF EXISTS `proctest`//
CREATE PROCEDURE`proctest`()
BEGIN
insert into  Account
VALUES(5,'盖亚','59store',9);
END //

Python 脚本:

#!/usr/bin/env python
# -*- coding: utf8 -*-
import MySQLdb
import time
import os, sys, string
conn = MySQLdb.connect(host='192.168.1.59',user='59data',passwd='59store',db='test')
cur =conn.cursor()
#sql='call proctest'
#cur.execute(sql)
cur.callproc('proctest',())
cur.close()
conn.close()

Python 脚本用 MySQLdb 模块 callproc 方法调用 mysql 存储过程没有任何反应

ringa_lee
ringa_lee

ringa_lee

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!