in reply to Re^2: MySQL DBI dealing with hex blob field
in thread MySQL DBI dealing with hex blob field

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; }