def insert(self, game): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Games']['insert'], CMD_TYPE_FUNCTION, ( game.bar_code, game.new_bar_code if 'new_bar_code' in vars( game) else game.bar_code, game.name, game.price, game.cost, game.stock, game.score, game.local_trailer, game.web_trailer, game.cover, game.info_media.genre, game.info_media.minimum_age, game.info_media.producer, game.info_media.distributor, game.info_media.subtitles, game.info_media.audios, game.info_media.synopsis, game.info_media.fisic_type, game.players, game.is_online, game.console, game.status ) )
def update(self, movie): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Movies']['update'], CMD_TYPE_FUNCTION, ( movie.bar_code, movie.new_bar_code if 'new_bar_code' in vars( movie) else movie.bar_code, movie.name, movie.price, movie.cost, movie.stock, movie.score, movie.local_trailer, movie.web_trailer, movie.cover, movie.info_media.genre, movie.info_media.minimum_age, movie.info_media.producer, movie.info_media.distributor, movie.info_media.subtitles, movie.info_media.audios, movie.info_media.synopsis, movie.info_media.fisic_type, movie.cast, movie.duraction, movie.screen_format, movie.status ) )
def get(self, identifier=None): sql = inout.get_queries_file() if identifier: return PgSqlDal.execute_query(sql['Address']['getOneOrMore'], CMD_TYPE_TEXT, (identifier,)) else: return PgSqlDal.execute_query(sql['Address']['getAll'], CMD_TYPE_TEXT)
def update(self, cash_desk_mov): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['CashDeskMovs']['update'], CMD_TYPE_FUNCTION, ( cash_desk_mov.value, cash_desk_mov.mov_type, cash_desk_mov.observations ) )
def insert(self, cash_desk): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['CashDesks']['insert'], CMD_TYPE_FUNCTION, ( cash_desk.functionary, cash_desk.cash_fund, cash_desk.observations, ) )
def get(self, zip_number=None): """ Return a list of tuples with the data of registers """ sql = inout.get_queries_file() if zip_number: return PgSqlDal.execute_query(sql['ZipCodes']['getOneOrMore'], CMD_TYPE_TEXT, (zip_number,)) else: return PgSqlDal.execute_query(sql['Zipcodes']['getAll'], CMD_TYPE_TEXT)
def update(self, address): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Address']['update'], CMD_TYPE_FUNCTION, ( address.identifier, address.zip_code, address.number, address.complement ) )
def update(self, devolution): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Devolutions']['update'], CMD_TYPE_FUNCTION, ( devolution.identifier, devolution.products, devolution.value, devolution.observations, devolution.returned_by ) )
def insert(self, cash_desk_mov): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['CashDeskMovs']['insert'], CMD_TYPE_FUNCTION, ( cash_desk_mov.cash_desk, cash_desk_mov.functionary, cash_desk_mov.value, cash_desk_mov.mov_type, cash_desk_mov.observations ) )
def insert(self, zip_code): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['ZipCodes']['insert'], CMD_TYPE_FUNCTION, ( zip_code.zip_number, zip_code.state, zip_code.city, zip_code.neighborhood, zip_code.street ) )
def update(self, rent): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Rents']['update'], CMD_TYPE_FUNCTION, ( rent.identifier, rent.products, rent.value, rent.observations, rent.value_paid, rent.status ) )
def insert(self, rent): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Rents']['insert'], CMD_TYPE_FUNCTION, ( rent.products, rent.client, rent.functionary, rent.value, rent.observations, rent.value_paid, ) )
def update(self, booking): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Bookings']['update'], CMD_TYPE_FUNCTION, ( booking.identifier, booking.products, booking.value, booking.observations, booking.date_time_chosen_remove, booking.date_time_removed, booking.status ) )
def insert(self, booking): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Bookings']['insert'], CMD_TYPE_FUNCTION, ( booking.products, booking.client, booking.functionary, booking.value, booking.observations, booking.date_time_chosen_remove, booking.date_time_removed, ) )
def update(self, cash_desk): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['CashDesks']['update'], CMD_TYPE_FUNCTION, ( cash_desk.identifier, cash_desk.cash_fund, cash_desk.expected_value, cash_desk.value_in_cash, cash_desk.date_time_closed, cash_desk.observations, cash_desk.status ) )
def insert(self, devolution): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Devolutions']['insert'], CMD_TYPE_FUNCTION, ( devolution.products, devolution.client, devolution.functionary, devolution.value, devolution.observations, devolution.rent, devolution.returned_by ) )
def update(self, zip_code): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['ZipCodes']['update'], CMD_TYPE_FUNCTION, ( zip_code.zip_number, zip_code.new_zip_number if 'new_zip_number' in vars( zip_code) else zip_code.zip_number, zip_code.state, zip_code.city, zip_code.neighborhood, zip_code.street ) )
def insert(self, functionary): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Functionaries']['insert'], CMD_TYPE_FUNCTION, ( functionary.person.name, functionary.person.telephone, functionary.person.email, functionary.person.address, functionary.person.photo, functionary.person.login, functionary.person.password, functionary.person.is_authorized, functionary.is_root ) )
def update(self, dependent): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Dependents']['update'], CMD_TYPE_FUNCTION, ( dependent.identifier, dependent.person.name, dependent.person.telephone, dependent.person.email, dependent.person.address, dependent.person.photo, dependent.person.login, dependent.person.password, dependent.person.is_authorized, dependent.guarantor, ) )
def test_exec_n_query_text(self): """<TestPgSqlDal> O insert na tabela de testes deve ocorrer sem erros e não retornar nada se o SGDB estiver alcançável""" ret = PgSqlDal.execute_no_query(self.sql['TblTests']['insert'], CMD_TYPE_TEXT, ('Matheus Saraiva', ), must_commit=False, is_test=True) self.assertIsNone(ret, 'Houve um retorno')
def insert(self, client): sql = inout.get_queries_file() PgSqlDal.execute_no_query(sql['Clients']['insert'], CMD_TYPE_FUNCTION, ( client.person.name, client.person.telephone, client.person.email, client.person.address, client.person.photo, client.person.login, client.person.password, client.person.is_authorized, client.rg, client.cpf, client.birth, ) )
def test_exec_query_func(self): """<TestPgSqlDal> A chamada à função "insert_in_tbltests" deve ocorrer sem erros e ter algum retorno se o SGDB estiver alcançável""" ret = PgSqlDal.execute_query(self.sql['TblTests']['callFunction'], CMD_TYPE_FUNCTION, ('Matheus Saraiva', ), must_commit=False, is_test=True) self.assertIsNotNone(ret, 'Não houve um retorno')
def test_exec_n_query_func_n_par(self): """<TestPgSqlDal> A chamada à função sem parâmetros "select_in_tbltests" deve ocorrer sem erros e não retornar nada se o SGDB estiver alcançável""" ret = PgSqlDal.execute_no_query( self.sql['TblTests']['callFunctionWithoutParameters'], CMD_TYPE_FUNCTION, must_commit=False, is_test=True) self.assertIsNone(ret, 'Houve um retorno')
def test_exec_n_query_text_n_par(self): """<TestPgSqlDal> A conslta sem parametros deve ocorrer sem erros e não retornar nada se o SGDB estiver alcançável""" ret = PgSqlDal.execute_no_query( self.sql['TblTests']['selectWithoutParameter'], CMD_TYPE_TEXT, must_commit=False, is_test=True) self.assertIsNone(ret, 'Houve um retorno')
def test_exec_query_text_n_par(self): """<TestPgSqlDal> A consulta sem parâmetros deve ocorrer sem erros e ter algum retorno""" ret = PgSqlDal.execute_query( self.sql['TblTests']['selectWithoutParameter'], CMD_TYPE_TEXT, must_commit=False, is_test=True) self.assertIsNotNone(ret, 'Não houve um retorno')
def insert(self, address): """ Insert a Address object in data base and return the current ID """ sql = inout.get_queries_file() return PgSqlDal.execute_query(sql['Address']['insert'], CMD_TYPE_FUNCTION, ( address.zip_code, address.number, address.complement ) )
def insert(self, dependent): sql = inout.get_queries_file() return PgSqlDal.execute_query(sql['Dependents']['insert'], CMD_TYPE_FUNCTION, ( dependent.person.name, dependent.person.telephone, dependent.person.email, dependent.person.address, dependent.person.photo, dependent.person.login, dependent.person.password, dependent.person.is_authorized, dependent.guarantor, ) )
def delete(self, identifier): sql = inout.get_queries_file() PgSqlDal.execute_no_query( sql['Address']['delete'], CMD_TYPE_TEXT, (identifier,))
def delete(self, zip_code): sql = inout.get_queries_file() PgSqlDal.execute_no_query( sql['ZipCodes']['delete'], CMD_TYPE_TEXT, (zip_code.zip_number,))