當前位置: 首頁>>代碼示例>>Python>>正文


Python DB.remove方法代碼示例

本文整理匯總了Python中db.DB.remove方法的典型用法代碼示例。如果您正苦於以下問題:Python DB.remove方法的具體用法?Python DB.remove怎麽用?Python DB.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在db.DB的用法示例。


在下文中一共展示了DB.remove方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import remove [as 別名]
class Notes:
    #Database names
    database = "NOTES"
    note_id = "id"
    data = "data"
    name= "name"
    password = "password"
    #Actual Note ID
    noteID = None

    def __init__(self,noteID):
        self.DB = DB(self.database, self.note_id)
        self.noteID = noteID
    
    def noteID(self):
        return noteID

    def index(self):
        return self.DB.select_all([self.note_id ,self.name],None,None,None)

    def select_note(self):
        row = self.DB.select_one(self.noteID, [self.data])
        if row:
            return str(row[0])
        return None
    
    def update_note(self, text):
        return self.DB.update(self.noteID,[self.data],[text])
    
    def update_note_name(self,name):
        return self.DB.update(self.noteID,[self.name],[name])

    def add_note(self,text,name):
        return self.DB.insert([self.data,self.name,self.password],[text,name,None])

    def remove_note(self):
        return self.DB.remove(self.noteID)

    def check_password(self, password):
        row = self.DB.select_one(self.noteID,[self.password])
        actual_password = row[0]
        if actual_password != None:
            actual_password = str(actual_password)

        if password != None and str(password) == actual_password:
            return True
        return False

    def set_password(self,new_pass):
        return self.DB.update(self.noteID,[self.password],[new_pass])

    def is_locked(self):
        row = self.DB.select_one(self.noteID,[self.password])
        password = row[0]
        if password==None or len(str(password)) == 0:
            return False
        else:
            return True
開發者ID:encryptix,項目名稱:notes,代碼行數:60,代碼來源:notes_backend.py

示例2: __init__

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import remove [as 別名]
class CalendarLog:
    #Database names
    database = "CALENDAR"
    entry_id = "id"
    data = "data"
    date= "date"
    password = "password"
    #Actual log ID
    logID = None

    def __init__(self,logID):
        self.DB = DB(self.database, self.entry_id)
        self.logID = logID
    
    def logID(self):
        return logID

    def index(self):
        return self.DB.select_all([self.entry_id ,self.date],None,None,None)
    
    def select_log(self):
        row = self.DB.select_one(self.logID, [self.data, self.date])
        return row

    def select_logs_range(self,start,end,limit):
        if start and end:
            return self.DB.select_all([self.entry_id ,self.date, self.data],[self.date+" >=", "AND "+self.date+" <="],[start,end],limit)
        elif start:
            return self.DB.select_all([self.entry_id ,self.date, self.data],[self.date+" >="],[start],limit)
        elif end:
            return self.DB.select_all([self.entry_id ,self.date, self.data],[self.date+" <="],[end],limit)
        else:
            return self.DB.select_all([self.entry_id ,self.date, self.data],None,None,limit)

    def update_log(self, text):
        return self.DB.update(self.logID,[self.data],[text])
    
    def update_log_date(self,date):
        return self.DB.update(self.logID,[self.date],[date])

    def add_log(self,text,date):
        return self.DB.insert([self.data,self.date,self.password],[text,date,None])

    def remove_log(self):
        return self.DB.remove(self.logID)

    def check_password(self, password):
        row = self.DB.select_one(self.logID,[self.password])
        actual_password = row[0]
        if actual_password != None:
            actual_password = str(actual_password)

        if password != None and str(password) == actual_password:
            return True
        return False

    def set_password(self,new_pass):
        return self.DB.update(self.logID,[self.password],[new_pass])

    def is_locked(self):
        row = self.DB.select_one(self.logID,[self.password])
        password = row[0]
        if password==None or len(str(password)) == 0:
            return False
        else:
            return True
開發者ID:encryptix,項目名稱:calendar,代碼行數:68,代碼來源:calendar_log.py


注:本文中的db.DB.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。