Need to compare blobs in firebird
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开发者_JAVA百科 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.
You can handle this in two ways:
- create some kind of function that returns a unique value for each image, store it in a different column and compare these values
- 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.
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)
精彩评论