3 # first, populate a DB to test against
6 system 'mysql_install_db --datadir=DIR/mysql';
8 sudo rm test-stdout test-stderr
12 mysqld_safe --datadir=DIR/mysql --log-error=DIR/mysql/log --port=PORT_N --socket=DIR/mysql/sock --pid-file=DIR/mysql/pidfile
15 # wait for db startup, insert some data
17 system 'mysqladmin --protocol=TCP -P PORT_N --connect_timeout=1 --wait=5 -u root create test';
18 system 'mysql --protocol=TCP -P PORT_N -u root -D test \
19 -e "CREATE TABLE them ( name text, id text ); \
20 INSERT INTO them VALUES ( \'Philip Hazel\', \'ph10\' ); \
21 INSERT INTO them VALUES ( \'Aristotle\', \'aaaa\' ); \
22 INSERT INTO them VALUES ( \'\', \'nothing\' ); \
23 INSERT INTO them VALUES ( \'\"stquot\', \'quote2\' ); \
24 INSERT INTO them VALUES ( CONCAT(\'before\', CHAR(13), CHAR(10), \'after\'), \'newline\' ); \
25 INSERT INTO them VALUES ( CONCAT(\'x\', CHAR(9), \'x\'), \'tab\' ); \
26 INSERT INTO them VALUES ( CONCAT(CHAR(39), \'stquot\'), \'quote1\' ); \
29 sudo rm test-stderr-server
32 exim -d-all+lookup -be
33 ${lookup mysql {select name from them where id='ph10';}}
34 ${lookup mysql {select name from them where id='ph10';}}
35 ${lookup mysql {select name from them where id='xxxx';}}
36 ${lookup mysql {select name from them where id='nothing';}}
37 ${lookup mysql {select id,name from them where id='nothing';}}
38 ${lookup mysql {delete from them where id='nonexist';}}
39 ${lookup mysql {select * from them where id='quote';}}
40 ${lookup mysql {select * from them where id='filter';}}
41 ${lookup mysql {select * from them where id='quote2';}}
42 ${lookup mysql {select * from them where id='nlonly';}}
43 ${lookup mysql {servers=x:127.0.0.1::PORT_N; select name from them where id='ph10';}}
44 ${lookup mysql {servers=127.0.0.1::PORT_N:x; select name from them where id='ph10';}}
45 ${lookup mysql {servers=127.0.0.1::PORT_N/test/root/:x; select name from them where id='ph10';}}
46 ${lookup mysql {servers=HOSTIPV4::PORT_N/test/root/:127.0.0.1::PORT_N; select name from them where id='ph10';}}
47 ${lookup mysql {servers=localhost(DIR/mysql/sock)/test/root/; select name from them where id='ph10';}}
49 ${lookup mysql {SELECT name FROM them WHERE id IN ('ph10', 'aaaa');}}
50 ${lookup mysql {SELECT * FROM them WHERE id IN ('ph10', 'aaaa');}}
51 ${lookup mysql {delete from them where id='aaaa'}}
64 system 'mysqladmin --protocol=TCP -P PORT_N -u root shutdown';