0

Database is: POSTGRESQL

Database driver: PDO

My query is:

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" 

I'm binding params (bytea ones) using:

$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);

Question is: why images don't insert into bytea columns? Their (columns) size shows 0 bytes. I'm trying to insert those images, but columns still show size of 0 bytes. I tried to convert binary data into hex and stuff that into column - in vain, result was still the same: 0 bytes.

Sargit
  • 11
  • 4

1 Answers1

0

Problem is with Adminer. It reports column as '0 bytes' even thou, there's data in it. You can check this by using function octet_length() in SQL query f.ex: octet_length("column_name_with_bytea"). It should report value greater than 0.

Sargit
  • 11
  • 4