示例#1
0
 def __noIntent_selectAll__(self):
     conn, cursor = DB().DBconnect()
     command = """
                       select Question from CBT_NoIntent_VIW
                       """
     try:
         cursor.execute(command)
         for row in cursor:
             print(row)
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#2
0
 def ShowSlots(self):
     conn, cursor = DB().DBconnect()
     command = """
     Select * From CBT_LKP_Slot
     """
     try:
         cursor.execute(command)
         for row in cursor:
             print(row)
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#3
0
 def __noIntent_delete__(self, _id):
     conn, cursor = DB().DBconnect()
     command = """
                          EXEC CBT_NoIntent_DEL @ID=?
                          """
     arg = _id
     try:
         cursor.execute(command, arg)
         print("Deleted Successfully")
         conn.commit()
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#4
0
 def __noIntent_update__(self, _id, Q):
     conn, cursor = DB().DBconnect()
     command = """
                       EXEC CBT_NoIntent_UPD @ID=?, @Question=?
                       """
     arg = (_id, Q)
     try:
         cursor.execute(command, arg)
         print("Updated Successfully")
         conn.commit()
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#5
0
 def __noIntent_insert__(self, Q):
     conn, cursor = DB().DBconnect()
     command = """
               EXEC CBT_NoIntent_INS @Question=?
               """
     arg = Q
     try:
         cursor.execute(command, arg)
         print("Inserted Successfully")
         conn.commit()
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#6
0
 def __lowProb_insert__(self, Q, IntentID):
     conn, cursor = DB().DBconnect()
     command = """
               EXEC CBT_LowProb_INS @Question=?, @IntentID=?
               """
     arg = (Q, IntentID)
     try:
         cursor.execute(command, arg)
         print("Inserted Successfully")
         conn.commit()
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#7
0
    def __lowProb_selectIntent__(self, ID):
        conn, cursor = DB().DBconnect()
        command = """
                          select * from CBT_LowProb_VIW where IntentID= %d
                          """ % ID

        try:
            cursor.execute(command)
            for row in cursor:
                print(row)
        except Exception as e:
            print("Error ", e)
        DB().DBdisconnect()
示例#8
0
 def __feedback_update__(self, _id, Log_ID, Rate, Message):
     conn, cursor = DB().DBconnect()
     command = """
            EXEC CBT_Feedback_UPD @id=?, @logid=? , @rate=? , @text=?
            """
     arg = (_id, Log_ID, Rate, Message)
     try:
         cursor.execute(command, arg)
         print("updated Successfully")
         conn.commit()
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#9
0
 def SaveIntent(self, name):
     conn, cursor = DB().DBconnect()
     command = """
     EXEC CBT_LKP_Intent_INS @Name=?
     """
     arg = name
     try:
         cursor.execute(command, arg)
         print("Inserted Successfully")
         conn.commit()
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#10
0
 def SaveIntentSlot(self, intentID, slotID):
     conn, cursor = DB().DBconnect()
     command = """
     EXEC CBT_LNK_IntentSlot_INS @IntentID=? , @SlotID=?
     """
     arg = (intentID, slotID)
     try:
         cursor.execute(command, arg)
         print("Inserted Successfully")
         conn.commit()
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
示例#11
0
 def GetSlot(self, name):
     conn, cursor = DB().DBconnect()
     command = """
     Select ID From CBT_LKP_Slot Where Name = '{0}'
     """.format(name)
     try:
         tpl = []
         cursor.execute(command)
         for row in cursor:
             tpl.append(row)
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
     return tpl
示例#12
0
 def GetIntentSlot(self, IntentName):
     conn, cursor = DB().DBconnect()
     command = """
     Select Slot From CBT_LNK_IntentSlot_VIW Where Intent = '{0}'   
     """.format(IntentName)
     try:
         tpl = []
         cursor.execute(command)
         for row in cursor:
             tpl.append(row)
     except Exception as e:
         print("Error ", e)
     DB().DBdisconnect()
     return tpl
示例#13
0
    def UpdateIntent(self, id, name):
        conn, cursor = DB().DBconnect()
        command = """
        EXEC CBT_LKP_Intent_UPD @ID=? ,@Name=? 
        """
        arg = (id, name)
        try:
            cursor.execute(command, arg)
            print("Updated Successfully")
            conn.commit()

        except Exception as e:
            print("Error ", e)
        DB().DBdisconnect()
示例#14
0
    def DeleteIntentSlot(self, id):
        conn, cursor = DB().DBconnect()
        command = """
        EXEC CBT_LNK_IntentSlot_DEL @ID=?
        """
        arg = id
        try:
            cursor.execute(command, arg)
            print("Deleted Successfully")
            conn.commit()

        except Exception as e:
            print("Error ", e)
        DB().DBdisconnect()