[CDBI] Sybase Image Column Inflate/Deflate

eric.berg at barclayscapital.com eric.berg at barclayscapital.com
Mon Jun 27 19:05:08 BST 2011


Many years ago someone made the decision to put XML which defines reports into one of our tables in a Sybase DB into an image field.  The XML stored in this column is encoded as hex.  I'm working on a cdbi class that will access that table, and am not sure how to proceed in order to implement the pack/unpack required to convert the data in these binary image columns between hex and a doceoded string.

Initially, I thought it would be to use the inflate/deflate attributes of the has_a() method, but that doesn't seem to be the case, because it looks like the has_a() is expecting to inflate to an object, but this is just text.

It appears as if I can use a select_trigger and then set the attribute using the _attribute_store() method so that it doesn't get propagated back to the DB, and then use the before_set() method to change the value back to hex before my class pesrists the value of the field.

What's the right way to do this?

Thanks.

Eric.

_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20110627/2b6d5a04/attachment.html>


More information about the ClassDBI mailing list