summaryrefslogtreecommitdiff
path: root/test/scripts/2610-MySQL
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-01-13 18:11:21 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2018-01-13 18:48:33 +0000
commitba0e37b13c652435898f9b1050d6fe648875b125 (patch)
tree2642dc4621bb6aa50e2e63b180f3a6501bb97ac4 /test/scripts/2610-MySQL
parent48155ab3b10f5357609b083ec83d70bd544a5783 (diff)
Lookups: fix mysql lookup returns for no-data "queries",
when the number of rows affected is returned. Bug 2223 Broken-by: acec9514b1 Also enhance the testsuite mysql testcase to be standalone and move to standard-run set and add a specific testcase for this bug. Testcase working on Fedora at least - we'll see what happens on other platforms where executable locaation may vary.
Diffstat (limited to 'test/scripts/2610-MySQL')
-rw-r--r--test/scripts/2610-MySQL/261068
-rw-r--r--test/scripts/2610-MySQL/REQUIRES1
2 files changed, 69 insertions, 0 deletions
diff --git a/test/scripts/2610-MySQL/2610 b/test/scripts/2610-MySQL/2610
new file mode 100644
index 000000000..b3e36a5a7
--- /dev/null
+++ b/test/scripts/2610-MySQL/2610
@@ -0,0 +1,68 @@
+# mysql lookups
+#
+# first, populate a DB to test against
+sudo rm -fr DIR/mysql
+perl
+system 'mysql_install_db --datadir=DIR/mysql';
+****
+sudo rm test-stdout
+#
+# start a db server
+background
+mysqld_safe --datadir=DIR/mysql --log-error=DIR/mysql/log --port=PORT_N --socket=DIR/mysql/sock --pid-file=DIR/mysql/pidfile
+****
+sleep 1
+sudo rm test-stderr-server
+#
+# insert some data
+perl
+system 'mysqladmin --protocol=TCP -P PORT_N -u root create test';
+system 'mysql --protocol=TCP -P PORT_N -u root -D test \
+ -e "CREATE TABLE them ( name text, id text ); \
+ INSERT INTO them VALUES ( \'Philip Hazel\', \'ph10\' ); \
+ INSERT INTO them VALUES ( \'Aristotle\', \'aaaa\' ); \
+ INSERT INTO them VALUES ( \'\', \'nothing\' ); \
+ INSERT INTO them VALUES ( \'\"stquot\', \'quote2\' ); \
+ INSERT INTO them VALUES ( CONCAT(\'before\', CHAR(13), CHAR(10), \'after\'), \'newline\' ); \
+ INSERT INTO them VALUES ( CONCAT(\'x\', CHAR(9), \'x\'), \'tab\' ); \
+ INSERT INTO them VALUES ( CONCAT(CHAR(39), \'stquot\'), \'quote1\' ); \
+ "';
+****
+#
+#
+exim -d-all+lookup -be
+${lookup mysql {select name from them where id='ph10';}}
+${lookup mysql {select name from them where id='ph10';}}
+${lookup mysql {select name from them where id='xxxx';}}
+${lookup mysql {select name from them where id='nothing';}}
+${lookup mysql {select id,name from them where id='nothing';}}
+${lookup mysql {delete from them where id='nonexist';}}
+${lookup mysql {select * from them where id='quote';}}
+${lookup mysql {select * from them where id='filter';}}
+${lookup mysql {select * from them where id='quote2';}}
+${lookup mysql {select * from them where id='nlonly';}}
+${lookup mysql {servers=x:127.0.0.1::PORT_N; select name from them where id='ph10';}}
+${lookup mysql {servers=127.0.0.1::PORT_N:x; select name from them where id='ph10';}}
+${lookup mysql {servers=127.0.0.1::PORT_N/test/root/:x; select name from them where id='ph10';}}
+${lookup mysql {servers=HOSTIPV4::PORT_N/test/root/:127.0.0.1::PORT_N; select name from them where id='ph10';}}
+${lookup mysql {servers=localhost(DIR/mysql/sock)/test/root/; select name from them where id='ph10';}}
+x
+${lookup mysql {SELECT name FROM them WHERE id IN ('ph10', 'aaaa');}}
+${lookup mysql {SELECT * FROM them WHERE id IN ('ph10', 'aaaa');}}
+${lookup mysql {delete from them where id='aaaa'}}
+****
+exim -d -bh 10.0.0.0
+mail from:<a@b>
+rcpt to:<c@d>
+quit
+****
+exim -odi -d ph10
+Test message
+.
+****
+#
+perl
+system 'mysqladmin --protocol=TCP -P PORT_N -u root shutdown';
+****
+killdaemon
+sudo rm -fr DIR/mysql
diff --git a/test/scripts/2610-MySQL/REQUIRES b/test/scripts/2610-MySQL/REQUIRES
new file mode 100644
index 000000000..e11f866d0
--- /dev/null
+++ b/test/scripts/2610-MySQL/REQUIRES
@@ -0,0 +1 @@
+lookup mysql