def product_dao_test(): global pdt pdt = ProductDao() [print(row) for row in pdt.select_product()] [ print(row) for row in pdt.select_product( sql="select * from product where code like %s", code='A%') ] sdt = SaleDao() [print(row) for row in sdt.select_item()] # sdt.insert_item(code='A001', price=5000, saleCnt=10, marginRate=10) [print(row) for row in sdt.select_item(no=1)] select_product() pdt.insert_product("Insert into product values(%s, %s)", 'C001', '라떼') select_product() pdt.update_product("update product set name = %s where code = %s", '라떼수정', 'C001') select_product() pdt.delete_product("delete from product where code = %s", 'C001') select_product()
def init_ui(self): # create the view tableView = create_table_view(20, 60) pdt = ProductDao() data = pdt.select_product() self.model = ProductTableModel(data) tableView.setModel(self.model) layout = QVBoxLayout() layout.addWidget(tableView) self.setLayout(layout) self.show()