def DeleteRecord(): env = SliceEnv() db_name = input("Input the table's name(For example:CustDB): ") sliceDB = env.open(db_name) index_col = sliceDB.db_index_col key_value = input("The key of the table "+db_name+" is "+index_col+", input the key value: ") value_list = sliceDB.delete(key_value) print(value_list) env.close(db_name)
def DeleteRecord(): env = SliceEnv() db_name = input("Input the table's name(For example:CustDB): ") sliceDB = env.open(db_name) index_col = sliceDB.db_index_col key_value = input("The key of the table " + db_name + " is " + index_col + ", input the key value: ") value_list = sliceDB.delete(key_value) print(value_list) env.close(db_name)
def DisplayJoin(): env = SliceEnv() left_name = input("Input the first database's name(For example:CustDB): ") right_name = input("Input the second database's name(For example:SalesDB): ") leftDB = env.open(left_name) rightDB = env.open(right_name) rightDB.join(leftDB) env.close(left_name) env.close(right_name) print('Join OK!')
def DisplayJoin(): env = SliceEnv() left_name = input("Input the first database's name(For example:CustDB): ") right_name = input( "Input the second database's name(For example:SalesDB): ") leftDB = env.open(left_name) rightDB = env.open(right_name) rightDB.join(leftDB) env.close(left_name) env.close(right_name) print('Join OK!')
def UpdateRecord(): env = SliceEnv() db_name = input("Input the table's name(For example:CustDB): ") sliceDB = env.open(db_name) sliceRecord = sliceDB.createRecord() fields = [] for item in sliceDB.db_schema: fields.append(item.get_field_name()) for field in fields: value = input('Input "' + field + '" value:') # print(value) if value: sliceRecord.setString(field, value) sliceDB.set(sliceRecord) env.close(db_name) print('Update OK')
def AddRecord(): env = SliceEnv() db_name = input("Input the database's name(For example:CustDB):") sliceDB = env.open(db_name) sliceRecord = sliceDB.createRecord() while 1: field = input('Input the field name(For example:cust),Press Enter to quit input: ') if field: value = input("Input the value: ") sliceRecord.setString(field,value) else: break sliceDB.set(sliceRecord) env.close(db_name) print('Add OK')
def AddRecord(): env = SliceEnv() db_name = input("Input the database's name(For example:CustDB):") sliceDB = env.open(db_name) sliceRecord = sliceDB.createRecord() while 1: field = input( 'Input the field name(For example:cust),Press Enter to quit input: ' ) if field: value = input("Input the value: ") sliceRecord.setString(field, value) else: break sliceDB.set(sliceRecord) env.close(db_name) print('Add OK')