some fixes

This commit is contained in:
Miroslav Stampar 2012-01-13 14:10:53 +00:00
parent 7e560eec1f
commit accac776fe
4 changed files with 47 additions and 13 deletions

View File

@ -56,20 +56,27 @@ class Connector(GenericConnector):
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.warn(msg) logger.warn(msg)
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

View File

@ -51,8 +51,11 @@ class Connector(GenericConnector):
return None return None
def execute(self, query): def execute(self, query):
retVal = False
try: try:
self.cursor.execute(query) self.cursor.execute(query)
retVal = True
except (pymysql.OperationalError, pymysql.ProgrammingError), msg: except (pymysql.OperationalError, pymysql.ProgrammingError), msg:
logger.warn(msg[1]) logger.warn(msg[1])
except pymysql.InternalError, msg: except pymysql.InternalError, msg:
@ -60,6 +63,12 @@ class Connector(GenericConnector):
self.connector.commit() self.connector.commit()
return retVal
def select(self, query): def select(self, query):
self.execute(query) retVal = None
return self.fetchall()
if self.execute(query):
retVal = self.fetchall()
return retVal

View File

@ -60,8 +60,11 @@ class Connector(GenericConnector):
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 (cx_Oracle.DatabaseError), msg: except (cx_Oracle.DatabaseError), msg:
logger.warn(msg) logger.warn(msg)
except cx_Oracle.InternalError, msg: except cx_Oracle.InternalError, msg:
@ -69,6 +72,12 @@ class Connector(GenericConnector):
self.connector.commit() self.connector.commit()
return retVal
def select(self, query): def select(self, query):
self.execute(query) retVal = None
return self.fetchall()
if self.execute(query):
retVal = self.fetchall()
return retVal

View File

@ -55,8 +55,11 @@ class Connector(GenericConnector):
return None return None
def execute(self, query): def execute(self, query):
retVal = False
try: try:
self.cursor.execute(query) self.cursor.execute(query)
retVal = True
except (psycopg2.OperationalError, psycopg2.ProgrammingError), msg: except (psycopg2.OperationalError, psycopg2.ProgrammingError), msg:
logger.warn(msg) logger.warn(msg)
except psycopg2.InternalError, msg: except psycopg2.InternalError, msg:
@ -64,6 +67,12 @@ class Connector(GenericConnector):
self.connector.commit() self.connector.commit()
return retVal
def select(self, query): def select(self, query):
self.execute(query) retVal = None
return self.fetchall()
if self.execute(query):
retVal = self.fetchall()
return retVal