#!/usr/bin/perl -w -T

# WARNING: This script REMOVES the table `test`!!!

# Replace this with your DB connect code:
BEGIN { $ENV{'DOCUMENT_ROOT'} =~ /^(.*)$/; require "$1/../data/perl/Base.pm"; }
use Common;
my $dbh = connect_to_db;

$dbh->do("DROP TABLE IF EXISTS `test`");
$dbh->do(qq{
CREATE TABLE `test` (
  `name` varchar(255) collate utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin
});

$dbh->do("INSERT test (name) VALUES('Бельгия'),('Германия'),('Италия')");

my $col = $dbh->selectcol_arrayref("SELECT name FROM test ORDER BY name");

print "Content-Type: text/plain; charset=utf8\n\n";
print join("\n", @$col);
