예제 #1
0
파일: BMode.py 프로젝트: edgarJ91/tytus
def extractTable(database: str, table: str) -> list:
    try:
        b.dicDB[database][table][0] = serializar.rollback(database + "-" +
                                                          table + "-B")
    except:
        pass
    return b.extractTable(database, table)
예제 #2
0
파일: BMode.py 프로젝트: edgarJ91/tytus
def extractRangeTable(database: str, table: str, columnNumber: int, lower: any,
                      upper: any) -> list:
    try:
        b.dicDB[database][table][0] = serializar.rollback(database + "-" +
                                                          table + "-B")
    except:
        pass
    return b.extractRangeTable(database, table, columnNumber, lower, upper)
예제 #3
0
def alterAddColumn(database: str, table: str, default: any) -> int:
    try:
        b.dicDB[database][table][0] = serializar.rollback(database+"-"+table+"-B")
    except:
        pass
    r = b.alterAddColumn(database, table, default)
    try:
        b.dicDB[database][table][0] = bt.arbolB(b.grade)
        serializar.commit(b, "BDD")
    except:
        pass
    return r
예제 #4
0
def alterDropPK(database: str, table: str) -> int:
    try:
        b.dicDB[database][table][0] = serializar.rollback(database+"-"+table+"-B")
    except:
        pass
    r = b.alterDropPK(database, table)
    try:
        b.dicDB[database][table][0] = bt.arbolB(b.grade)
        serializar.commit(b, "BDD")
    except:
        pass
    return r
예제 #5
0
def delete(database: str, table: str, columns: list) -> int:
    try:
        b.dicDB[database][table][0] = serializar.rollback(database+"-"+table+"-B")
    except:
        pass
    r = b.delete(database, table, columns)
    try:
        serializar.commit(b.dicDB[database][table][0], database+"-"+table+"-B")
        b.dicDB[database][table][0] = bt.arbolB(b.grade)
        serializar.commit(b, "BDD")
    except:
        pass
    return r
예제 #6
0
def loadCSV(file: str, database: str, table: str) -> list:
    try:
        b.dicDB[database][table][0] = serializar.rollback(database+"-"+table+"-B")
    except:
        pass
    r = b.loadCSV(file, database, table)
    try:
        serializar.commit(b.dicDB[database][table][0], database+"-"+table+"-B")
        b.dicDB[database][table][0] = bt.arbolB(b.grade)
        serializar.commit(b, "BDD")
    except:
        pass
    return r
예제 #7
0
def insert(database: str, table: str, register: list) -> int:
    try:
        b.dicDB[database][table][0] = serializar.rollback(database+"-"+table+"-B")
    except:
        pass
    r = b.insert(database, table, register)
    try:
        serializar.commit(b.dicDB[database][table][0], database+"-"+table+"-B")
        b.dicDB[database][table][0] = bt.arbolB(b.grade)
        serializar.commit(b, "BDD")
    except:
        pass
    return r
예제 #8
0
# File:     B Mode Package
# License:  Released under MIT License
# Notice:   Copyright (c) 2020 TytusDB Team

from team17 import DataBase as db
from team17 import Serializable as serializar
from team17 import Interfaz as interfaz
from team17 import Estructura_ArbolB as bt

b = db.DB()

try:
    b = serializar.rollback("BDD")
except:
    serializar.commit(b, "BDD")

#---------------------FUNCIONES BASES DE DATOS----------------------#

def createDatabase(database: str) -> int:
    r = b.createDatabase(database)
    serializar.commit(b, "BDD")
    return r

def showDatabases() -> list:
    return b.showDatabases()

def alterDatabase(databaseOld, databaseNew) -> int:
    r = b.alterDatabase(databaseOld, databaseNew)
    serializar.commit(b, "BDD")
    return r