CONTENTS
Lastmodified 2019-01-05 (土) 07:12:41
id とファイル名の関連は「file」に格納されている。
mysql> show columns from file; +-------------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(64) | NO | UNI | | | | type | varchar(64) | NO | | | | | filesize | int(11) | NO | | 0 | | | original_filename | text | YES | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | NO | | NULL | | +-------------------+-------------+------+-----+---------+----------------+ 7 rows in set (0.00 sec)
画像ファイルの実データは「`file_bin.bin`」に格納されている。
mysql> show columns from file_bin; +------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+----------+------+-----+---------+-------+ | file_id | int(11) | NO | PRI | 0 | | | bin | longblob | YES | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | NO | | NULL | | +------------+----------+------+-----+---------+-------+ 4 rows in set (0.01 sec)
http://blog.livedoor.jp/atsu1997/archives/4613674.html
CREATE TABLE [dbo].[img]( [id] [int] NULL, [image] [varbinary](max) NULL )
INSERT INTO img([id],[image]) SELECT 0 as [id], BulkColumn as [image] --読み込んだバイナリデータ FROM OPENROWSET(BULK N'C:\test\test.jpg', SINGLE_BLOB) as tempImg
UPDATE img SET [image] = BulkColumn FROM OPENROWSET(BULK N'C:\test\test.jpg', SINGLE_BLOB) as tempImg WHERE [id]=0
https://www.ipentec.com/document/sql-multi-record-update
http://daiyamamoto.hatenablog.com/entry/20080616/p1
Total access 907:本日 1:昨日 0