0
數據庫是:在PostgreSQL插入圖像到bytea字段顯示爲0字節
數據庫驅動程序:PDO
我的查詢是:
使用INSERT INTO
poi (
"idPoiCategory",
name,
"shortName",
description,
url,
source,
"contactPostalCode",
"contactCity",
"contactAddress",
"contactPhone",
"contactPhone2",
"contactMail",
"mediaPhotoCopyright",
"mediaPhotoMain",
"mediaPhotoMiniature1",
"mediaPhotoMiniature2",
"mediaPhotoOriginalWidth",
"mediaPhotoOriginalHeight",
"mediaPhotoMiniatureWidth",
"mediaPhotoMiniatureHeight",
"mediaPhotoCropX",
"mediaPhotoCropY",
"mediaPhotoCropWidth",
"mediaPhotoCropHeight"
)
VALUES (
:id_poi_category,
:name,
:short_name,
:description,
:url,
:source,
:postal_code,
:city,
:street_with_number,
:phone_number_1,
:phone_number_2,
:mailto,
:photos_copyright,
:photo_main,
:photo_miniature_1,
:photo_miniature_2,
:photo_original_width,
:photo_original_height,
:photo_miniature_width,
:photo_miniature_height,
:photo_crop_x,
:photo_crop_y,
:photo_crop_width,
:photo_crop_height
)
RETURNING "idPoi"
我結合PARAMS(BYTEA的):
$stmt->bindParam(':photo_main', $fields['photo_main'], PDO::PARAM_LOB);
$stmt->bindParam(':photo_miniature_1', $fields['photo_miniature_1'], PDO::PARAM_LOB);
$stmt->bindParam(':photo_miniature_2', $fields['photo_miniature_2'], PDO::PARAM_LOB);
問題是:爲什麼圖像不能插入bytea列?他們的 (列)大小顯示0個字節。我試圖插入這些圖像,但列仍然顯示0字節的大小。我試圖將二進制數據轉換爲十六進制,並將其轉換爲列 - 枉然,結果仍然相同:0字節。