Commit | Line | Data |
---|---|---|
de1294ea JH |
1 | # pgsql lookups |
2 | # | |
3 | # first, populate a DB to test against | |
4 | sudo rm -fr DIR/pgsql | |
5 | perl | |
6481e125 | 6 | system 'DIR/bin.sys/initdb -D DIR/pgsql/data'; |
de1294ea | 7 | **** |
2b665c13 | 8 | sudo rm test-stdout |
de1294ea | 9 | background |
6481e125 | 10 | DIR/bin.sys/postgres -D DIR/pgsql/data -p PORT_N -k DIR/pgsql |
de1294ea | 11 | **** |
2b665c13 | 12 | sleep 1 |
de1294ea JH |
13 | perl |
14 | system 'createdb -h localhost -p PORT_N test'; | |
15 | system 'psql -h localhost -p PORT_N -d test \ | |
2b665c13 JH |
16 | -c "CREATE TABLE them ( name text, id text ); \ |
17 | INSERT INTO them VALUES ( \'Philip Hazel\', \'ph10\' ); \ | |
18 | INSERT INTO them VALUES ( \'Aristotle\', \'aaaa\' ); \ | |
19 | INSERT INTO them VALUES ( \'\', \'nothing\' ); \ | |
20 | INSERT INTO them VALUES ( \'\"stquot\', \'quote2\' ); \ | |
21 | INSERT INTO them VALUES ( \'before\' || CHR(13) || CHR(10) || \'after\', \'newline\' ); \ | |
22 | INSERT INTO them VALUES ( \'x\' || CHR(9) || \'x\', \'tab\' ); \ | |
23 | INSERT INTO them VALUES ( CHR(39) || \'stquot\', \'quote1\' );" \ | |
de1294ea JH |
24 | '; |
25 | **** | |
26 | # | |
27 | # now, the tests | |
59371ea7 PH |
28 | exim -d-all+lookup -be |
29 | ${lookup pgsql {select name from them where id='ph10';}} | |
30 | ${lookup pgsql {select name from them where id='ph10';}} | |
31 | ${lookup pgsql {select name from them where id='xxxx';}} | |
32 | ${lookup pgsql {select name from them where id='nothing';}} | |
33 | ${lookup pgsql {select id,name from them where id='nothing';}} | |
34 | ${lookup pgsql {delete from them where id='nonexist';}} | |
35 | ${lookup pgsql {select * from them where id='quote2';}} | |
36 | ${lookup pgsql {select * from them where id='newline';}} | |
37 | ${lookup pgsql {select * from them where id='tab';}} | |
5547e2c5 | 38 | ${lookup pgsql {select * from them where name='${quote_pgsql:'stquot}';}} |
b7670459 | 39 | ${lookup pgsql {servers=x:localhost; select name from them where id='ph10';}} |
de1294ea JH |
40 | ${lookup pgsql {servers=localhost::PORT_N:x; select name from them where id='ph10';}} |
41 | ${lookup pgsql {servers=localhost::PORT_N/test/CALLER/:x; select name from them where id='ph10';}} | |
42 | ${lookup pgsql {servers=(DIR/pgsql/.s.PGSQL.PORT_N)/test/CALLER/:x; select name from them where id='ph10';}} | |
bbfb5dcd JH |
43 | x |
44 | ${lookup pgsql {SELECT name FROM them WHERE id IN ('ph10', 'aaaa');}} | |
45 | ${lookup pgsql {SELECT * FROM them WHERE id IN ('ph10', 'aaaa');}} | |
59371ea7 PH |
46 | **** |
47 | exim -d -bh 10.0.0.0 | |
48 | mail from:<a@b> | |
49 | rcpt to:<c@d> | |
50 | rcpt to:<c@d> | |
51 | quit | |
52 | **** | |
53 | exim -odi -d CALLER | |
54 | Test message | |
55 | . | |
56 | **** | |
de1294ea JH |
57 | exim -DSERVERS=\(DIR/pgsql/.s.PGSQL.PORT_N\)/test/CALLER/ -d-all+lookup -be |
58 | ${lookup pgsql {select name from them where id='ph10';}} | |
59 | **** | |
60 | # | |
61 | perl | |
62 | system 'pg_ctl stop -D DIR/pgsql/data -m immediate'; | |
59371ea7 | 63 | **** |
de1294ea JH |
64 | killdaemon |
65 | sudo rm -fr DIR/pgsql |