1 / 5

Table(String table_name ) ① table_name 설정 ② File 이름 = table_name ; ③ file 열기

Table(String table_name ) ① table_name 설정 ② File 이름 = table_name ; ③ file 열기 ④ file 로부터 col_name 읽기 ⑤ file 로부터 col_length 읽기 ⑥버퍼생성 ( col 들의 총 length) ⑦ file 로부터 한 레코드 읽기 – 변환 : 다음레코드 위치 ⑴ Table.unpack () ⑵ buff.read (). connectionStatement ① 모든 table 생성 ② exectueQuery

irma
Download Presentation

Table(String table_name ) ① table_name 설정 ② File 이름 = table_name ; ③ file 열기

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Table(String table_name) ①table_name설정 ②File 이름 = table_name; ③file열기 ④file로부터 col_name읽기 ⑤file로부터 col_length읽기 ⑥버퍼생성(col들의 총length) ⑦file로부터 한 레코드 읽기 – 변환:다음레코드 위치 ⑴Table.unpack() ⑵buff.read() connectionStatement ①모든 table 생성 ②exectueQuery ⑴Table.select() ⑵Table.update() ⑶Table.inset() 1)Table.select ①Table.next() = Table.unpack() – buff.Read() ②읽은 레코드에서 where절이 일치하는지 확인 ③where절이 일치하면 ⑴레코드에서 필요한 column을 읽어서 돌려준다 ⑵*이면 모든 column을 돌려준다 ④where절이 일치하지 않으면 ⑴아무 일도 안 한다 ⑤레코드를 tempfile에 저장한다(File.createTempFile) ⑥tempfile의 모든 내용을 읽어서 보여준다 2)Table.insert ①한 레코드를 file의 가장 뒤에 추가한다 3)Table.update ①Table.select이용 (Table.select의 ②까지 이용) ②레코드의 내용을 update에 맞게 변경 ③해당 레코드의 위치 설정(Randomaccess) ④레코드의 내용을 파일에 쓰기 =Table.pack, buff.write

  2. Select (*) name from Table where height = 1 and weight = 2; -WHERE + 조건식 문자열: ( ' )로 표현 비교 연산자: =, >, >=, <> SQL 비교 연산자: (NOT) BETWEEN.. AND, IN(list), (NOT) LIKE, IS (NOT) NULL 논리 연산자: AND, OR, NOT Insert Memos1(Name, Email, Title, PostDate) Values('씨앗', 'seed@wow.com', 'seed', GetDate()); Update class Set hight = 600 where name = ‘java’;

  3. Table(String table_name) ①table_name설정 ②File 이름 = table_name; ③file열기(header용- DataOutputStream이용) DataOutputStream. createNewFile() – 파일이 없을경우 생성 ④임의로 크기 1000의 버퍼생성 ⑤header의 col_name_size를 읽기(file -> buff.buffer -> Table. col_name_size) ⑥header의 col_length_size를 읽기 (file -> buff.buffer -> Table. col_length_size) File에서의 읽은 offset저장해 놓기(실제레코드 있는 위치) ⑦file열기(일반용 – RandomAccessStream이용) ⑧col_name_size만큼의 버퍼생성 ⑨file로부터 col_name읽기 (file-> buff.buffer -> Table.col_name) File에서의 읽은 offset저장해 놓기 ⑩col_length_size만큼의 버퍼생성 ⑨file로부터 col_length읽기 (file-> buff.buffer -> Table.col_length) File에서의 읽은 offset저장해 놓기 (offset : 실제 레코드를 읽을 위치) ⑪버퍼생성(col들의 총length)

  4. Table(String table_name) ①table_name설정 ②File 이름 = table_name; ③file열기(header용- DataOutputStream이용) DataOutputStream. createNewFile() – 파일이 없을경우 생성 ④임의로 크기 1000의 버퍼생성 ⑤header의 col_name_size를 읽기(file -> buff.buffer -> Table. col_name_size) 1번레코드 비였는지 확인, 1번레코드 문자면 에러 -(Integer.parseInt(buffSArray0[0]) ⑥header의 col_length_size를 읽기 (file -> buff.buffer -> Table. col_length_size) 1번레코드 비였는지 확인, 1번레코드 문자면 에러 -(Integer.parseInt(buffSArray0[1].substring(0,count)) File에서의 읽은 offset저장해 놓기(실제레코드 있는 위치) ⑦file열기(일반용 – RandomAccessStream이용) ⑧col_name_size만큼의 버퍼생성 <Col_name_size와 col_name에 해당하는 레코드를 읽은 크기와 비교해서 (col_name_size>=col_name에 해당하는 레코드를 읽은 크기)일때만 다음으로 넘어감> ⑨file로부터 col_name읽기 (file-> buff.buffer -> Table.col_name) File에서의 읽은 offset저장해 놓기 2번레코드 비였는지 확인, 2번레코드 숫자면 에러 -(Integer.parseInt(buffSArray1[i].substring(0,count)) ⑩col_length_size만큼의 버퍼생성 ⑨file로부터 col_length읽기 (file-> buff.buffer -> Table.col_length) File에서의 읽은 offset저장해 놓기 -(offset : 실제 레코드를 읽을 위치) 3번레코드 비였는지 확인, 3번레코드 문자면 에러 -(buffSArray2[j]).substring(0,count)) ⑪버퍼생성(col들의 총length)

  5. Pack() Col_type과 col_length를 이용하여 rec에서 buffer로 내용을 이동 한 레코드의 field갯수만큼 임시string배열생성 한 레코드의 field의 type얻기 Type의 형이 int인지 string인지 확인 Int라면 rec에서 한 필드의 내용을 받기 그 내용이 정해진 field의 길이보다 큰지 확인 buffer에 한 field값을 byte단위로 쓰기 한필드의 정해진 길이보다 읽은 필드의 길이가 짧으면 필드의 정해진 길이까지의 빈공간을0으로 채움 2) String라면 위와 같음 레코드의 필드의 할당크기보다 필드의 크기가 크면 에러

More Related