binary (?) to string
am 12.12.2006 21:16:30 von John DePasqualeThis is a multi-part message in MIME format.
--===============0082201791==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C71E2A.68E760AF"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C71E2A.68E760AF
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
hi all,
I'm querying a binary field in MS-SQL using perl, and having a harder
time than I anticipated in converting it to string.
an example of the value in the SQL database looks like:
0x0000000000000112
=20
when I query the database and get a result set that includes that value
and print it from perl, I get unprintable characters.
when I try to query that same database again using the value as perl
sees it, it fails.=20
=20
example:
"select binary_field from table" -----> the value I get here and store
in the variable $c is unprintable.
=20
if I then try "select * from table where binary_field =3D $c" or "select =
*
from table where binary_field =3D " . $c, both fail.
=20
if I store '0x' . '0000000000000112' to $c and query for that value
against the binary field, it finds the record successfully.
=20
I'm assuming perl can convert the unprintable value of
0x0000000000000112 to a string looking like '0x0000000000000112', or
perhaps '0000000000000112', but having no luck finding it.
=20
is there such a function?
=20
thanks.
=20
John DePasquale
IT Manager
Law Offices of James Sokolove
1340 Centre Street - Suite 102
Newton, MA 02459
P: 617-742-0696, ext. 432
F: 617-964-4336
This email is intended solely for the use of the individual to whom it
is addressed and may contain information that is privileged,
confidential or otherwise exempt from disclosure under applicable law.
If the reader of this email is not the intended recipient or the
employee or agent responsible for delivering the message to the intended
recipient, you are hereby notified that any dissemination, distribution,
or copying of this communication is strictly prohibited. If you have
received this communication in error, please immediately notify us by
telephone and return the original message to us at the listed email
address. Thank You.
=20
------_=_NextPart_001_01C71E2A.68E760AF
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
charset=3Dus-ascii">
name=3D"place"/>
name=3D"PostalCode"/>
name=3D"State"/>
name=3D"City"/>
name=3D"Street"/>
name=3D"address"/>
style=3D'font-size:10.0pt;
font-family:Arial'>hi all,
style=3D'font-size:10.0pt;
font-family:Arial'>I’m querying a binary field in MS-SQL using =
perl, and
having a harder time than I anticipated in converting it to =
string.
style=3D'font-size:10.0pt;
font-family:Arial'>an example of the value in the SQL database looks =
like: 0x0000000000000112
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>when I query the database and get a result set that =
includes
that value and print it from perl, I get unprintable =
characters.
style=3D'font-size:10.0pt;
font-family:Arial'>when I try to query that same database again using =
the value
as perl sees it, it fails.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>example:
style=3D'font-size:10.0pt;
font-family:Arial'>“select binary_field from table” =
---
size=3D2 face=3DWingdings>
style=3D'font-size:10.0pt;font-family:Wingdings'>à
size=3D2 face=3DArial>
style=3D'font-size:10.0pt;font-family:Arial'> the value I
get here and store in the variable $c is =
unprintable.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>if I then try “select * from table where =
binary_field
=3D $c” or “select * from table where binary_field =3D =
“ . $c, both
fail.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>if I store ‘0x’ . =
‘0000000000000112’
to $c and query for that value against the binary field, it finds the =
record
successfully.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>I’m assuming perl can convert the unprintable =
value of
0x0000000000000112 to a string looking like =
‘0x0000000000000112’,
or perhaps ‘0000000000000112’, but having no luck finding =
it.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>is there such a =
function?
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>thanks.
style=3D'font-size:
12.0pt'>
Roman">
style=3D'font-size:10.0pt;color:blue'>John =
DePasquale
Roman">
style=3D'font-size:10.0pt;color:blue'>IT =
Manager
Roman">
style=3D'font-size:10.0pt;color:blue'>Law Offices of James =
Sokolove
url(res://ietag.dll/#34/#1001); BACKGROUND-REPEAT: repeat-x"
w:st=3D"on">
style=3D'font-size:10.0pt;color:blue'>1340 Centre =
Street
–
style=3D"BACKGROUND-POSITION: left bottom; BACKGROUND-IMAGE: =
url(res://ietag.dll/#34/#1001); BACKGROUND-REPEAT: repeat-x"
w:st=3D"on">
102
color=3Dblue face=3D"Times New Roman">
style=3D'font-size:10.0pt;color:blue'>Newton
size=3D2 color=3Dblue>, =
p>
Roman">
style=3D'font-size:10.0pt;color:blue'>P: 617-742-0696, ext. =
432
Roman">
style=3D'font-size:10.0pt;color:blue'>F: =
617-964-4336
style=3D'font-size:7.5pt;font-family:"Microsoft Sans Serif"'>This email =
is
intended solely for the use of the individual to whom it is addressed =
and may
contain information that is privileged, confidential or otherwise exempt =
from
disclosure under applicable law. If the reader of this email is not the
intended recipient or the employee or agent responsible for delivering =
the
message to the intended recipient, you are hereby notified that any
dissemination, distribution, or copying of this communication is =
strictly
prohibited. If you have received this communication in error, please
immediately notify us by telephone and return the original message to us =
at the
listed email address. Thank You.
face=3D"Microsoft Sans Serif">
style=3D'font-size:7.5pt;font-family:"Microsoft Sans =
Serif"'>
style=3D'font-size:
12.0pt'>
------_=_NextPart_001_01C71E2A.68E760AF--
--===============0082201791==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0082201791==--