Copy raw image data from one DB to another

Chuck Neal chuck at mediamacros.com
Mon May 9 14:41:10 CDT 2005


Valentina 1.11
Director MX 2004
Windows XP

Ok, I am digging back through my code trying to find out why building 
this database is destroying my file.  Here is what I am using to add 
images...


on addImage me, vImage, Id
   if ilk(vImage) <> #member then return 0
   if vImage.type <> #bitmap then return 0
   c = vImage.image.getPixel(1,0)

   iSQL = "SELECT * FROM image"
   iCursor = Xtra("VCursor").new(GetRef(pDb), iSQL, 1, 3, 1)
   if valentinaerror() <> 0 then
     put "Error" && valentinaError() && valentinaErrorString()
   end if
   SetBlank(iCursor)
   if valentinaerror() <> 0 then
     put "Error blank" && valentinaError() && valentinaErrorString()
   end if
   SetField(iCursor, "id", id)
   if valentinaerror() <> 0 then
     put "Error Field" && valentinaError() && valentinaErrorString()
   end if
   SetPicture( iCursor, "image", vImage, 90)
   if valentinaerror() <> 0 then
     put "Error Picture" && valentinaError() && valentinaErrorString()
   end if
   AddREcord(iCursor)
   if valentinaerror() <> 0 then
     put "Error Add" && valentinaError() && valentinaErrorString()
   end if
   pdb.flush()
    if valentinaerror() <> 0 then
   put "Error Flush" && valentinaError() && valentinaErrorString()
   end if
   iCursor = void
   return id
end

I am going through a list of files, loading the member and then calling 
this function.  It works fine for the first 295-300 images.  Then I 
start getting this...

-- "Error Flush -39 No error"

After that, every single call to the add gives me the same error.  The 
strange part is that it happens on flush and not on any of the other items.

First is there something in my code that is wrong?  I can do small 
record sets with no problems, but once it passes that "magic" number 
then the file is not longer able to be opened by the Xtra or Studio.

I have tried about 10 different methods to get this to work and it is 
consistently failing here no matter what I try.  Any insight?

-Chuck
--------------------------
Chuck Neal
CEO, MediaMacros, Inc.
chuck at mediamacros.com
http://www.mediamacros.com
--------------------------
Check out the Developers Mall
Your one stop shop for all your Director Xtra Needs
http://www.mediamacros.net/customer


Ruslan Zasukhin wrote:
> On 5/9/05 8:07 PM, "Chuck Neal" <chuck at mediamacros.com> wrote:
> 
> 
>>I am still struggling with my export feature with Valentina 1.x
>>
>>I have a field that contains picture data that is compressed.  I am
>>trying to avoid extracting it, then reinserting it into another
>>database.  This is slow, it takes up a lot of RAM if I don't immediately
>>delete the image, it double compresses the image which could degrade the
>>quality,  and it seems to throw random errors if I have both databases
>>open at once.
>>
>>Is there a way to actually grab the content of the field and insert it
>>into another database as a raw value (via Director) without having to
>>re-compress?
> 
> 
> You ask about moving picture from 1.x db to 1.x db?
> Or to 2.0 db ?
> 
> In C++ such ways exists. But V4MD developers are not so advanced,
> And the main Director itself do not allow you easy work with RAM.
> 
> 
> In 2.0 we can have SaveToFile() LoadToFile() functions.
> Which read/write BLOB as is.
> 
> 1.x do not have such methods.
> 
> 


More information about the Valentina mailing list