Exemple #1
0
    def __r_mod(ext, root=None):
        '''
        standard function
        return name and mtime
        REMAP

        @param string ext:    name
        @param string root:    pathname
        @return: tuple
        '''

        del ext
        return u_dir_info(root, True)
Exemple #2
0
    def __r_add(self, ext, root=None):
        '''
        standard function
        return info to be added into database
        REMAP

        @param string ext:    name
        @param string root:    pathname
        @return: tuple
        '''

        root = u_dir_info(root)
        return ext, self.idd, root[0], root[1]
Exemple #3
0
    def __init_install(self):
        '''
        build database structure

        @return: void
        '''

        self.__exec('''
                        CREATE TABLE DIR(
                            Id INTEGER PRIMARY KEY,
                            Name TEXT NOT NULL,
                            Parent INTEGER REFERENCES DIR(Id)
                                ON DELETE NO ACTION
                                ON UPDATE CASCADE,
                            Atime INTEGER(10) NOT NULL,
                            Mtime INTEGER(10) NOT NULL,
                            Lin INTEGER(1) NOT NULL DEFAULT 0,
                            Ltime INTEGER(10) DEFAULT 0,
                            Del INTEGER(1) NOT NULL DEFAULT 0,
                            Dtime INTEGER(10) DEFAULT 0,
                            Obsolete INTEGER(1) NOT NULL DEFAULT 0,
                        UNIQUE(Parent, Name)
                        );
                        ''')
        self.__exec('''
                        CREATE TABLE FILE(
                            Id INTEGER PRIMARY KEY,
                            Name TEXT NOT NULL,
                            Parent INTEGER REFERENCES DIR(Id)
                                ON DELETE NO ACTION
                                ON UPDATE CASCADE,
                            Size INTEGER NOT NULL,
                            Atime INTEGER(10) NOT NULL,
                            Mtime INTEGER(10) NOT NULL,
                            Hash TEXT(32) DEFAULT NULL,
                            Lin INTEGER(1) NOT NULL DEFAULT 0,
                            Ltime INTEGER(10) DEFAULT 0,
                            Del INTEGER(1) NOT NULL DEFAULT 0,
                            Dtime INTEGER(10) DEFAULT 0,
                            Obsolete INTEGER(1) NOT NULL DEFAULT 0,
                            UNIQUE(Parent, Name)
                        );
                        ''')

        self._add_single((self.base, 0), u_dir_info(self._dir), False)

        self.__loop_insert()
        return