align to MSSQL connector

This commit is contained in:
Bernardo Damele 2013-01-11 10:52:03 +00:00
parent ca337159f5
commit 2a2d7e886d

View File

@ -51,24 +51,31 @@ class Connector(GenericConnector):
try: try:
return self.cursor.fetchall() return self.cursor.fetchall()
except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg: except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg) logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
return None return None
def execute(self, query): def execute(self, query):
retVal = False
try: try:
self.cursor.execute(utf8encode(query)) self.cursor.execute(utf8encode(query))
retVal = True
except (pymssql.OperationalError, pymssql.ProgrammingError), msg: except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg) logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
except pymssql.InternalError, msg: except pymssql.InternalError, msg:
raise SqlmapConnectionException(msg) raise SqlmapConnectionException(msg)
return retVal
def select(self, query): def select(self, query):
self.execute(query) retVal = None
value = self.fetchall()
try: if self.execute(query):
self.connector.commit() retVal = self.fetchall()
except pymssql.OperationalError:
pass
return value try:
self.connector.commit()
except pymssql.OperationalError:
pass
return retVal