Bonjour,

Je voudrais utiliser PDO plutot que oci_ pour lire ma base oracle et lire le contenu d'un champ BLOB.

Je n'y arrive tout simplement pas ... Afin si je lis, j'ouvre un document mais celui-ci est vide alors que j'ai du contenu dans mon champ.

Avec le driver oci que j'utilise sur une autre appli, je fais un oci-lob->load() pour afficher mon document.

Je ne trouve pas "d'équivalent" sur pdo.

J'en suis là:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
try
{
$pdoO = new PDO('oci:host='.$hostO.';dbname='.$dbO, $userO, $pwdO, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ));
}
catch(Exception $e)
{
exit('<b>Connexion Oracle : Catched exception at line '. $e->getLine() .' :</b> '. $e->getMessage());
}
 
$sqlO2 = "SELECT TYPE_FICHIER, TAILLE_FICHIER, NOM_FICHIER, FILEDATA FROM GP_DOCUMENTS_LINES WHERE ID = 21";
 
$stmt = $pdoO->beginTransaction();
$stmt = $pdoO->prepare($sqlO2);
$stmt->execute();
$stmt->bindColumn(1, $TYPE_FICHIER, PDO::PARAM_STR, 100);
$stmt->bindColumn(2, $TAILLE_FICHIER, PDO::PARAM_STR, 50);
$stmt->bindColumn(3, $NOM_FICHIER, PDO::PARAM_STR, 100);
$stmt->bindColumn(4, $FILEDATA, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
 
header("Content-type: ".$TYPE_FICHIER);
header('Content-Length: '.$TAILLE_FICHIER);
header('Content-Disposition: attachment; filename="'.$NOM_FICHIER.'"');
header('Pragma: no-cache');
 
ehco stream_get_contents($FILEDATA);
Quelqu'un peut m'indiquer comment faire please