Skip to content

Instantly share code, notes, and snippets.

/binary.diff Secret

Created September 2, 2016 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/034680eb2eb42654d925be2d717c0a0f to your computer and use it in GitHub Desktop.
Save anonymous/034680eb2eb42654d925be2d717c0a0f to your computer and use it in GitHub Desktop.
diff --git a/t/results.t b/t/results.t
index 8cb450e..6457a49 100644
--- a/t/results.t
+++ b/t/results.t
@@ -157,6 +157,23 @@ my $results2 = $db->query('select 1 as one');
undef $results1;
is_deeply $results2->hashes, [{one => 1}], 'right structure';
+# Binary data
+$db->query(
+ 'create table if not exists results_test2 (
+ id serial primary key,
+ stuff bytea
+ )'
+);
+my $snowman = '☃';
+utf8::encode $snowman;
+#my $dbh = $db->dbh;
+#my $sth = $dbh->prepare('insert into results_test2 (stuff) values (?)');
+#$sth->bind_param(1, $snowman, {pg_type => DBD::Pg::PG_BYTEA});
+#$sth->execute;
+$db->query('insert into results_test2 (stuff) values (?)', $snowman);
+utf8::encode $snowman;
+is $db->query('select * from results_test2')->hash->{stuff}, $snowman;
+
# Clean up once we are done
$pg->db->query('drop schema mojo_results_test cascade');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment