def writeArticle(self): loginId = mem_serv.Service.loginId flag = self.memberService.loginCheck() if flag: print("글쓰기") title = input('title:') content = input('content:') w_date = input('w_date') self.dao.insert(vo.Board(0, loginId, w_date, title, content))
def selectByTitle(self, title): conn = self.connect() sql = 'select * from board where title=%s' cursor = conn.cursor() # 사용할 커서 객체 생성 cursor.execute(sql, title) # sql실행. 실행한 결과는 cursor 객체에 담아 row = cursor.fetchone() #검색 결과 한줄추출 conn.close() if row is not None: return arti.Board(row[0], row[1], row[2], row[3], row[4])
def selectAll(self): conn = self.connect() sql = 'select * from board' cursor = conn.cursor() # 사용할 커서 객체 생성 cursor.execute(sql) # sql실행. 실행한 결과는 cursor 객체에 담아 datas = [] for row in cursor: datas.append(arti.Board(row[0], row[1], row[2], row[3], row[4])) conn.close() return datas
def selectByWriter(self, writer): conn = self.connect() sql = 'select * from board where writer=%s' cursor = conn.cursor() # 사용할 커서 객체 생성 cursor.execute(sql, writer) # sql실행. 실행한 결과는 cursor 객체에 담아 articles = [] for row in cursor: articles.append(arti.Board(row[0], row[1], row[2], row[3], row[4])) conn.close() return articles
def __init__(self): self.dao = articleDao.Dao() self.Borad = vo.Board() self.memberService = mem_serv.Service()