PostGreSQL/10.3.0/BLOB

PostGreSQL/10.3.0/BLOB

Hi,

I have updated to Unidac 10.3.0 and I've a problem with the code below :

  1.         //---- Sql - Sauvegarde des lignes existantes
            LQ.Sql.Text := 'SELECT MAT_ID,INT_DEB,DIM_EXTENSION,DIM_DATE,DIM_SOURCE,DIM_LIBELLE,DIM_FILENAME,DIM_ID,DIM_ORIGINAL FROM T_DOC_INTER_MAT WHERE (MAT_ID = :MAT_ID)';
            LQ.Params[0].DataType   := ftInteger; //---- MAT_ID
            LQ.Params[0].AsInteger  := MAT_ID;    //---- MAT_ID

            try
               //---- Ouverture de la requête
               LQ.ReadOnly       := True;
               LQ.UniDirectional := True;
               LQ.Open;

               if not LQ.IsEmpty then //---- Si non vide
               begin
                    while not LQ.Eof do //---- Parcours de tous les enregistrements
                    begin
                         //---- Effacement
                         DeleteFile(_GetWindowsTemp + 'VIE_MAT' + GetExtLocal(LQ.FieldByName('DIM_ORIGINAL').AsString,LQ.FieldByName('DIM_EXTENSION').AsString));

                         //---- Extraction de l'image vers un fichier temporaire
                         LQ.GetBlob(LQ.FieldByName('DIM_FILENAME')).SaveToFile(_GetWindowsTemp + 'VIE_MAT' + GetExtLocal(LQ.FieldByName('DIM_ORIGINAL').AsString,LQ.FieldByName('DIM_EXTENSION').AsString));

                         if FileExists(_GetWindowsTemp + 'VIE_MAT' + GetExtLocal(LQ.FieldByName('DIM_ORIGINAL').AsString,LQ.FieldByName('DIM_EXTENSION').AsString)) then
                         begin
                              //---- Ajout
                              T_DOC_INTER_MAT_ALL.Insert;

                              //---- Affectations
                              T_DOC_INTER_MAT_ALL.FieldByName('MAT_ID').AsInteger  := LQ.FieldByName('MAT_ID').AsInteger;
                              T_DOC_INTER_MAT_ALL.FieldByName('INT_DEB').AsDateTime := LQ.FieldByName('INT_DEB').AsDateTime;
                              T_DOC_INTER_MAT_ALL.FieldByName('DIM_ID').AsInteger  := LQ.FieldByName('DIM_ID').AsInteger;
                              T_DOC_INTER_MAT_ALL.FieldByName('DIM_EXTENSION').AsString   := LQ.FieldByName('DIM_EXTENSION').AsString;
                              if (not LQ.FieldByName('DIM_DATE').IsNull) and (LQ.FieldByName('DIM_DATE').AsDateTime > EncodeDate(1940,1,1))  then
                                 T_DOC_INTER_MAT_ALL.FieldByName('DIM_DATE').AsDateTime := LQ.FieldByName('DIM_DATE').AsDateTime
                              else
                                  T_DOC_INTER_MAT_ALL.FieldByName('DIM_DATE').Clear;
                              T_DOC_INTER_MAT_ALL.FieldByName('DIM_SOURCE').AsString   := LQ.FieldByName('DIM_SOURCE').AsString;
                              T_DOC_INTER_MAT_ALL.FieldByName('DIM_ORIGINAL').AsString   := LQ.FieldByName('DIM_ORIGINAL').AsString;
                              T_DOC_INTER_MAT_ALL.FieldByName('DIM_LIBELLE').AsString   := LQ.FieldByName('DIM_LIBELLE').AsString;
                              T_DOC_INTER_MAT_ALL.GetBlob(T_DOC_INTER_MAT_ALL.FieldByName('DIM_FILENAME')).LoadFromFile(_GetWindowsTemp + 'VIE_MAT' + GetExtLocal(LQ.FieldByName('DIM_ORIGINAL').AsString,LQ.FieldByName('DIM_EXTENSION').AsString));

                              try
                                 //---- Validation
                                 T_DOC_INTER_MAT_ALL.Post;

                              except on Exception do
                              end;
                         end;

                         //---- Effacement
                         DeleteFile(_GetWindowsTemp + 'VIE_MAT' + GetExtLocal(LQ.FieldByName('DIM_ORIGINAL').AsString,LQ.FieldByName('DIM_EXTENSION').AsString));

                         //---- Passage à l'enregistrement suivant
                         LQ.Next;
                    end;
               end;

            finally
                   LQ.Close; //---- Fermeture de la requête
            end;

         finally
                FreeAndNil(LQ); //---- Libération de la mémoire
         end;

The LQ.GetBlob throw an Exception -->


Same code work the Unidac version 10.2.1. And also work fine with Oracle.

Any Ideas I've a lot of code with BLOB, an I don't want to rewrite all of them.

Regards.