ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-DBI/t/myserver.conf
Revision: 1.1
Committed: Tue Jun 2 16:16:03 2009 UTC (14 years, 11 months ago) by root
Branch: MAIN
CVS Tags: rel-3_0, rel-2_2, rel-2_3, rel-2_0, rel-2_1, rel-3_01, rel-3_02, rel-3_03, rel-3_04, HEAD
Log Message:
big patch by adam

File Contents

# Content
1 my $database = 'database';
2 my $table = 'table';
3 (
4 #{
5 # error => sub { get('username') ne 'myuser' ? "Access denied -- username must be 'myuser'." : undef },
6 #},
7 #
8 # The queries below are sent by various connectors as part of connection establishment.
9 # We provide canned answers for those
10 #
11 { command => DBIx::MyServer::COM_PING, ok => 1 },
12 { command => DBIx::MyServer::COM_INIT_DB, ok => 1 },
13 { match => 'SET SQL_AUTO_IS_NULL=0;', ok => 1 },
14 { match => 'set autocommit=1', ok => 1 },
15 {
16 match => 'SELECT Config, nValue FROM MSysConf',
17 error => ["MSysConf does not exist", 1146, '42S02'],
18 },
19 {
20 match => qr{^(select database|show databases)}sio,
21 columns => 'Database',
22 data => $database,
23 },
24 {
25 match => qr{^(show tables|show tables like '%')}io,
26 columns => 'Tables_in_'.$database,
27 data => $table,
28 },
29 {
30 match => "SHOW TABLES FROM `mysql` like '%'",
31 columns => 'Tables_in_mysql (%)',
32 data => ['user','host'],
33 },
34 {
35 match => qr{^show keys from},
36 columns => 'Keys',
37 data => [],
38 },
39
40 {
41 match => qr{^select.*from\s+nosuchtable(\d*).*$}io,
42 error => sub {[qq{Table '$database.nosuchtable$_[1]' doesn't exist},1146,'42S02']},
43 },
44 {
45 match => qr{^select\s+(.*)\s+from(.*)$}io,
46 columns => sub {
47 if ($_[2]=~/delay(\d+)/) {
48 sleep $1;
49 }
50 return [split(/,/,$_[1])],
51 },
52 data => sub {
53 my ($cmdline,$cols,$rest) = @_;
54 my $numr=2;
55 my $numc=scalar split(/,/,$cols);
56 if ($rest=~/rows(\d+)/) {
57 $numr=$1;
58 }
59 if ($rest=~/limit\s+(\d+)/i) {
60 $numr = $numr > $1 ? $1 : $numr;
61 }
62 return [ ([ ('datum') x $numc ] ) x $numr ];
63 },
64 },
65 {
66 match => qr{(.*)}o,
67 error => 'not supported',
68 },
69 );