mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-21 23:51:09 +00:00
Minor patches
This commit is contained in:
parent
97c8b45ccc
commit
ab59a4b72a
8 changed files with 62 additions and 13 deletions
|
|
@ -54,11 +54,20 @@ class Connector(GenericConnector):
|
|||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex).replace("\n", " "))
|
||||
return None
|
||||
|
||||
def execute(self, query):
|
||||
def execute(self, query, commit=True):
|
||||
retVal = False
|
||||
|
||||
try:
|
||||
self.cursor.execute(getText(query))
|
||||
# Commit non-SELECT (DML/DDL) here: direct() routes those to execute() alone, so without this a
|
||||
# '--sql-query'/'--sql-shell' write was silently rolled back on connection close. select() passes
|
||||
# commit=False and commits only AFTER fetchall(), because on pymssql commit() discards the open
|
||||
# result cursor (which otherwise emptied every SELECT result).
|
||||
if commit:
|
||||
try:
|
||||
self.connector.commit()
|
||||
except pymssql.OperationalError:
|
||||
pass
|
||||
retVal = True
|
||||
except (pymssql.OperationalError, pymssql.ProgrammingError) as ex:
|
||||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex).replace("\n", " "))
|
||||
|
|
@ -70,7 +79,7 @@ class Connector(GenericConnector):
|
|||
def select(self, query):
|
||||
retVal = None
|
||||
|
||||
if self.execute(query):
|
||||
if self.execute(query, commit=False):
|
||||
retVal = self.fetchall()
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue