Commit 44a51fe6 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Fixed bug in file catalog insert operation.

parent fc9a5149
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -5,4 +5,3 @@
INSERT INTO Node (parentPath, name, type, ownerID, creatorID) VALUES (NULL, '', 'container', '3354', '3354');         -- /
INSERT INTO Node (parentPath, name, type, ownerID, creatorID) VALUES ('', 'home', 'container', '3354', '3354');       -- /home
INSERT INTO Node (parentPath, name, type, ownerID, creatorID) VALUES ('2', 'curban', 'container', '3354', '3354');    -- /home/curban
INSERT INTO Node (parentPath, name, type, ownerID, creatorID) VALUES ('2.3', 'store', 'container', '3354', '3354');   -- /home/curban/store 
+5 −6
Original line number Diff line number Diff line
@@ -30,14 +30,13 @@ class DbConnector(object):

    def insertNode(self, node, parentOSPath):
        if(self.conn):
            print(f"parentOSPath: {parentOSPath}")
            #print(f"parentOSPath: {parentOSPath}")
            self.cursor.execute("SELECT get_ltree_path(%s)", (parentOSPath,))
            parentLtreePath = self.cursor.fetchone()[0]
            #print(f"parentLtreePath: {parentLtreePath}, type: {type(parentLtreePath)}")
            self.cursor.execute("INSERT INTO Node(parentPath, name, type, ownerID, creatorID) VALUES (%s, %s, %s, %s, %s);", 
                                (parentLtreePath, node.name, node.type, node.ownerID, node.creatorID))
            self.conn.commit()
            parentLtreePath = self.cursor.fetchall()            
            print(f"parentLtreePath: {parentLtreePath}")
            #self.cursor.execute("INSERT INTO Node(parentPath, name, type, ownerID, creatorID) VALUES (%s, %s, %s, %s, %s)", 
            #                    (parentLtreePath, node.name, node.type, node.ownerID, node.creatorID,))
            #self.conn.commit()

    def selectNode(self):
        pass
+1 −1
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ class StorePreprocessor(object):
            
        for flist in files:
            for file in flist:
                print(f"FILE {file}")
                print(f"FILE: {file}")
                dnode = Node(os.path.basename(file), "data")
                dnode.setParentPath(os.path.dirname(file))
                dnode.setOwnerID("3354")