edimusrex has asked for the wisdom of the Perl Monks concerning the following question:
I have various option switches I can use with my script and one of them grabs the key value from MySQL and uses it to query the Cassandra database. The issue is that when the DBI returns the value it interprets or converts the value instead of leaving it in it's exact format.
If this is making any sense and if some one could help me, that would be hugely helpful.
Here is a sample of the code.
if ($access) { my $sql = "SELECT `key` FROM `users`"; my $keys = &retrieveData($sql,1); foreach my $get (@{$keys}) { say $get->{key}; my $get_stmt = $cass->prepare( 'SELECT "accessedDt" FROM accou +nts WHERE key = '.$hex->as_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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MySQL DBI dealing with hex blob field
by graff (Chancellor) on Apr 18, 2015 at 02:25 UTC | |
by edimusrex (Monk) on Apr 20, 2015 at 15:44 UTC | |
by edimusrex (Monk) on Apr 20, 2015 at 16:31 UTC |