88"""
99
1010try :
11- import MySQLdb
11+ import pymysql
1212except ImportError , _ :
1313 pass
1414
2020
2121class Connector (GenericConnector ):
2222 """
23- Homepage: http://mysql-python.sourceforge.net /
24- User guide: http://mysql-python.sourceforge.net/MySQLdb.html
25- API: http://mysql-python.sourceforge.net/MySQLdb-1.2.2 /
26- Debian package: python-mysqldb
27- License: GPL
23+ Homepage: http://code.google.com/p/pymysql /
24+ User guide: http://code.google.com/p/pymysql/
25+ API: http://code.google.com/p/pymysql /
26+ Debian package: <none>
27+ License: MIT
2828
2929 Possible connectors: http://wiki.python.org/moin/MySQL
3030 """
@@ -36,8 +36,8 @@ def connect(self):
3636 self .initConnection ()
3737
3838 try :
39- self .connector = MySQLdb .connect (host = self .hostname , user = self .user , passwd = self .password , db = self .db , port = self .port , connect_timeout = conf .timeout , use_unicode = True )
40- except MySQLdb .OperationalError , msg :
39+ self .connector = pymysql .connect (host = self .hostname , user = self .user , passwd = self .password , db = self .db , port = self .port , connect_timeout = conf .timeout , use_unicode = True )
40+ except pymysql .OperationalError , msg :
4141 raise sqlmapConnectionException , msg [1 ]
4242
4343 self .setCursor ()
@@ -46,16 +46,16 @@ def connect(self):
4646 def fetchall (self ):
4747 try :
4848 return self .cursor .fetchall ()
49- except MySQLdb .ProgrammingError , msg :
49+ except pymysql .ProgrammingError , msg :
5050 logger .warn (msg [1 ])
5151 return None
5252
5353 def execute (self , query ):
5454 try :
5555 self .cursor .execute (query )
56- except (MySQLdb .OperationalError , MySQLdb .ProgrammingError ), msg :
56+ except (pymysql .OperationalError , pymysql .ProgrammingError ), msg :
5757 logger .warn (msg [1 ])
58- except MySQLdb .InternalError , msg :
58+ except pymysql .InternalError , msg :
5959 raise sqlmapConnectionException , msg [1 ]
6060
6161 self .connector .commit ()
0 commit comments