def getAgents(self,role,host,user,password,database,port): filterAgentsQuery = 'SELECT user_id, role_id FROM bima_user_role_permission WHERE user_id > 0 and role_id = '+role logging.debug(filterAgentsQuery) validAgents = DBUtils.executeSelectQuery(filterAgentsQuery, host, user, password, database, port) return validAgents
def testSelectQuery(): role = ConfigReader.getValue('db', 'role') filterAgentsQuery = 'SELECT user_id, role_id FROM bima_user_role_permission WHERE user_id < 0 and role_id = ' + role + ' limit 10' res = DBUtils.executeSelectQuery(filterAgentsQuery) print 'Result is None for ' + filterAgentsQuery if res is None: pass print 'Zero results found for ' + filterAgentsQuery if (len(res) == 0): pass print 'res: ' for row in res: print 'user_id - ' + str(row[0]) + ', role_id - ' + str(row[1])
def getRemCountForAgent(self,agentId, limit, pendStatus,host,user,password,database,port): qry = 'SELECT COUNT(*) FROM welcome_calls WHERE agent_id='+str(agentId)+' AND '+' status='+str(pendStatus) rem = DBUtils.executeSelectQuery(qry, host, user, password, database, port) logging.debug('rem='+str(rem)) return (limit - int(rem[0][0]))
def getMaxValWelCal(self,max): # Get valid welcome_calls, where status=0 or status=4. [NEW, INCOMPLETE] validWelcomeCallsQuery = self.makeValidWelCalQry(max) valWelCal = DBUtils.executeSelectQuery(validWelcomeCallsQuery) return valWelCal