loading blobs

I have noted on a number of my methods that Servoy does not relieably read large blobs when they are indireclty loaded onto a form. Servoy does alway read them reliable when loaded onto a form that has a base table that contains the media field where you are storing the blob. I have experimented with the saveData() command but still have the problem. I have seen this happen when loading the servoy client manual as the blob. Sometimes the PDF can’t be found and other times it is found but acrobat can’t open it. It is intermittant but running the same method will fail to work >50% of the time.

This works:
media_variable = application.readFile(tempFile)

This often fails to work
forms.tableb.controller.loadRecords(tablea_to_tableb)
forms.tableb.media_field = application.readFile(tempFile)

This often fails to work
tablea_to_tableb.media_field = application.readFile(tempFile)

I am able to work around this by storing the blob into a global media variable and then calling a method on a form of proper base table to direclty load the global variable into the media field.

Example:
globals.Media_variable = application.readFile(tempFile)
forms.tableb.controller.loadRecords(tablea_to_tableb)
forms.tableb.method_that_loads_globalmediavariableintomediafield();

John McCann

Servoy Developer
Version R2 2.0.3-build 276
Java version 1.4.2_04-b05 (Windows XP)
MS SQL backend

if you do this:

forms.tableb.media_field = application.readFile(tempFile)

what do you do after that with that media_field.

And i see that you are using mysql. In the dataprovider editor, how big is that media field? is it big enough to handle the complete pdf??

I am storing PDF documents in the media fields. When I want to see them I use a method that writes them to a temporary file on the hardrive and then open them with Acrobat reader. Sometimes I get a message that thier is no file and other times I get a message that the file has been damaged. I am certain the problem ocurs in storing the PDF files and not in retrieving them.

I am using MS SQL Server as the backend not MySQL.

John McCann

and if you write them to a “real” file on disk with a name that you know and choose youreself.

What does the file look like? Is it really complete?

When I use this method to store the PDF:

forms.tableb.media_field = application.readFile(tempFile)

Writing this binary data to the hardrive does not generate a document.

When I store the PDF using this method:

globals.Media_variable = application.readFile(tempFile)
forms.tableb.controller.loadRecords(tablea_to_tableb)
forms.tableb.method_that_loads_globalmediavariableintomediafield();

Writing the binary data to hardrive generates the expected PDF document.

John McCann

idoctor:
Writing this binary data to the hardrive does not generate a document.

Wat does it generate?

Wat errors do you get as stated in your first post?

Jan,

I don’t really get an error when I store the BLOBS. The method just does not save the BLOB as expected so that when I go to view the BLOB I get a message that says the BLOB can’t be found.

John McCAnn

Does the file gets written on disk? what is the size? what should the size be?

Jan,

I think I got to the bottom of this one. I was creating the BLOB by using the PDF printer plugin. I think it was primarly a timing issue with the method trying to file the BLOB before the PDF plug in was done creating it. It seems to work now if I change the print statement so that it must complete prior to attempting to file the document.

Thanks

John McCann