my $database = 'database';
my $table = 'table';
(
   #{
   #  error   => sub { get('username') ne 'myuser' ? "Access denied -- username must be 'myuser'." : undef },
   #},
   #
   # The queries below are sent by various connectors as part of connection establishment.
   # We provide canned answers for those
   #
   { command  => DBIx::MyServer::COM_PING, 	ok => 1 },
   { command  => DBIx::MyServer::COM_INIT_DB,	ok => 1 },
   { match    => 'SET SQL_AUTO_IS_NULL=0;',	ok => 1 },
   { match    => 'set autocommit=1',		ok => 1 },
   {
      match   => 'SELECT Config, nValue FROM MSysConf',
      error   => ["MSysConf does not exist", 1146, '42S02'],
   },
   {
      match   => qr{^(select database|show databases)}sio,
      columns => 'Database',
      data    => $database,
   },
   {
      match   => qr{^(show tables|show tables like '%')}io,
      columns => 'Tables_in_'.$database,
      data    => $table,
   },
   {
      match   => "SHOW TABLES FROM `mysql` like '%'",
      columns => 'Tables_in_mysql (%)',
      data    => ['user','host'],
   },
   {
      match   => qr{^show keys from},
      columns => 'Keys',
      data    => [],
   },

   {
      match   => qr{^select.*from\s+nosuchtable(\d*).*$}io,
      error   => sub {[qq{Table '$database.nosuchtable$_[1]' doesn't exist},1146,'42S02']},
   },
   {
      match   => qr{^select\s+(.*)\s+from(.*)$}io,
      columns => sub {
         if ($_[2]=~/delay(\d+)/) {
            sleep $1;
         }
         return [split(/,/,$_[1])],
      },
      data	=> sub {
         my ($cmdline,$cols,$rest) = @_;
         my $numr=2;
         my $numc=scalar split(/,/,$cols);
         if ($rest=~/rows(\d+)/) {
            $numr=$1;
         }
         if ($rest=~/limit\s+(\d+)/i) {
            $numr = $numr > $1 ? $1 : $numr;
         }
         return [ ([ ('datum') x $numc ] ) x $numr ];
      },
   },
   {
      match	=> qr{(.*)}o,
      error     => 'not supported',
   },
);