Rework:solve problem of saving result of --sql-query in CSV file

This commit is contained in:
Aridhi-Dhia-eddine 2024-04-12 01:57:23 +01:00
parent cc7c5e7950
commit 372f80cfce

View File

@ -712,19 +712,18 @@ class Dump(object):
def sqlQuery(self, query, queryRes):
self.string(query, queryRes, content_type=CONTENT_TYPE.SQL_QUERY)
print ("mon output est ",queryRes)
#code to extract columns from the request
deb="SELECT"
fin="FROM"
temp1=(query.upper()).find(deb)
#print ("mon output est ",temp1)
temp2=(query.upper()).find(fin)
#print ("mon output est ",temp2)
T=len(deb)-temp1+1
temp_res=query[T:temp2]
temp_res=(temp_res.strip()).split(',')
print ("mon output est ",temp_res)
#******************************************
#dictionarie for every value in queryRes
dt_save=[]
@ -747,6 +746,7 @@ class Dump(object):
else:
print("data don't exist to create CSV file")
def rFile(self, fileData):
self.lister("files saved to", fileData, sort=False, content_type=CONTENT_TYPE.FILE_READ)