unpack was the key to this. I figured it out. The following code is working as expected. Thank you. Here's a snippet
#!/usr/bin/perl use warnings; use strict; use IO::Async::Loop; use Net::Async::CassandraCQL; use Protocol::CassandraCQL qw( CONSISTENCY_QUORUM ); use DBI(); use DateTime qw(); use Getopt::Long; use feature qw(say); use MIME::Lite; use File::Basename; use Term::ANSIColor; use utf8; use Text::Unidecode; use bigint; my $database = "xxxx"; my $host = "xxxx"; my $port = xxxx; my $user = "xxxx"; my $password = "xxxx"; my $mysqlTable = "xxxx"; my $dsn = "DBI:mysql:database=$database;host=$host;port=$port"; my $dbh = DBI->connect( $dsn, $user, $password ) || warn "Failed to co +nnect to the database: " . DBI->errstr; my $table = "accounts"; my $keyspace = "loop_non_hadoop_test"; my $loop = IO::Async::Loop->new; my $cass = Net::Async::CassandraCQL->new( host => $host, keyspace => $keyspace, default_consistency => CONSISTENCY_QUORUM, ); $loop->add( $cass ); $cass->connect->get; my $sql = "SELECT `key` FROM `users`"; my $keys = &retrieveData($sql,1); foreach my $get (@{$keys}) { my $hex = unpack('H*', $get->{key}); my $get_stmt = $cass->prepare( 'SELECT "accessedDt" FROM accounts +WHERE key =0x'.$hex )->get; my ( undef, $result ) = $get_stmt->execute( [] )->get; foreach my $row ($result->rows_hash) { my $key_find = ($row->{"accessedDt"}); if (defined $key_find) { say "I found this date --- $key_find"; } } } sub retrieveData { my $value; my $sth = $dbh->prepare($_[0]); $sth->execute(); if ($_[1]) { $value = $sth->fetchall_arrayref({}); } else { $value = $sth->fetchrow_array(); } return $value; }

In reply to Re^3: MySQL DBI dealing with hex blob field by edimusrex
in thread MySQL DBI dealing with hex blob field by edimusrex

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.