Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
Bonjour à tous,
J'utilise une base de données Sybase ASE 12.5 et PB 10.
Quelqu'un a-t-il un peu d'expérience (tips, références, ...) concernant l'enregistrement
d'images dans une base de données.
Merci
Hors ligne
normalement, on passe par un blob (format qui prend en compte tout et n'importe quoi, fichier word, images, et autres)
mais il me semble qu'il existe un format image....à confirmer.
je regarde cela en fin de semaine, si dès fois personne n'a répondu d'ici la...
Hors ligne
je te confirme bien cette solution.
on passe par le blob ou le format image.
apres, pour l'exploiter sur powerbuilder... faut passer par un selectblob()...
donnes moi des nouvelles...
LONG/BLOB Data Handling
Sybase supports an IMAGE and a TEXT type for LONG/BLOB data. Each type can hold up to 2GB of binary data, including nul characters. The main difference between an IMAGE and a TEXT column lies in how the client libraries treat the data on input and output. TEXT data is entered and returned "as is". IMAGE data is returned as a long hex string, and should be entered in the same way.
LongReadLen and LongTrunkOk attributes have no effect. The default limit for TEXT/IMAGE data is 32Kb, but this can be changed by the SET TEXTSIZE Transact-SQL command.
Bind parameters can not be used to insert TEXT or IMAGE data to Sybase.
Text and Image Fields
Sybase has two special datatypes called "text" and "image".
The text datatype can store arbitrary length text strings with lengths from 0 to 2 gigabytes long.
The image database can store arbitrary length binary values whose size varies from 0 to 2 gigabytes.
For both text and image datatypes, internal storage is allocated in 2k bytes (2048). Even if you only put one character into a text field, 2k bytes are allocated internally.
A text field can be used to hold large portions of textual material, eg. chapters from a book.
Here's an example of a select on a text field:
select au_id, copy
from blurbs
where au_id="486-29-1786"
The only way text fields can be used in a "where" clause is with the "like" statement. For example:
select au_id from blurbs
where copy like '%Etiquette%'
There are special rules for using text/image datatypes. See the following sections for more information on text/image datatypes:
Users Guide
Chp2, Selecting Text and Image Values
Chp9, Changing Data with Writetext
Commands Reference
Chp2, Text/Image Datatypes
Chp2, Text/Image Functions
Chp2, Readtext
Chp2, Writetext
sous oracle :
Nisanth,
Here's what we use with Oracle.
The column photo_image is an Oracle blob.
The variable tot_b is a PowerBuilder blob, loaded by reading the contents of an image file.
Barry J.
INSERT INTO "JNOW"."PERSON_PHOTO"
( "PHOTO_ID",
"PERSON_ID",
"PHOTO_TYPE_ID",
"PHOTO_FILE_NAME",
"PHOTO_IMAGE",
"PHOTO_FILE_TYPE_ID",
"PHOTO_RECD_DATE" )
VALUES ( :idec_photo_id,
:idec_phys_id,
:idec_photo_type_id,
:ls_photo_filename,
null,
:idec_photo_file_type_id,
:ldt_recd_date);
IF SQLCA.SQLCode <> 0 THEN
MessageBox("PERSON_PHOTO", 'Error 2041 in PERSON_PHOTO Insert for ' +&
string(idec_phys_id) + '. SQLCode = ' + string(SQLCA.SQLcode) +&
'; SQLDBCode = ' + string(SQLCA.SQLcode) + '; ' +&
SQLCA.SQLErrText + ". The update process has been aborted.", Exclamation!)
ROLLBACK USING SQLCA;
RETURN
END IF
UPDATEBLOB "JNOW"."PERSON_PHOTO"
SET PHOTO_IMAGE = :tot_b
WHERE "JNOW"."PERSON_PHOTO"."PHOTO_ID" = :idec_photo_id AND
"JNOW"."PERSON_PHOTO"."PERSON_ID" = :idec_phys_id AND
"JNOW"."PERSON_PHOTO"."PHOTO_FILE_TYPE_ID" = :idec_photo_file_type_id AND
"JNOW"."PERSON_PHOTO"."PHOTO_TYPE_ID" = :idec_photo_type_id
USING SQLCA;
----- Original Message -----
From: nisanthcp
To: PowerObject@yahoogroups.com
Sent: Tuesday, August 15, 2006 03:57
Subject: [PowerObject] Store Picture in SQL Server 2000 using PB6.5
Hi all,
I would like to know how can I store images/pictures in sql server
2000 using powerbuilder 6.5.I have tried UPDATEBLOB and SELECTBLOB,but
it is not working.Kindly adivce
Nisanth
Hors ligne
Super
Grand merci Pick
Hors ligne