Пример #1
0
    def join(self, table1, table2, selection1, selection2, cond):
        ctlg1 = catalogCore()
        ctlg1.loadCatalog(table1)
        ctlg2 = catalogCore()
        ctlg2.loadCatalog(table2)
        pgmg = pageManager()
        io_s = general()
        cond1pos = -1
        cond2pos = -1

        for x in range(len(ctlg1.catalog)):
            if ctlg1.catalog[x][0] == cond:
                cond1pos = x

        for x in range(len(ctlg2.catalog)):
            if ctlg2.catalog[x][0] == cond:
                cond2pos = x

        joinedVals = []
        for x in selection1:
            for y in selection2:
                if x[1][cond1pos] == y[1][cond2pos]:
                    newv = []
                    newv.extend(x[1])
                    newv.extend(y[1])
                    joinedVals.append(newv)
                    print(newv)
        return joinedVals
Пример #2
0
    def selection(self, table, values, function = None, newValues = None):
        ctlg = catalogCore()
        ctlg.loadCatalog(table)

        pgmg = pageManager()
        io_s = general()
        print("Values not verified.")

        vals = self.buildValues(ctlg)
        newVals = None
        if newValues is not None:
            newVals = self.buildValues(ctlg)
            for x in range(len(newValues)):
                for y in range(len(ctlg.catalog)):
                    val1 = newValues[x][0]
                    val2 = ctlg.catalog[y][0]
                    if val1 == val2:
                        newVals[y] = newValues[x][1]

        for x in range(len(values)):
            for y in range(len(ctlg.catalog)):
                print("VER: " + str(ctlg.catalog[y][0]))
                val1 = str(values[x][0]).replace("'", "")
                val2 = str(ctlg.catalog[y][0]).replace("'", "")
                if values[x][1] == '=':
                    if val1 == val2:
                        vals[y] = values[x][2].replace("'", "")
                else:
                    print ("NO OPERATOR #322")

        print("VALS: " + str(vals))
        x = pgmg.readValues(table, vals, function, newVals)
        return x
        print(len(x))
Пример #3
0
    def selection(self, table, values, function=None, newValues=None):
        ctlg = catalogCore()
        ctlg.loadCatalog(table)

        pgmg = pageManager()
        io_s = general()
        print("Values not verified.")

        vals = self.buildValues(ctlg)
        newVals = None
        if newValues is not None:
            newVals = self.buildValues(ctlg)
            for x in range(len(newValues)):
                for y in range(len(ctlg.catalog)):
                    val1 = newValues[x][0]
                    val2 = ctlg.catalog[y][0]
                    if val1 == val2:
                        newVals[y] = newValues[x][1]

        for x in range(len(values)):
            for y in range(len(ctlg.catalog)):
                val1 = values[x][0]
                val2 = ctlg.catalog[y][0]
                if val1 == val2:
                    vals[y] = values[x][1]

        x = pgmg.readValues(table, vals, function, newVals)
        return x
        print(len(x))
Пример #4
0
    def join(self, table1, table2, selection1, selection2, cond):
        ctlg1 = catalogCore()
        ctlg1.loadCatalog(table1)
        ctlg2 = catalogCore()
        ctlg2.loadCatalog(table2)
        pgmg = pageManager()
        io_s = general()
        cond1pos = -1
        cond2pos = -1

        for x in range(len(ctlg1.catalog)):
            if ctlg1.catalog[x][0] == cond:
                cond1pos = x

        for x in range(len(ctlg2.catalog)):
            if ctlg2.catalog[x][0] == cond:
                cond2pos = x

        joinedVals = []
        for x in selection1:
            for y in selection2:
                if x[1][cond1pos] == y[1][cond2pos]:
                    newv = []
                    newv.extend(x[1])
                    newv.extend(y[1])
                    joinedVals.append(newv)
                    print(newv)
        return joinedVals
Пример #5
0
    def selection(self, table, values, function = None, newValues = None):
        ctlg = catalogCore()
        ctlg.loadCatalog(table)

        pgmg = pageManager()
        io_s = general()
        print("Values not verified.")

        vals = self.buildValues(ctlg)
        newVals = None
        if newValues is not None:
            newVals = self.buildValues(ctlg)
            for x in range(len(newValues)):
                for y in range(len(ctlg.catalog)):
                    val1 = newValues[x][0]
                    val2 = ctlg.catalog[y][0]
                    if val1 == val2:
                        newVals[y] = newValues[x][1]

        for x in range(len(values)):
            for y in range(len(ctlg.catalog)):
                val1 = values[x][0]
                val2 = ctlg.catalog[y][0]
                if val1 == val2:
                    vals[y] = values[x][1]


        x = pgmg.readValues(table, vals, function, newVals)
        return x
        print(len(x))
Пример #6
0
    def selection(self, table, values):
        ctlg = catalogCore()
        ctlg.loadCatalog(table)
        pgmg = pageManager()
        io_s = general()
        print("Values not verified.")

        pgmg.readValues(table)
Пример #7
0
 def insertRecord(self, table, values):
     ctlg = catalogCore()
     ctlg.loadCatalog(table)
     io_s = general()
     print("Values not verified.")
     if len(ctlg.catalog) == len(values):
         pgmg = pageManager()
         pgmg.writeValue(table, values)
     else:
         print("Number of values does not match table columns")
Пример #8
0
 def insertRecord(self, table, values):
     ctlg = catalogCore()
     ctlg.loadCatalog(table)
     io_s = general()
     print("Values not verified.")
     if len(ctlg.catalog) == len(values):
         pgmg = pageManager()
         pgmg.writeValue(table, values)
     else:
         print("Number of values does not match table columns")
Пример #9
0
 def delete(self, table, values, newvalues):
     sel = select()
     pgmg = pageManager()
     sel.selection(table, values, pgmg.deleteValues, newvalues)
Пример #10
0
 def delete(self, table, values, newvalues):
     sel = select()
     pgmg = pageManager()
     sel.selection(table, values, pgmg.deleteValues, newvalues)