Tutorial :Need to compare blobs in firebird



Question:

I need to check on the contents of blobs in my databases (yes, plural, but one problem at a time).

In one database, I have about 900 images of potentially varying sizes. I need to check to see if the versioning system that's built into our application is actually correctly replicating the image data from the previous version to the new version of a record.

How do I compare values en masse so I don't have to pick through each record one at a time and open up the blob using FlameRobin or Firebird Maestro and visually compare these images?

Thanks for any assistance.


Solution:1

You can handle this in two ways:

  1. create some kind of function that returns a unique value for each image, store it in a different column and compare these values
  2. get an "external function library" (also called "User Defined Function library") that includes a "blob compare" function: install the library at your server, declare the function in your database and use it.


Solution:2

try to do a hash (like md5) on each bolb and see if they are the same.

SELECT      oldTable.PK      FROM oldTable          LEFT OUTER JOIN newTable ON oldTable.PK=newTable.PK      WHERE MD5(oldTable.blob_column)!=MD5(newTable.blob_column)  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »