1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| output=''
if self._conf.db_servicename==None:
connectdata='SID='+self._conf.db_sid
else:
connectdata='SERVICE_NAME='+self._conf.db_servicename
instance='\'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST='+self._conf.db_host+')(PORT='+str(self._conf.db_port)+')))(CONNECT_DATA=('+connectdata+')))\''
password=self._conf.db_password
command=self._sqlplusTool+' '+self._conf.db_login+'/'+password+'@'+instance
temporaryIn,temporaryOut=os.popen4(command,'t',-1)
''' read from a temporary connection '''
temporaryIn.write(self._conf.getFlagCommand())
temporaryIn.flush()
out=temporaryOut.readline()
line=''
temporaryIn.write(request+"\n"+self._conf.getFlagCommand()+'\n')
temporaryIn.flush()
while not line.startswith(self._conf.getFlagRes()):
output+=line.replace ("\n\r","\n")
line=temporaryOut.readline()
temporaryOut.flush()
temporaryOut.close()
temporaryOut=None
temporaryIn.flush()
temporaryIn.close()
temporaryIn=None
return output |
Partager