Esempio n. 1
0
 def AddTestcases(self):
     db = dbconfig()
     db.cursor.execute(
         "insert into testcase_details(input_sentence,source_language_id,created_date,test_case_id,test_status) value('%s','%d','%s','%d','%d')"
         % (self.input_sentence, self.language, self.created_date,
            self.source_id, self.test_status))
     db.db.commit()
Esempio n. 2
0
 def GetLanguageById(self,id):
     db=dbconfig()
     Language1=Languages()
     db.cursor.execute("select * from languages where id='%d'"%id)
     result=db.cursor.fetchone()
     Language1.id=result[0]
     Language1.name=result[1]
     return Language1
Esempio n. 3
0
 def GetTranslators(self):
     db = dbconfig()
     translator_list = []
     db.cursor.execute("select * from translator")
     result = db.cursor.fetchall()
     for row in result:
         translator1 = self.DBObjecttMapper(row)
         translator_list.append(translator1)
     return translator_list
Esempio n. 4
0
 def AddTranslator(self):
     db = dbconfig()
     db.cursor.execute(
         "insert into translator(name,api_key,input_element,output_element,submit_element,source_language_element,"
         +
         "target_language_element,url) value('%s','%s','%s','%s','%s','%s','%s','%s')"
         %
         (self.name, self.api_key, self.input_element, self.output_element,
          self.submit_element, self.source_language_element,
          self.target_language_element, self.url))
     db.db.commit()
Esempio n. 5
0
 def GetLanguages(self):
     language_list=[]
     db=dbconfig()
     db.cursor.execute("select * from languages")
     result=db.cursor.fetchall()
     for row in result:
         Language=Languages()
         Language.id=row[0]
         Language.name=row[1]
         language_list.append(Language)
     return language_list
Esempio n. 6
0
 def GetSearchResults(self,By,param):
         search_list=[]
         sql="select * from result_url"
         sql={
             'id':self.QueryBuilder("id",param),
             'result':self.QueryBuilder("result_id",param)
         }[By]    
         db=dbconfig()
         db.cursor.execute(sql)
         result=db.cursor.fetchall()
         for row in result:
             result=self.DBObjectMapper(row)
             search_list.append(result)
         return search_list
Esempio n. 7
0
 def GetTestCases(self, By, param):
     testcase_list = []
     sql = "select * from testcase_details"
     sql = {
         'id': self.QueryBuilder("id", param),
         'language': self.QueryBuilder("source_language_id", param),
         'source': self.QueryBuilder("test_case_id", param),
         'status': self.QueryBuilder("test_status", param)
     }[By]
     db = dbconfig()
     db.cursor.execute(sql)
     result = db.cursor.fetchall()
     for row in result:
         result = self.DBObjectMapper(row)
         testcase_list.append(result)
     return testcase_list
Esempio n. 8
0
 def GetTestResults(self,By,param):
     result_list=[]
     sql="select * from result"
     sql={
         'id':self.QueryBuilder("id",param),
         'testcase':self.QueryBuilder("test_case_detail_id",param),
         'language':self.QueryBuilder("target_language_id",param),
         'translator':self.QueryBuilder("translator_id",param)
     }[By]    
     db=dbconfig()
     db.cursor.execute(sql)
     result=db.cursor.fetchall()
     for row in result:
         result=self.DBObjectMapper(row)
         result_list.append(result)
     return result_list
Esempio n. 9
0
 def GetTranslatorById(self, id):
     db = dbconfig()
     db.cursor.execute("select * from translator where id='%d'" % id)
     row = db.cursor.fetchone()
     translator1 = self.DBObjecttMapper(row)
     return translator1
Esempio n. 10
0
 def AddSearchResults(self):
     db=dbconfig()
     db.cursor.execute("insert into result_url(result_id,result_text,url_no,created_date"+") value('%d','%s','%d','%s')"
     %(self.result_id, self.result_url, self.url_no, self.created_date))
     db.db.commit()
Esempio n. 11
0
 def AddTestcaseSource(self, source):
     db = dbconfig()
     db.cursor.execute("insert into testcases(source) value('%s')" % source)
     db.db.commit()
Esempio n. 12
0
 def AddTestCases(self):
     db=dbconfig()
     db.cursor.execute("insert into result(test_case_detail_id,translator_id,target_language_id,forward_translation,result,created_date,reverse_translation"+
     ") value('%d','%d','%d','%s','%f','%s','%s')"
     %(self.testcase_id, self.translator_id, self.target_language_id, self.forward_translation, self.result, self.created_date, self.reverse_translation))
     db.db.commit()
Esempio n. 13
0
 def AddLanguages(self):
     db=dbconfig()
     db.cursor.execute("insert into languages(name) value('%s')"%self.name)
     db.db.commit()