[CDBI] Sybase Image Column Inflate/Deflate
<[email protected]> Mon, 27 Jun 2011 14:05:08 -0400
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <B0011508DF5C184ABEC7A8978D7AB5E80BC5B0FC3D@NYKPCMMGMB03.INTRANET.BARCAPINT.COM> |
--===============1973456268==
Content-Language: en-US
Content-Type: multipart/alternative;
boundary="_000_B0011508DF5C184ABEC7A8978D7AB5E80BC5B0FC3DNYKPCMMGMB03I_"
--_000_B0011508DF5C184ABEC7A8978D7AB5E80BC5B0FC3DNYKPCMMGMB03I_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Many years ago someone made the decision to put XML which defines reports=
=20into one of our tables in a Sybase DB into an image field. The XML st=
ored 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 implem=
ent the pack/unpack required to convert the data in these binary image co=
lumns between hex and a doceoded string.
Initially, I thought it would be to use the inflate/deflate attributes of=
=20the has_a() method, but that doesn't seem to be the case, because it l=
ooks like the has_a() is expecting to inflate to an object, but this is j=
ust text.
It appears as if I can use a select_trigger and then set the attribute us=
ing 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 o=
therwise 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 receive=
d it in error. Unless specifically indicated, this e-mail is not an offer=
=20to buy or sell or a solicitation to buy or sell any securities, invest=
ment products or other financial product or service, an official confirma=
tion of any transaction, or an official statement of Barclays. Any views =
or opinions presented are solely those of the author and do not necessari=
ly represent those of Barclays. This e-mail is subject to terms available=
=20at the following link: www.barcap.com/emaildisclaimer. By messaging wi=
th Barclays you consent to the foregoing. Barclays Capital is the invest=
ment banking division of Barclays Bank PLC, a company registered in Engla=
nd (number 1026167) with its registered office at 1 Churchill Place, Lond=
on, E14 5HP. This email may relate to or be sent from other members of t=
he Barclays Group.
_______________________________________________
--_000_B0011508DF5C184ABEC7A8978D7AB5E80BC5B0FC3DNYKPCMMGMB03I_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:=
schemas-microsoft-com:office:word" xmlns=3D"http://www.w3.org/TR/REC-html=
40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
=20/* Style Definitions */
=20p.MsoNormal, li.MsoNormal, div.MsoNormal
=09{margin:0in;
=09margin-bottom:.0001pt;
=09font-size:12.0pt;
=09font-family:"Times New Roman";}
a:link, span.MsoHyperlink
=09{color:blue;
=09text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
=09{color:#606420;
=09text-decoration:underline;}
span.EmailStyle17
=09{mso-style-type:personal-compose;
=09font-family:Arial;
=09color:windowtext;}
@page Section1
=09{size:8.5in 11.0in;
=09margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
=09{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3D"#606420">
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'>Many years ago someone made the decision to put XML wh=
ich
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=
=20order
to implement the pack/unpack required to convert the data in these binary=
=20image
columns between hex and a doceoded string.<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'>Initially, I thought it would be to use the inflate/de=
flate
attributes of the has_a() method, but that doesn’t seem to be the c=
ase,
because it looks like the has_a() is expecting to inflate to an object, b=
ut
this is just text.<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'>It appears as if I can use a select_trigger and then s=
et the
attribute using the _attribute_store() method so that it doesn’t ge=
t
propagated back to the DB, and then use the before_set() method to change=
=20the
value back to hex before my class pesrists the value of the field.<o:p></=
o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'>What’s the right way to do this?<o:p></o:p></spa=
n></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'>Thanks.<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size=
:10.0pt;
font-family:Arial'>Eric.<o:p></o:p></span></font></p>
</div>
<FONT face=3DArial size=3D2>
<P class=3DMsoNormal=20
style=3D"MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN=20
style=3D"FONT-SIZE: 11pt"><FONT=20
face=3D"Times New Roman">_______________________________________________<=
?xml:namespace=20
prefix =3D o ns =3D "urn:schemas-microsoft-com:office:office"=20
/><o:p></o:p></FONT></SPAN></P>
<P class=3DMsoNormal=20
style=3D"MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN=20
style=3D"FONT-SIZE: 11pt"><o:p><FONT=20
face=3D"Times New Roman"> </FONT></o:p></SPAN></P>
<P class=3DMsoNormal=20
style=3D"MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN=20
style=3D"FONT-SIZE: 11pt"><FONT face=3D"Times New Roman">This e-mail may =
contain=20
information that is confidential, privileged or otherwise protected from =
disclosure. If you are not an intended recipient of this e-mail, do not=20
duplicate or redistribute it by any means. Please delete it and any attac=
hments=20
and notify the sender that you have received it in error. Unless specific=
ally=20
indicated, this e-mail is not an offer to buy or sell or a solicitation t=
o buy=20
or sell any securities, investment products or other financial product or=
=20
service, an official confirmation of any transaction, or an official stat=
ement=20
of Barclays. Any views or opinions presented are solely those of the auth=
or and=20
do not necessarily represent those of Barclays. This e-mail is subject to=
=20terms=20
available at the following link: </FONT></SPAN><SPAN lang=3DEN-GB=20
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-langu=
age: EN-GB; mso-fareast-language: EN-GB"><A=20
href=3D"http://www.barcap.com/emaildisclaimer">www.barcap.com/emaildiscla=
imer</A>.=20
</SPAN><SPAN style=3D"FONT-SIZE: 11pt"><FONT face=3D"Times New Roman">By =
messaging=20
with Barclays you consent to the foregoing.<SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>Barclays Capital is the investm=
ent=20
banking division of Barclays Bank PLC, a company registered in <?xml:name=
space=20
prefix =3D st1 ns =3D "urn:schemas-microsoft-com:office:smarttags" /><st1=
:place=20
w:st=3D"on"><st1:country-region w:st=3D"on">England</st1:country-region><=
/st1:place>=20
(number 1026167) with its registered office at <st1:address=20
w:st=3D"on"><st1:Street w:st=3D"on">1 Churchill Place</st1:Street>, <st1:=
City=20
w:st=3D"on">London</st1:City>, <st1:PostalCode w:st=3D"on">E14=20
5HP</st1:PostalCode></st1:address>.<SPAN style=3D"mso-spacerun: yes">&nbs=
p;=20
</SPAN>This email may relate to or be sent from other members of the Barc=
lays=20
Group.<I style=3D"mso-bidi-font-style: normal"><o:p></o:p></I></FONT></SP=
AN></P>
<P class=3DMsoNormal=20
style=3D"MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN=20
style=3D"FONT-SIZE: 11pt"><FONT=20
face=3D"Times New Roman">_______________________________________________<=
/FONT></SPAN></FONT></P>
</body>
</html>
--_000_B0011508DF5C184ABEC7A8978D7AB5E80BC5B0FC3DNYKPCMMGMB03I_--
--===============1973456268==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ClassDBI mailing list
ClassDBI-Ra3b/[email protected]
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
--===============1973456268==--