DataBase/MySQL
LONGBLOB을 쿼리로 값을 저장해보자
Jiung.
2015. 6. 2. 01:53
반응형
create table image(ID INT, Image LONGBLOB);
insert into image values (1, load_file('c:\\A3.png'));
BLOB 타입의 자료형은 위와같이 load_file을 사용하여 쿼리를 날릴 수 있음.
단, 이미지 경로에 한글이 들어가면 안됨.
아래 코드는 Database->Database_entry_attribute에서 사용한 코드.
1 2 3 4 5 6 7 8 | int find = _str.find("\'"); int find2 = _str.find("\'", find+1); string str, imagePact; imagePact = "load_file(\'" + _str.substr(find + 1, find2 - 3) + "\')"; str = "INSERT INTO photo VALUES(" + _str.substr(0, find) + imagePact + _str.substr(find2 + 1) + ")"; return str; | cs |
반응형