반응형

BLOB 데이터 타입
BLOB 란 binary large object
BLOB 컬럼 타입을 이용하면 이미지나 바이너리 화일을 테이블에 넣을 수 있음.
BLOB 필드는 소팅이나 INDEX생성은 할 수 없음. 

MySQL에서 지원하는 BLOB타입

타입설명
TINYBLOB (TINYTEXT) A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters.
BLOB (TEXT) A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters.
MEDIUMBLOB (MEDIUMTEXT) A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters.
LONGBLOB(LONGTEXT) A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters.
 

테스트용 갤러리 테이블 생성 SQL

use test ;
 
CREATE TABLE gallery1(
 
id int NOT NULL auto_increment,
 
image blob NOT NULL, # 이미지의 바이너리
 
title varchar(100) DEFAULT \ NOT NULL, # 이미지 제목
 
width smallint(6) DEFAULT \0\ NOT NULL, # 가로크기
 
height smallint(6) DEFAULT \0\ NOT NULL, # 세로크기
 
filesize int , # 파일크기
 
detail text , # 이미지 설명
 
PRIMARY KEY (id)
 
) ;
 

반응형