· May 22, 2019

Delete records with %Stream.FileBinary Field

Hi everybody

I'm new in this forum and also new working with a Caché-Database.

I have to delete records from a table (by SQL) which contains a field declared as:
Property Image As %Stream.FileBinary;

When I try to delete a record with an image I get an error
[%msg: <FEHLER #5019: Kann Datei 'H:\BK Solution\DSTBern\eXpert\Data\Expert\stream\' nicht löschen>]
[SQLCODE: <-412>:<Allgemeiner Stream-Fehler >] 

because the physical file doesn't exist (for any reason) but the database want's to delete this file.

Even when I try to update the image by executing 'Update <Table xy> SET Image = NULL', I get the same errormessage.

Is there any way to avoid this problem? Is it an issue of Caché 2012. Caché 2016 seems to be ok, but for any reason we have to use Caché 2012.


Discussion (1)0
Log in or sign up to continue

as you describe if you refer to a file outside Caché and Caché has no control over it
it's a clear case of data inconsistency

you have 4 options:
1a) create a fake file at that reference an delete it then

1b) add an "on before delete" trigger to check and fix in advance either in the record or  in file system 

2a) manipulate the file reference using the object behind your entry

2b) do the delete at object level, trap the error and ignore it. since the file is gone anyway