From 06e19a58b0ddeba3bffbe85923ccef16bb40bbf2 Mon Sep 17 00:00:00 2001 From: emanuelecapanni Date: Thu, 14 Jan 2016 17:20:28 +0100 Subject: [PATCH 1/2] Add support to "dump", "populate" and "cleanup" parameters --- src/Codeception/Extension/MultiDb.php | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/Codeception/Extension/MultiDb.php b/src/Codeception/Extension/MultiDb.php index 82fdcab..12ec713 100644 --- a/src/Codeception/Extension/MultiDb.php +++ b/src/Codeception/Extension/MultiDb.php @@ -13,6 +13,7 @@ use Codeception\Exception\ModuleConfig as ModuleConfigException; use Codeception\Module; use Codeception\TestCase; +use Codeception\Configuration as Configuration; /** * MultiDb - Module that allows tests to perform setup queries and assertions across multiple databases. @@ -85,6 +86,55 @@ public function _initialize() $this->timezone = $this->config['timezone']; parent::_initialize(); + + foreach ($this->config['connectors'] as $connector => $connectorConfig) { + if ($connectorConfig['populate']) { + if ($connectorConfig['cleanup']) { + $this->cleanup($connector); + } + $this->loadDump($connector); + } + } + } + + protected function loadDump($connector) + { + $config = $this->config['connectors'][$connector]; + + if ($config['dump'] && ($config['cleanup'] or ($config['populate']))) { + if (!file_exists(Configuration::projectDir() . $config['dump'])) { + throw new ModuleConfigException( + __CLASS__, + "\nFile with dump doesn't exist. + Please, check path for sql file: " . $config['dump'] + ); + } + $sql = file_get_contents(Configuration::projectDir() . $config['dump']); + $sql = preg_replace('%/\*(?!!\d+)(?:(?!\*/).)*\*/%s', "", $sql); + if (!empty($sql)) { + $sql = explode("\n", $sql); + } + } + if (!$sql) { + return; + } + try { + $this->getDriver($connector)->load($sql); + } catch (\PDOException $e) { + throw new ModuleException( + __CLASS__, + $e->getMessage() . "\nSQL query being executed: " . $sql + ); + } + } + + protected function cleanup($connector) + { + try { + $this->getDriver($connector)->cleanup(); + } catch (\Exception $e) { + throw new ModuleException(__CLASS__, $e->getMessage()); + } } // HOOK: before scenario From aa08da0fe1c89ab421953b2db5c909fd501588ef Mon Sep 17 00:00:00 2001 From: Dino Korah Date: Fri, 17 Jun 2016 15:04:34 +0100 Subject: [PATCH 2/2] Making minor mods to PR #10 Split dump.sql into primary and secondary. Made the example work with the sample database --- examples/codeception.yml | 18 +- examples/tests/_data/dump.sql | 1 - examples/tests/_data/primary.sql | 463 +++++++++++++++++++++++++ examples/tests/_data/secondary.sql | 125 +++++++ examples/tests/acceptance.suite.yml | 10 - examples/tests/acceptance/DemoCest.php | 20 +- src/Codeception/Extension/MultiDb.php | 51 ++- 7 files changed, 647 insertions(+), 41 deletions(-) delete mode 100644 examples/tests/_data/dump.sql create mode 100644 examples/tests/_data/primary.sql create mode 100644 examples/tests/_data/secondary.sql diff --git a/examples/codeception.yml b/examples/codeception.yml index 98d9430..93b1b5d 100644 --- a/examples/codeception.yml +++ b/examples/codeception.yml @@ -18,10 +18,16 @@ modules: Codeception\Extension\MultiDb: connectors: Primary: - dsn: "mysql:host=primary.db.example.com;port=3306;dbname=Demo1" - user: 'demo_primary' - password: '' + dsn: "mysql:host=primary.db.example.com;port=3306;dbname=DemoConfig" + user: 'demo' + password: 'notsecure' + dump: 'tests/_data/primary.sql' + populate: true + cleanup: true Secondary: - dsn: "mysql:host=secondary.db.example.com;port=3306;dbname=Demo2" - user: 'demo_secondary' - password: '' + dsn: "mysql:host=secondary.db.example.com;port=3306;dbname=DemoWarehouse" + user: 'demo' + password: 'notsecure' + dump: 'tests/_data/secondary.sql' + populate: true + cleanup: true diff --git a/examples/tests/_data/dump.sql b/examples/tests/_data/dump.sql deleted file mode 100644 index 4bc742c..0000000 --- a/examples/tests/_data/dump.sql +++ /dev/null @@ -1 +0,0 @@ -/* Replace this file with actual dump of your database */ \ No newline at end of file diff --git a/examples/tests/_data/primary.sql b/examples/tests/_data/primary.sql new file mode 100644 index 0000000..c5b471a --- /dev/null +++ b/examples/tests/_data/primary.sql @@ -0,0 +1,463 @@ +-- schema + +-- +-- Table structure for table `Organisation` +-- + +CREATE TABLE IF NOT EXISTS `DemoConfig`.`Organisation` ( + `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Name` varchar(50) NOT NULL, + `Address` text NOT NULL, + `Active` enum('YES','NO') NOT NULL, + + PRIMARY KEY (`ID`), + UNIQUE KEY `Name_Address` (`Name`, `Address`(100)), + KEY `Active` (`Active`) +); + +-- +-- Table structure for table `User` +-- + +CREATE TABLE IF NOT EXISTS `DemoConfig`.`User` ( + `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, + `OrganisationID` int(10) unsigned NOT NULL, + `Name` varchar(30) NOT NULL, + `Email` varchar(50) NOT NULL, + `Address` text NOT NULL, + `Active` enum('YES','NO') NOT NULL, + + PRIMARY KEY (`ID`), + KEY `Email` (`Email`,`Active`) +); + +ALTER TABLE `User` + ADD FOREIGN KEY (`OrganisationID`) REFERENCES `DemoConfig`.`Organisation`(`ID`) + ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Table structure for table `UserPassword` +-- + +CREATE TABLE IF NOT EXISTS `DemoConfig`.`UserPassword` ( + `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, + `UserID` int(10) unsigned NOT NULL, + `Hash` binary(40) NOT NULL, + `CreatedAt` datetime NOT NULL, + `ExpiresAt` datetime NOT NULL, + + PRIMARY KEY (`ID`), + KEY `UserID_Hash` (`UserID`,`Hash`), + KEY `CreatedAt` (`CreatedAt`), + KEY `ExpiresAt` (`ExpiresAt`), + + CONSTRAINT `UserPassword_User_ID_fk` FOREIGN KEY (`UserID`) REFERENCES `DemoConfig`.`User` (`ID`) ON DELETE CASCADE +); + +-- data + +-- `DemoConfig`.`Organisation` +INSERT INTO `Organisation` (`ID`, `Name`, `Address`, `Active`) VALUES + (1, 'Nulla Semper Tellus Corporation', 'P.O. Box 527, 6924 Nunc Street', 'YES'), + (2, 'Elit Pretium Company', '8429 Morbi St.', 'NO'), + (3, 'Nunc Corporation', '699-5999 Felis Rd.', 'YES'), + (4, 'Massa Inc.', 'P.O. Box 688, 2390 Eleifend Avenue', 'YES'), + (5, 'Porttitor Scelerisque Institute', '3304 Interdum. Av.', 'NO'), + (6, 'Lorem Foundation', 'Ap #335-3537 Nunc Road', 'YES'), + (7, 'Sem Vitae Aliquam Incorporated', 'P.O. Box 247, 3006 Ligula. Avenue', 'NO'), + (8, 'Consequat Dolor Vitae Corp.', '4694 Nonummy. Rd.', 'NO'), + (9, 'Quam Consulting', '237-2226 Eget Road', 'YES'), + (10, 'Mauris Blandit Mattis Industries', '537-7276 Eros. St.', 'NO'), + (11, 'Auctor Nunc Nulla Incorporated', '217-4623 Id Street', 'YES'), + (12, 'Consectetuer Industries', '353-3276 In, St.', 'YES'), + (13, 'Non Nisi PC', 'P.O. Box 828, 3876 Semper Av.', 'YES'), + (14, 'Tempus Mauris Erat Limited', 'P.O. Box 401, 559 Venenatis Rd.', 'NO'), + (15, 'Ac Inc.', 'Ap #395-2226 Sit Street', 'NO'), + (16, 'Lorem Luctus PC', '441-5925 Nec Avenue', 'YES'), + (17, 'Elit Pede LLP', '855-8139 Sed, Road', 'NO'), + (18, 'Sit Amet Corporation', '402-9834 Id Rd.', 'NO'), + (19, 'Egestas Company', 'P.O. Box 978, 5774 Non Avenue', 'YES'), + (20, 'Litora Torquent Foundation', '1323 Proin Street', 'NO'), + (21, 'Non Corp.', '1737 Pellentesque Rd.', 'YES'), + (22, 'Suspendisse Non Leo Corporation', '752-930 Nulla Ave', 'NO'), + (23, 'Elit Aliquam Corporation', '783-5190 Nulla. St.', 'NO'), + (24, 'Sed Molestie Inc.', 'Ap #421-4715 Mus. Street', 'NO'), + (25, 'Purus Corporation', 'P.O. Box 456, 4479 Cum Ave', 'NO'), + (26, 'Convallis Est Limited', 'Ap #790-3117 Quis, Rd.', 'YES'), + (27, 'Elit A Feugiat Incorporated', '2766 Dolor Street', 'YES'), + (28, 'Id Associates', 'Ap #105-7661 Vulputate, Street', 'YES'), + (29, 'Mauris Corp.', 'P.O. Box 668, 2437 Ligula. Road', 'NO'), + (30, 'Aliquet Sem Ut Inc.', '701-7407 Lorem. Rd.', 'NO'), + (31, 'Est Mollis Non Industries', '247-8008 Nec St.', 'NO'), + (32, 'Massa Integer Foundation', 'P.O. Box 234, 1541 Mauris St.', 'YES'), + (33, 'Non Lacinia At Limited', '7870 Nibh. Rd.', 'NO'), + (34, 'Consectetuer LLC', 'P.O. Box 707, 1450 Nunc Avenue', 'YES'), + (35, 'Et Magnis Dis Inc.', 'P.O. Box 653, 6999 Dolor. Rd.', 'YES'), + (36, 'Lorem Fringilla Ornare Incorporated', '170-1950 Aenean St.', 'YES'), + (37, 'Ut Corporation', '927-2867 Vel Avenue', 'YES'), + (38, 'Mauris Ut LLC', 'P.O. Box 419, 6728 Non, Av.', 'YES'), + (39, 'Consequat Dolor PC', '3672 Phasellus Road', 'NO'), + (40, 'Metus Eu Erat LLC', 'P.O. Box 250, 1490 Dui, Rd.', 'NO'), + (41, 'Ultrices Foundation', 'Ap #908-7325 Vivamus Avenue', 'NO'), + (42, 'Morbi Company', '238-810 Ipsum St.', 'YES'), + (43, 'Non PC', 'Ap #808-6214 Amet, St.', 'YES'), + (44, 'Cras Sed Ltd', 'P.O. Box 629, 6337 Varius Rd.', 'YES'), + (45, 'Curae; Donec Tincidunt Ltd', 'Ap #308-2587 Donec Ave', 'YES'), + (46, 'Nec Malesuada Ut Inc.', '814-372 Nunc, St.', 'NO'), + (47, 'Eu Dui Cum Company', 'P.O. Box 651, 4410 Ut Rd.', 'YES'), + (48, 'Sit Foundation', '699-933 Tempor St.', 'NO'), + (49, 'Risus Donec Incorporated', '731-6026 Turpis Avenue', 'YES'), + (50, 'Turpis Foundation', '276-2658 Nunc Street', 'YES'), + (51, 'Euismod Corporation', '3973 Nullam Avenue', 'YES'), + (52, 'Sem Magna Nec LLP', '9989 Adipiscing Ave', 'YES'), + (53, 'Egestas Duis Ac Consulting', '8680 Blandit Rd.', 'YES'), + (54, 'Eget Institute', 'Ap #621-2465 Fusce Rd.', 'NO'), + (55, 'Id Risus Quis Inc.', 'P.O. Box 384, 4649 Rutrum, Ave', 'YES'), + (56, 'Fringilla Ornare LLC', 'P.O. Box 268, 8448 Proin Ave', 'NO'), + (57, 'Sem Inc.', 'Ap #363-1330 Erat, Ave', 'YES'), + (58, 'Id Magna Et Associates', '6706 Sagittis Avenue', 'YES'), + (59, 'Pede Cras Vulputate Corp.', 'P.O. Box 286, 8275 Mollis Avenue', 'YES'), + (60, 'Consectetuer Adipiscing Company', '241-5889 Ridiculus Street', 'YES'), + (61, 'Ipsum Institute', 'P.O. Box 938, 7160 Bibendum Avenue', 'YES'), + (62, 'Cras Eu Tellus PC', '563-2576 Mus. Av.', 'NO'), + (63, 'Nisi Mauris Foundation', 'P.O. Box 938, 1171 Lacus. St.', 'YES'), + (64, 'Volutpat Nulla Ltd', 'Ap #945-7325 Risus. Avenue', 'NO'), + (65, 'Proin Velit Sed Foundation', 'P.O. Box 335, 8808 In Avenue', 'YES'), + (66, 'Eget Tincidunt Corp.', 'P.O. Box 385, 8232 Cursus Rd.', 'YES'), + (67, 'Auctor Non Feugiat PC', 'Ap #573-7089 Enim. St.', 'NO'), + (68, 'Pharetra Nam PC', '513-8816 Lectus. St.', 'YES'), + (69, 'Ridiculus Institute', 'Ap #456-7713 Vehicula. Rd.', 'YES'), + (70, 'In Nec LLP', 'Ap #402-6898 Mauris St.', 'NO'), + (71, 'Nunc Pulvinar Arcu Inc.', 'Ap #852-7892 Congue Ave', 'YES'), + (72, 'Fringilla Institute', 'Ap #503-4178 Habitant Av.', 'NO'), + (73, 'Amet Inc.', 'P.O. Box 353, 6157 Erat St.', 'YES'), + (74, 'Cum Sociis Natoque Consulting', 'P.O. Box 845, 6668 Tempus Avenue', 'YES'), + (75, 'Lectus Nullam LLP', '768-6479 Suscipit, Rd.', 'YES'), + (76, 'Vulputate Risus Inc.', '4634 Nulla Avenue', 'YES'), + (77, 'Convallis Convallis Dolor Inc.', '8292 Enim. Rd.', 'YES'), + (78, 'Eget Metus In Company', '3743 Nulla Ave', 'YES'), + (79, 'Augue Eu Consulting', 'Ap #609-905 Justo Road', 'YES'), + (80, 'Nulla Interdum Curabitur LLC', 'Ap #659-5973 Integer St.', 'YES'), + (81, 'Sed Leo Cras Corporation', 'P.O. Box 619, 7280 In Road', 'NO'), + (82, 'Nec Limited', 'Ap #465-4661 Nulla. Av.', 'NO'), + (83, 'Ut Pellentesque Eget Ltd', '287-4183 Ante Road', 'NO'), + (84, 'Mus Proin Vel Institute', '5108 In St.', 'NO'), + (85, 'Scelerisque Scelerisque Dui Corporation', '6815 Risus. St.', 'YES'), + (86, 'Nunc Sit Corporation', 'P.O. Box 222, 2249 Augue. Street', 'NO'), + (87, 'Integer Eu Corp.', 'Ap #638-401 Urna Rd.', 'NO'), + (88, 'Dui LLC', '541-9383 Vitae St.', 'NO'), + (89, 'Mattis Integer Eu Inc.', 'P.O. Box 853, 3404 Ligula. Av.', 'YES'), + (90, 'Neque In Associates', '431-3363 Urna, Rd.', 'NO'), + (91, 'Interdum Limited', '6837 Integer Rd.', 'NO'), + (92, 'In Scelerisque PC', '752 Tellus Avenue', 'YES'), + (93, 'Elementum Sem Industries', 'P.O. Box 569, 5105 Amet Rd.', 'NO'), + (94, 'Adipiscing Elit Etiam LLC', 'P.O. Box 339, 5654 Elit St.', 'NO'), + (95, 'Quis Massa Mauris Limited', '338-157 Sagittis. Ave', 'NO'), + (96, 'Phasellus Fermentum Incorporated', '7073 Duis St.', 'NO'), + (97, 'Enim Mauris Associates', 'P.O. Box 757, 7817 Sed St.', 'YES'), + (98, 'Risus A Ultricies Company', 'P.O. Box 909, 2058 Consectetuer Rd.', 'NO'), + (99, 'At Velit LLP', '2317 Eget Avenue', 'YES'), + (100, 'Auctor Corporation', 'P.O. Box 420, 8092 Morbi Ave', 'YES'); + +-- `DemoConfig`.`User` +INSERT INTO `User` (`ID`, `OrganisationID`, `Name`, `Email`, `Address`, `Active`) VALUES + (102, 82, 'Gil Sutton', 'sed@nislMaecenasmalesuada.com', 'Ap #848-3663 Nibh Road', 'NO'), + (103, 81, 'Ursula Mitchell', 'varius.Nam@idmagnaet.edu', '8190 Cubilia Rd.', 'NO'), + (104, 52, 'Illiana Guy', 'adipiscing@dapibusgravidaAliquam.edu', '7935 Sem St.', 'NO'), + (105, 31, 'MacKenzie Holder', 'purus@egestasurna.ca', '5740 Massa. Av.', 'NO'), + (106, 36, 'Lisandra Evans', 'Suspendisse.aliquet.sem@egetmollis.co.uk', 'Ap #355-2371 Nunc Avenue', 'YES'), + (107, 58, 'Sylvester Hartman', 'In@ligulaNullam.net', '1396 Vivamus Road', 'YES'), + (108, 75, 'Nina Olsen', 'auctor@nuncInat.edu', 'Ap #700-5085 Fringilla Avenue', 'YES'), + (109, 3, 'Branden Doyle', 'lacus@aliquetdiam.org', '567-4712 In Rd.', 'NO'), + (110, 12, 'Cole Castillo', 'et.tristique@ipsum.net', 'Ap #946-8954 Cras Rd.', 'NO'), + (111, 55, 'Shaeleigh Caldwell', 'iaculis.nec@etarcu.org', '9755 Auctor Street', 'NO'), + (112, 49, 'Colt Woodward', 'ligula.Aenean@ultricies.com', 'Ap #414-7126 Praesent Street', 'YES'), + (113, 14, 'Gannon Sims', 'Duis.at@eratVivamus.edu', '477-7656 Maecenas Av.', 'NO'), + (114, 1, 'Cailin Bartlett', 'mauris.a.nunc@Infaucibus.net', 'Ap #766-2677 Faucibus. St.', 'NO'), + (115, 98, 'Kiara Kemp', 'Nam.ligula.elit@ut.co.uk', 'Ap #692-6623 Massa. Rd.', 'NO'), + (116, 39, 'Veda Pearson', 'Suspendisse@cursusvestibulumMauris.net', '170-5360 Lectus Rd.', 'NO'), + (117, 34, 'Quinn Gomez', 'eleifend.nec.malesuada@disparturientmontes.ca', 'P.O. Box 202, 1836 Non, St.', 'NO'), + (118, 9, 'Doris Malone', 'scelerisque@faucibusMorbivehicula.ca', '390-6380 Non, Av.', 'NO'), + (119, 40, 'Aimee Rodriguez', 'blandit.enim.consequat@ut.org', '5475 Ac Ave', 'NO'), + (120, 36, 'Abigail Mckee', 'arcu.Vestibulum.ante@Vestibulumanteipsum.co.uk', '942-2265 Ante Rd.', 'YES'), + (121, 83, 'Price Barton', 'congue@turpis.co.uk', '870-9293 Hendrerit St.', 'NO'), + (122, 50, 'Grace Villarreal', 'non.massa@lectus.ca', '892 Luctus St.', 'NO'), + (123, 58, 'Maxwell Boyd', 'eget.nisi@ideratEtiam.co.uk', 'Ap #813-8776 Odio Rd.', 'YES'), + (124, 97, 'Claire Medina', 'felis@nonummy.org', '8388 Sagittis. St.', 'YES'), + (125, 41, 'Portia Mullins', 'fames.ac.turpis@anteiaculis.net', 'Ap #705-349 Curabitur Avenue', 'YES'), + (126, 61, 'Anne Campos', 'rutrum.Fusce@Vivamus.com', 'P.O. Box 660, 4175 Enim. Road', 'NO'), + (127, 4, 'Kaitlin Harris', 'pede.Cras.vulputate@aptent.co.uk', 'Ap #445-4263 Lobortis, Rd.', 'NO'), + (128, 23, 'Sade Oconnor', 'ante@egetmetus.org', '623-5268 Nam Avenue', 'YES'), + (129, 39, 'Colby Fisher', 'velit@fringillacursus.ca', '623-4991 Sed Rd.', 'YES'), + (130, 28, 'Katell Schneider', 'est.mollis.non@hymenaeos.org', 'Ap #912-3072 Gravida. Av.', 'YES'), + (131, 17, 'Noble Glass', 'posuere.cubilia@Sedeget.net', '7024 Duis Rd.', 'NO'), + (132, 16, 'Ayanna Greene', 'purus.Nullam.scelerisque@In.edu', '790-4442 Dapibus Street', 'YES'), + (133, 81, 'Noah Everett', 'in.faucibus.orci@inlobortistellus.net', '5294 Mollis. Rd.', 'NO'), + (134, 1, 'Isabella Bird', 'in.tempus.eu@magnatellusfaucibus.org', '8467 Metus. St.', 'YES'), + (135, 86, 'Simon Leblanc', 'felis.ullamcorper@duiCraspellentesque.ca', 'Ap #251-6073 Torquent Rd.', 'NO'), + (136, 36, 'Claudia Ashley', 'Aliquam@Donec.co.uk', 'P.O. Box 110, 1572 Scelerisque Rd.', 'YES'), + (137, 93, 'Michael Bowers', 'est@dis.ca', '466-4654 Adipiscing Rd.', 'NO'), + (138, 82, 'Byron Walker', 'cursus.Nunc.mauris@Vivamus.net', '228-5563 Quisque Rd.', 'YES'), + (139, 26, 'Merritt Emerson', 'fringilla@magna.edu', '6942 Tellus. Ave', 'NO'), + (140, 47, 'Daryl Bradley', 'Aliquam@aliquetvelvulputate.ca', 'Ap #682-4061 At Avenue', 'NO'), + (141, 46, 'Fletcher Clark', 'neque.pellentesque.massa@nullaatsem.org', 'Ap #927-4240 Non, Street', 'NO'), + (142, 36, 'Carissa Dixon', 'risus.In.mi@nonlobortisquis.edu', 'P.O. Box 574, 8666 Curabitur Street', 'YES'), + (143, 40, 'Madeson Rivera', 'penatibus.et.magnis@luctus.edu', '3447 Amet, St.', 'NO'), + (144, 86, 'Rooney Horne', 'Nullam.feugiat.placerat@eumetus.org', '3644 Aliquam Road', 'NO'), + (145, 91, 'Scarlett Byers', 'dolor.Fusce@libero.com', 'Ap #138-1912 Tortor, Street', 'YES'), + (146, 26, 'Kirestin Rocha', 'eleifend.vitae.erat@neque.co.uk', '286-7344 Magna, Avenue', 'NO'), + (147, 58, 'Dexter Britt', 'Aliquam@nibh.co.uk', 'Ap #430-5061 Vel Street', 'YES'), + (148, 9, 'Mufutau Lester', 'Sed.et.libero@Nuncquisarcu.edu', 'P.O. Box 932, 499 Tempus Street', 'YES'), + (149, 54, 'Justina Kaufman', 'magna.sed.dui@Pellentesque.com', '430 Leo Street', 'YES'), + (150, 54, 'Scarlett Holland', 'at.pede.Cras@aliquetlobortisnisi.edu', '9240 Sed Rd.', 'YES'), + (151, 34, 'Porter Adkins', 'arcu.eu.odio@aodiosemper.ca', 'P.O. Box 975, 9040 Ac Road', 'YES'), + (152, 1, 'Fatima Fox', 'quis@bibendumsed.com', '885-6113 Eu St.', 'YES'), + (153, 22, 'Steel Ortiz', 'luctus.sit.amet@Nulla.edu', '7879 Facilisis St.', 'NO'), + (154, 49, 'Garth Whitfield', 'nunc@diamloremauctor.com', '4654 Metus. Rd.', 'NO'), + (155, 45, 'Claire Berry', 'eget.massa.Suspendisse@tortor.ca', '867-600 Duis Rd.', 'NO'), + (156, 62, 'Aimee Anthony', 'faucibus.lectus@nonummyipsum.net', 'P.O. Box 826, 1887 Elit St.', 'YES'), + (157, 79, 'Keegan Soto', 'nec@velitSedmalesuada.com', 'P.O. Box 227, 6769 Erat, St.', 'YES'), + (158, 23, 'Lacy Hansen', 'sed@Nullamsuscipitest.co.uk', '699-5004 Est Ave', 'YES'), + (159, 59, 'Amelia Oneill', 'pede@congueelitsed.co.uk', '1994 Ut St.', 'YES'), + (160, 43, 'Tucker Mathis', 'velit.in@velit.net', '8489 Nam Av.', 'NO'), + (161, 88, 'Aretha Roberson', 'Aenean.massa.Integer@Proinnon.net', '195-2373 Turpis. St.', 'YES'), + (162, 37, 'Blossom Spears', 'ut.dolor@Sedeu.edu', 'P.O. Box 606, 8608 Commodo Rd.', 'NO'), + (163, 93, 'Jana Dorsey', 'dui@Nullatempor.edu', 'Ap #210-3797 Eu Ave', 'NO'), + (164, 73, 'Shoshana Jacobs', 'vehicula.Pellentesque.tincidunt@pedesagittis.edu', '624-5048 Vel, Road', 'YES'), + (165, 77, 'Lawrence Lewis', 'ligula.eu@anteMaecenas.com', '877-356 Blandit Street', 'YES'), + (166, 74, 'Jerome Oneil', 'id.blandit.at@sem.net', '1028 Auctor Street', 'NO'), + (167, 13, 'Axel Young', 'massa.Quisque.porttitor@elementumpurusaccumsan.edu', 'P.O. Box 140, 8531 Dui Av.', 'NO'), + (168, 79, 'Rhonda Peterson', 'nec.urna.suscipit@intempuseu.edu', '2535 Ligula. Road', 'YES'), + (169, 19, 'Cairo Barry', 'interdum@felis.ca', '339-7993 Natoque St.', 'NO'), + (170, 40, 'Otto Terrell', 'ipsum.non@atfringillapurus.org', '918 Augue St.', 'YES'), + (171, 51, 'Ginger Booth', 'auctor.velit.eget@a.com', 'P.O. Box 717, 1821 Tincidunt St.', 'NO'), + (172, 21, 'Kenneth Hanson', 'Proin@Vivamussitamet.co.uk', 'P.O. Box 405, 1931 Class St.', 'NO'), + (173, 21, 'Lesley Burt', 'ridiculus.mus@vestibulumnequesed.net', '238-6188 Quisque Street', 'NO'), + (174, 72, 'Laurel Anthony', 'dolor.nonummy@lobortisquis.ca', '9279 Eu, Ave', 'NO'), + (175, 6, 'Adele Burke', 'sed.leo.Cras@ornare.co.uk', 'P.O. Box 280, 8885 Ipsum. Avenue', 'YES'), + (176, 49, 'Whitney King', 'non.bibendum.sed@Seddictum.co.uk', 'P.O. Box 251, 2818 Tempus Avenue', 'NO'), + (177, 48, 'Natalie Peck', 'convallis.est@cursusa.ca', '708-7354 Placerat. Rd.', 'YES'), + (178, 47, 'Levi Dawson', 'ante.ipsum@Crasdictumultricies.co.uk', 'P.O. Box 187, 3827 Ut Av.', 'NO'), + (179, 33, 'Oleg Sheppard', 'dolor@pellentesquea.co.uk', 'P.O. Box 801, 7191 Vitae Rd.', 'NO'), + (180, 34, 'Lionel Valentine', 'non@ullamcorperDuis.co.uk', 'Ap #533-2053 Risus. Street', 'NO'), + (181, 10, 'Kamal Delgado', 'vehicula@duiquisaccumsan.ca', 'Ap #244-7213 Ultricies Av.', 'NO'), + (182, 14, 'Lois Poole', 'odio.Nam.interdum@vitae.org', 'Ap #770-1702 Iaculis Ave', 'YES'), + (183, 26, 'Mercedes Neal', 'urna.suscipit@massa.ca', '627-976 Vel, Avenue', 'YES'), + (184, 22, 'Briar Hoover', 'vitae.sodales@molestietellusAenean.net', 'P.O. Box 919, 7904 Odio St.', 'NO'), + (185, 99, 'Vanna Harrell', 'auctor.velit@eros.com', 'Ap #895-4634 Nulla. Ave', 'YES'), + (186, 3, 'Lisandra Rivers', 'Aliquam.adipiscing@a.ca', '3044 Libero St.', 'NO'), + (187, 21, 'Cadman Roth', 'egestas@tortor.edu', 'Ap #654-4627 Vehicula Rd.', 'NO'), + (188, 21, 'Uriah Rivera', 'Nulla.interdum@pharetraQuisqueac.co.uk', 'Ap #336-767 Neque. Road', 'YES'), + (189, 41, 'Ruth Hall', 'ornare.lectus@idmagna.edu', 'Ap #163-6573 Sem Rd.', 'YES'), + (190, 54, 'Selma Gray', 'Ut.sagittis@eleifendnon.ca', 'Ap #869-6896 Feugiat Av.', 'YES'), + (191, 71, 'Cathleen Short', 'Duis@dolordapibusgravida.org', '8300 Pede. St.', 'YES'), + (192, 5, 'Roanna Alexander', 'lorem.fringilla@dolor.co.uk', '914-9137 Fringilla. Av.', 'NO'), + (193, 55, 'Richard Whitfield', 'bibendum.fermentum.metus@aliquet.ca', 'Ap #742-7093 Lorem Avenue', 'NO'), + (194, 78, 'Colorado West', 'et.magnis@dui.com', '944-3861 Non Street', 'NO'), + (195, 23, 'Ebony Clements', 'Cras.vulputate.velit@odiotristique.net', 'Ap #926-6076 Nibh Avenue', 'NO'), + (196, 25, 'Rosalyn Cote', 'penatibus.et@imperdiet.net', 'Ap #557-8597 Eleifend. Rd.', 'YES'), + (197, 86, 'Dara Zimmerman', 'non@molestiesodales.co.uk', 'Ap #268-848 Orci Street', 'YES'), + (198, 65, 'Brock Riddle', 'consectetuer.adipiscing@vestibulum.edu', 'P.O. Box 143, 1841 Vestibulum St.', 'YES'), + (199, 46, 'Abra Sweeney', 'vitae.nibh.Donec@metus.ca', '435-8343 Sem Rd.', 'NO'), + (200, 11, 'Wilma Travis', 'montes@Mauris.co.uk', 'P.O. Box 821, 8866 Dictum. Rd.', 'YES'), + (201, 58, 'Blake Page', 'dignissim.tempor@Nuncmaurissapien.ca', '2195 Magna. Rd.', 'NO'), + (202, 82, 'Gil Sutton', 'sed@nislMaecenasmalesuada.com', 'Ap #848-3663 Nibh Road', 'NO'), + (203, 81, 'Ursula Mitchell', 'varius.Nam@idmagnaet.edu', '8190 Cubilia Rd.', 'NO'), + (204, 52, 'Illiana Guy', 'adipiscing@dapibusgravidaAliquam.edu', '7935 Sem St.', 'NO'), + (205, 31, 'MacKenzie Holder', 'purus@egestasurna.ca', '5740 Massa. Av.', 'NO'), + (206, 36, 'Lisandra Evans', 'Suspendisse.aliquet.sem@egetmollis.co.uk', 'Ap #355-2371 Nunc Avenue', 'YES'), + (207, 58, 'Sylvester Hartman', 'In@ligulaNullam.net', '1396 Vivamus Road', 'YES'), + (208, 75, 'Nina Olsen', 'auctor@nuncInat.edu', 'Ap #700-5085 Fringilla Avenue', 'YES'), + (209, 3, 'Branden Doyle', 'lacus@aliquetdiam.org', '567-4712 In Rd.', 'NO'), + (210, 12, 'Cole Castillo', 'et.tristique@ipsum.net', 'Ap #946-8954 Cras Rd.', 'NO'), + (211, 55, 'Shaeleigh Caldwell', 'iaculis.nec@etarcu.org', '9755 Auctor Street', 'NO'), + (212, 49, 'Colt Woodward', 'ligula.Aenean@ultricies.com', 'Ap #414-7126 Praesent Street', 'YES'), + (213, 14, 'Gannon Sims', 'Duis.at@eratVivamus.edu', '477-7656 Maecenas Av.', 'NO'), + (214, 1, 'Cailin Bartlett', 'mauris.a.nunc@Infaucibus.net', 'Ap #766-2677 Faucibus. St.', 'NO'), + (215, 98, 'Kiara Kemp', 'Nam.ligula.elit@ut.co.uk', 'Ap #692-6623 Massa. Rd.', 'NO'), + (216, 39, 'Veda Pearson', 'Suspendisse@cursusvestibulumMauris.net', '170-5360 Lectus Rd.', 'NO'), + (217, 34, 'Quinn Gomez', 'eleifend.nec.malesuada@disparturientmontes.ca', 'P.O. Box 202, 1836 Non, St.', 'NO'), + (218, 9, 'Doris Malone', 'scelerisque@faucibusMorbivehicula.ca', '390-6380 Non, Av.', 'NO'), + (219, 40, 'Aimee Rodriguez', 'blandit.enim.consequat@ut.org', '5475 Ac Ave', 'NO'), + (220, 36, 'Abigail Mckee', 'arcu.Vestibulum.ante@Vestibulumanteipsum.co.uk', '942-2265 Ante Rd.', 'YES'), + (221, 83, 'Price Barton', 'congue@turpis.co.uk', '870-9293 Hendrerit St.', 'NO'), + (222, 50, 'Grace Villarreal', 'non.massa@lectus.ca', '892 Luctus St.', 'NO'), + (223, 58, 'Maxwell Boyd', 'eget.nisi@ideratEtiam.co.uk', 'Ap #813-8776 Odio Rd.', 'YES'), + (224, 97, 'Claire Medina', 'felis@nonummy.org', '8388 Sagittis. St.', 'YES'), + (225, 41, 'Portia Mullins', 'fames.ac.turpis@anteiaculis.net', 'Ap #705-349 Curabitur Avenue', 'YES'), + (226, 61, 'Anne Campos', 'rutrum.Fusce@Vivamus.com', 'P.O. Box 660, 4175 Enim. Road', 'NO'), + (227, 4, 'Kaitlin Harris', 'pede.Cras.vulputate@aptent.co.uk', 'Ap #445-4263 Lobortis, Rd.', 'NO'), + (228, 23, 'Sade Oconnor', 'ante@egetmetus.org', '623-5268 Nam Avenue', 'YES'), + (229, 39, 'Colby Fisher', 'velit@fringillacursus.ca', '623-4991 Sed Rd.', 'YES'), + (230, 28, 'Katell Schneider', 'est.mollis.non@hymenaeos.org', 'Ap #912-3072 Gravida. Av.', 'YES'), + (231, 17, 'Noble Glass', 'posuere.cubilia@Sedeget.net', '7024 Duis Rd.', 'NO'), + (232, 16, 'Ayanna Greene', 'purus.Nullam.scelerisque@In.edu', '790-4442 Dapibus Street', 'YES'), + (233, 81, 'Noah Everett', 'in.faucibus.orci@inlobortistellus.net', '5294 Mollis. Rd.', 'NO'), + (234, 1, 'Isabella Bird', 'in.tempus.eu@magnatellusfaucibus.org', '8467 Metus. St.', 'YES'), + (235, 86, 'Simon Leblanc', 'felis.ullamcorper@duiCraspellentesque.ca', 'Ap #251-6073 Torquent Rd.', 'NO'), + (236, 36, 'Claudia Ashley', 'Aliquam@Donec.co.uk', 'P.O. Box 110, 1572 Scelerisque Rd.', 'YES'), + (237, 93, 'Michael Bowers', 'est@dis.ca', '466-4654 Adipiscing Rd.', 'NO'), + (238, 82, 'Byron Walker', 'cursus.Nunc.mauris@Vivamus.net', '228-5563 Quisque Rd.', 'YES'), + (239, 26, 'Merritt Emerson', 'fringilla@magna.edu', '6942 Tellus. Ave', 'NO'), + (240, 47, 'Daryl Bradley', 'Aliquam@aliquetvelvulputate.ca', 'Ap #682-4061 At Avenue', 'NO'), + (241, 46, 'Fletcher Clark', 'neque.pellentesque.massa@nullaatsem.org', 'Ap #927-4240 Non, Street', 'NO'), + (242, 36, 'Carissa Dixon', 'risus.In.mi@nonlobortisquis.edu', 'P.O. Box 574, 8666 Curabitur Street', 'YES'), + (243, 40, 'Madeson Rivera', 'penatibus.et.magnis@luctus.edu', '3447 Amet, St.', 'NO'), + (244, 86, 'Rooney Horne', 'Nullam.feugiat.placerat@eumetus.org', '3644 Aliquam Road', 'NO'), + (245, 91, 'Scarlett Byers', 'dolor.Fusce@libero.com', 'Ap #138-1912 Tortor, Street', 'YES'), + (246, 26, 'Kirestin Rocha', 'eleifend.vitae.erat@neque.co.uk', '286-7344 Magna, Avenue', 'NO'), + (247, 58, 'Dexter Britt', 'Aliquam@nibh.co.uk', 'Ap #430-5061 Vel Street', 'YES'), + (248, 9, 'Mufutau Lester', 'Sed.et.libero@Nuncquisarcu.edu', 'P.O. Box 932, 499 Tempus Street', 'YES'), + (249, 54, 'Justina Kaufman', 'magna.sed.dui@Pellentesque.com', '430 Leo Street', 'YES'), + (250, 54, 'Scarlett Holland', 'at.pede.Cras@aliquetlobortisnisi.edu', '9240 Sed Rd.', 'YES'), + (251, 34, 'Porter Adkins', 'arcu.eu.odio@aodiosemper.ca', 'P.O. Box 975, 9040 Ac Road', 'YES'), + (252, 1, 'Fatima Fox', 'quis@bibendumsed.com', '885-6113 Eu St.', 'YES'), + (253, 22, 'Steel Ortiz', 'luctus.sit.amet@Nulla.edu', '7879 Facilisis St.', 'NO'), + (254, 49, 'Garth Whitfield', 'nunc@diamloremauctor.com', '4654 Metus. Rd.', 'NO'), + (255, 45, 'Claire Berry', 'eget.massa.Suspendisse@tortor.ca', '867-600 Duis Rd.', 'NO'), + (256, 62, 'Aimee Anthony', 'faucibus.lectus@nonummyipsum.net', 'P.O. Box 826, 1887 Elit St.', 'YES'), + (257, 79, 'Keegan Soto', 'nec@velitSedmalesuada.com', 'P.O. Box 227, 6769 Erat, St.', 'YES'), + (258, 23, 'Lacy Hansen', 'sed@Nullamsuscipitest.co.uk', '699-5004 Est Ave', 'YES'), + (259, 59, 'Amelia Oneill', 'pede@congueelitsed.co.uk', '1994 Ut St.', 'YES'), + (260, 43, 'Tucker Mathis', 'velit.in@velit.net', '8489 Nam Av.', 'NO'), + (261, 88, 'Aretha Roberson', 'Aenean.massa.Integer@Proinnon.net', '195-2373 Turpis. St.', 'YES'), + (262, 37, 'Blossom Spears', 'ut.dolor@Sedeu.edu', 'P.O. Box 606, 8608 Commodo Rd.', 'NO'), + (263, 93, 'Jana Dorsey', 'dui@Nullatempor.edu', 'Ap #210-3797 Eu Ave', 'NO'), + (264, 73, 'Shoshana Jacobs', 'vehicula.Pellentesque.tincidunt@pedesagittis.edu', '624-5048 Vel, Road', 'YES'), + (265, 77, 'Lawrence Lewis', 'ligula.eu@anteMaecenas.com', '877-356 Blandit Street', 'YES'), + (266, 74, 'Jerome Oneil', 'id.blandit.at@sem.net', '1028 Auctor Street', 'NO'), + (267, 13, 'Axel Young', 'massa.Quisque.porttitor@elementumpurusaccumsan.edu', 'P.O. Box 140, 8531 Dui Av.', 'NO'), + (268, 79, 'Rhonda Peterson', 'nec.urna.suscipit@intempuseu.edu', '2535 Ligula. Road', 'YES'), + (269, 19, 'Cairo Barry', 'interdum@felis.ca', '339-7993 Natoque St.', 'NO'), + (270, 40, 'Otto Terrell', 'ipsum.non@atfringillapurus.org', '918 Augue St.', 'YES'), + (271, 51, 'Ginger Booth', 'auctor.velit.eget@a.com', 'P.O. Box 717, 1821 Tincidunt St.', 'NO'), + (272, 21, 'Kenneth Hanson', 'Proin@Vivamussitamet.co.uk', 'P.O. Box 405, 1931 Class St.', 'NO'), + (273, 21, 'Lesley Burt', 'ridiculus.mus@vestibulumnequesed.net', '238-6188 Quisque Street', 'NO'), + (274, 72, 'Laurel Anthony', 'dolor.nonummy@lobortisquis.ca', '9279 Eu, Ave', 'NO'), + (275, 6, 'Adele Burke', 'sed.leo.Cras@ornare.co.uk', 'P.O. Box 280, 8885 Ipsum. Avenue', 'YES'), + (276, 49, 'Whitney King', 'non.bibendum.sed@Seddictum.co.uk', 'P.O. Box 251, 2818 Tempus Avenue', 'NO'), + (277, 48, 'Natalie Peck', 'convallis.est@cursusa.ca', '708-7354 Placerat. Rd.', 'YES'), + (278, 47, 'Levi Dawson', 'ante.ipsum@Crasdictumultricies.co.uk', 'P.O. Box 187, 3827 Ut Av.', 'NO'), + (279, 33, 'Oleg Sheppard', 'dolor@pellentesquea.co.uk', 'P.O. Box 801, 7191 Vitae Rd.', 'NO'), + (280, 34, 'Lionel Valentine', 'non@ullamcorperDuis.co.uk', 'Ap #533-2053 Risus. Street', 'NO'), + (281, 10, 'Kamal Delgado', 'vehicula@duiquisaccumsan.ca', 'Ap #244-7213 Ultricies Av.', 'NO'), + (282, 14, 'Lois Poole', 'odio.Nam.interdum@vitae.org', 'Ap #770-1702 Iaculis Ave', 'YES'), + (283, 26, 'Mercedes Neal', 'urna.suscipit@massa.ca', '627-976 Vel, Avenue', 'YES'), + (284, 22, 'Briar Hoover', 'vitae.sodales@molestietellusAenean.net', 'P.O. Box 919, 7904 Odio St.', 'NO'), + (285, 99, 'Vanna Harrell', 'auctor.velit@eros.com', 'Ap #895-4634 Nulla. Ave', 'YES'), + (286, 3, 'Lisandra Rivers', 'Aliquam.adipiscing@a.ca', '3044 Libero St.', 'NO'), + (287, 21, 'Cadman Roth', 'egestas@tortor.edu', 'Ap #654-4627 Vehicula Rd.', 'NO'), + (288, 21, 'Uriah Rivera', 'Nulla.interdum@pharetraQuisqueac.co.uk', 'Ap #336-767 Neque. Road', 'YES'), + (289, 41, 'Ruth Hall', 'ornare.lectus@idmagna.edu', 'Ap #163-6573 Sem Rd.', 'YES'), + (290, 54, 'Selma Gray', 'Ut.sagittis@eleifendnon.ca', 'Ap #869-6896 Feugiat Av.', 'YES'), + (291, 71, 'Cathleen Short', 'Duis@dolordapibusgravida.org', '8300 Pede. St.', 'YES'), + (292, 5, 'Roanna Alexander', 'lorem.fringilla@dolor.co.uk', '914-9137 Fringilla. Av.', 'NO'), + (293, 55, 'Richard Whitfield', 'bibendum.fermentum.metus@aliquet.ca', 'Ap #742-7093 Lorem Avenue', 'NO'), + (294, 78, 'Colorado West', 'et.magnis@dui.com', '944-3861 Non Street', 'NO'), + (295, 23, 'Ebony Clements', 'Cras.vulputate.velit@odiotristique.net', 'Ap #926-6076 Nibh Avenue', 'NO'), + (296, 25, 'Rosalyn Cote', 'penatibus.et@imperdiet.net', 'Ap #557-8597 Eleifend. Rd.', 'YES'), + (297, 86, 'Dara Zimmerman', 'non@molestiesodales.co.uk', 'Ap #268-848 Orci Street', 'YES'), + (298, 65, 'Brock Riddle', 'consectetuer.adipiscing@vestibulum.edu', 'P.O. Box 143, 1841 Vestibulum St.', 'YES'), + (299, 46, 'Abra Sweeney', 'vitae.nibh.Donec@metus.ca', '435-8343 Sem Rd.', 'NO'), + (300, 11, 'Wilma Travis', 'montes@Mauris.co.uk', 'P.O. Box 821, 8866 Dictum. Rd.', 'YES'), + (301, 58, 'Blake Page', 'dignissim.tempor@Nuncmaurissapien.ca', '2195 Magna. Rd.', 'NO'), + (303, 82, 'Gil Sutton', 'sed@nislMaecenasmalesuada.com', 'Ap #848-3663 Nibh Road', 'NO'), + (304, 81, 'Ursula Mitchell', 'varius.Nam@idmagnaet.edu', '8190 Cubilia Rd.', 'NO'), + (305, 52, 'Illiana Guy', 'adipiscing@dapibusgravidaAliquam.edu', '7935 Sem St.', 'NO'), + (306, 31, 'MacKenzie Holder', 'purus@egestasurna.ca', '5740 Massa. Av.', 'NO'), + (307, 36, 'Lisandra Evans', 'Suspendisse.aliquet.sem@egetmollis.co.uk', 'Ap #355-2371 Nunc Avenue', 'YES'), + (308, 58, 'Sylvester Hartman', 'In@ligulaNullam.net', '1396 Vivamus Road', 'YES'), + (309, 75, 'Nina Olsen', 'auctor@nuncInat.edu', 'Ap #700-5085 Fringilla Avenue', 'YES'), + (310, 3, 'Branden Doyle', 'lacus@aliquetdiam.org', '567-4712 In Rd.', 'NO'), + (311, 12, 'Cole Castillo', 'et.tristique@ipsum.net', 'Ap #946-8954 Cras Rd.', 'NO'), + (312, 55, 'Shaeleigh Caldwell', 'iaculis.nec@etarcu.org', '9755 Auctor Street', 'NO'), + (313, 49, 'Colt Woodward', 'ligula.Aenean@ultricies.com', 'Ap #414-7126 Praesent Street', 'YES'), + (314, 14, 'Gannon Sims', 'Duis.at@eratVivamus.edu', '477-7656 Maecenas Av.', 'NO'), + (315, 1, 'Cailin Bartlett', 'mauris.a.nunc@Infaucibus.net', 'Ap #766-2677 Faucibus. St.', 'NO'), + (316, 98, 'Kiara Kemp', 'Nam.ligula.elit@ut.co.uk', 'Ap #692-6623 Massa. Rd.', 'NO'), + (317, 39, 'Veda Pearson', 'Suspendisse@cursusvestibulumMauris.net', '170-5360 Lectus Rd.', 'NO'), + (318, 34, 'Quinn Gomez', 'eleifend.nec.malesuada@disparturientmontes.ca', 'P.O. Box 202, 1836 Non, St.', 'NO'), + (319, 9, 'Doris Malone', 'scelerisque@faucibusMorbivehicula.ca', '390-6380 Non, Av.', 'NO'), + (320, 40, 'Aimee Rodriguez', 'blandit.enim.consequat@ut.org', '5475 Ac Ave', 'NO'), + (321, 36, 'Abigail Mckee', 'arcu.Vestibulum.ante@Vestibulumanteipsum.co.uk', '942-2265 Ante Rd.', 'YES'), + (322, 83, 'Price Barton', 'congue@turpis.co.uk', '870-9293 Hendrerit St.', 'NO'), + (323, 50, 'Grace Villarreal', 'non.massa@lectus.ca', '892 Luctus St.', 'NO'), + (324, 58, 'Maxwell Boyd', 'eget.nisi@ideratEtiam.co.uk', 'Ap #813-8776 Odio Rd.', 'YES'), + (325, 97, 'Claire Medina', 'felis@nonummy.org', '8388 Sagittis. St.', 'YES'), + (326, 41, 'Portia Mullins', 'fames.ac.turpis@anteiaculis.net', 'Ap #705-349 Curabitur Avenue', 'YES'), + (327, 61, 'Anne Campos', 'rutrum.Fusce@Vivamus.com', 'P.O. Box 660, 4175 Enim. Road', 'NO'), + (328, 4, 'Kaitlin Harris', 'pede.Cras.vulputate@aptent.co.uk', 'Ap #445-4263 Lobortis, Rd.', 'NO'), + (329, 23, 'Sade Oconnor', 'ante@egetmetus.org', '623-5268 Nam Avenue', 'YES'), + (330, 39, 'Colby Fisher', 'velit@fringillacursus.ca', '623-4991 Sed Rd.', 'YES'), + (331, 28, 'Katell Schneider', 'est.mollis.non@hymenaeos.org', 'Ap #912-3072 Gravida. Av.', 'YES'), + (332, 17, 'Noble Glass', 'posuere.cubilia@Sedeget.net', '7024 Duis Rd.', 'NO'), + (333, 16, 'Ayanna Greene', 'purus.Nullam.scelerisque@In.edu', '790-4442 Dapibus Street', 'YES'), + (334, 81, 'Noah Everett', 'in.faucibus.orci@inlobortistellus.net', '5294 Mollis. Rd.', 'NO'), + (335, 1, 'Isabella Bird', 'in.tempus.eu@magnatellusfaucibus.org', '8467 Metus. St.', 'YES'), + (336, 86, 'Simon Leblanc', 'felis.ullamcorper@duiCraspellentesque.ca', 'Ap #251-6073 Torquent Rd.', 'NO'), + (337, 36, 'Claudia Ashley', 'Aliquam@Donec.co.uk', 'P.O. Box 110, 1572 Scelerisque Rd.', 'YES'), + (338, 93, 'Michael Bowers', 'est@dis.ca', '466-4654 Adipiscing Rd.', 'NO'), + (339, 82, 'Byron Walker', 'cursus.Nunc.mauris@Vivamus.net', '228-5563 Quisque Rd.', 'YES'), + (340, 26, 'Merritt Emerson', 'fringilla@magna.edu', '6942 Tellus. Ave', 'NO'), + (341, 47, 'Daryl Bradley', 'Aliquam@aliquetvelvulputate.ca', 'Ap #682-4061 At Avenue', 'NO'), + (342, 46, 'Fletcher Clark', 'neque.pellentesque.massa@nullaatsem.org', 'Ap #927-4240 Non, Street', 'NO'), + (343, 36, 'Carissa Dixon', 'risus.In.mi@nonlobortisquis.edu', 'P.O. Box 574, 8666 Curabitur Street', 'YES'), + (344, 40, 'Madeson Rivera', 'penatibus.et.magnis@luctus.edu', '3447 Amet, St.', 'NO'), + (345, 86, 'Rooney Horne', 'Nullam.feugiat.placerat@eumetus.org', '3644 Aliquam Road', 'NO'), + (346, 91, 'Scarlett Byers', 'dolor.Fusce@libero.com', 'Ap #138-1912 Tortor, Street', 'YES'), + (347, 26, 'Kirestin Rocha', 'eleifend.vitae.erat@neque.co.uk', '286-7344 Magna, Avenue', 'NO'), + (348, 58, 'Dexter Britt', 'Aliquam@nibh.co.uk', 'Ap #430-5061 Vel Street', 'YES'), + (349, 9, 'Mufutau Lester', 'Sed.et.libero@Nuncquisarcu.edu', 'P.O. Box 932, 499 Tempus Street', 'YES'), + (350, 54, 'Justina Kaufman', 'magna.sed.dui@Pellentesque.com', '430 Leo Street', 'YES'), + (351, 54, 'Scarlett Holland', 'at.pede.Cras@aliquetlobortisnisi.edu', '9240 Sed Rd.', 'YES'), + (352, 34, 'Porter Adkins', 'arcu.eu.odio@aodiosemper.ca', 'P.O. Box 975, 9040 Ac Road', 'YES'), + (353, 1, 'Fatima Fox', 'quis@bibendumsed.com', '885-6113 Eu St.', 'YES'), + (354, 22, 'Steel Ortiz', 'luctus.sit.amet@Nulla.edu', '7879 Facilisis St.', 'NO'), + (355, 49, 'Garth Whitfield', 'nunc@diamloremauctor.com', '4654 Metus. Rd.', 'NO'), + (356, 45, 'Claire Berry', 'eget.massa.Suspendisse@tortor.ca', '867-600 Duis Rd.', 'NO'), + (357, 62, 'Aimee Anthony', 'faucibus.lectus@nonummyipsum.net', 'P.O. Box 826, 1887 Elit St.', 'YES'), + (358, 79, 'Keegan Soto', 'nec@velitSedmalesuada.com', 'P.O. Box 227, 6769 Erat, St.', 'YES'), + (359, 23, 'Lacy Hansen', 'sed@Nullamsuscipitest.co.uk', '699-5004 Est Ave', 'YES'), + (360, 59, 'Amelia Oneill', 'pede@congueelitsed.co.uk', '1994 Ut St.', 'YES'), + (361, 43, 'Tucker Mathis', 'velit.in@velit.net', '8489 Nam Av.', 'NO'), + (362, 88, 'Aretha Roberson', 'Aenean.massa.Integer@Proinnon.net', '195-2373 Turpis. St.', 'YES'), + (363, 37, 'Blossom Spears', 'ut.dolor@Sedeu.edu', 'P.O. Box 606, 8608 Commodo Rd.', 'NO'), + (364, 93, 'Jana Dorsey', 'dui@Nullatempor.edu', 'Ap #210-3797 Eu Ave', 'NO'), + (365, 73, 'Shoshana Jacobs', 'vehicula.Pellentesque.tincidunt@pedesagittis.edu', '624-5048 Vel, Road', 'YES'), + (366, 77, 'Lawrence Lewis', 'ligula.eu@anteMaecenas.com', '877-356 Blandit Street', 'YES'), + (367, 74, 'Jerome Oneil', 'id.blandit.at@sem.net', '1028 Auctor Street', 'NO'), + (368, 13, 'Axel Young', 'massa.Quisque.porttitor@elementumpurusaccumsan.edu', 'P.O. Box 140, 8531 Dui Av.', 'NO'), + (369, 79, 'Rhonda Peterson', 'nec.urna.suscipit@intempuseu.edu', '2535 Ligula. Road', 'YES'), + (370, 19, 'Cairo Barry', 'interdum@felis.ca', '339-7993 Natoque St.', 'NO'), + (371, 40, 'Otto Terrell', 'ipsum.non@atfringillapurus.org', '918 Augue St.', 'YES'), + (372, 51, 'Ginger Booth', 'auctor.velit.eget@a.com', 'P.O. Box 717, 1821 Tincidunt St.', 'NO'), + (373, 21, 'Kenneth Hanson', 'Proin@Vivamussitamet.co.uk', 'P.O. Box 405, 1931 Class St.', 'NO'), + (374, 21, 'Lesley Burt', 'ridiculus.mus@vestibulumnequesed.net', '238-6188 Quisque Street', 'NO'), + (375, 72, 'Laurel Anthony', 'dolor.nonummy@lobortisquis.ca', '9279 Eu, Ave', 'NO'), + (376, 6, 'Adele Burke', 'sed.leo.Cras@ornare.co.uk', 'P.O. Box 280, 8885 Ipsum. Avenue', 'YES'), + (377, 49, 'Whitney King', 'non.bibendum.sed@Seddictum.co.uk', 'P.O. Box 251, 2818 Tempus Avenue', 'NO'), + (378, 48, 'Natalie Peck', 'convallis.est@cursusa.ca', '708-7354 Placerat. Rd.', 'YES'), + (379, 47, 'Levi Dawson', 'ante.ipsum@Crasdictumultricies.co.uk', 'P.O. Box 187, 3827 Ut Av.', 'NO'), + (380, 33, 'Oleg Sheppard', 'dolor@pellentesquea.co.uk', 'P.O. Box 801, 7191 Vitae Rd.', 'NO'), + (381, 34, 'Lionel Valentine', 'non@ullamcorperDuis.co.uk', 'Ap #533-2053 Risus. Street', 'NO'), + (382, 10, 'Kamal Delgado', 'vehicula@duiquisaccumsan.ca', 'Ap #244-7213 Ultricies Av.', 'NO'), + (383, 14, 'Lois Poole', 'odio.Nam.interdum@vitae.org', 'Ap #770-1702 Iaculis Ave', 'YES'), + (384, 26, 'Mercedes Neal', 'urna.suscipit@massa.ca', '627-976 Vel, Avenue', 'YES'), + (385, 22, 'Briar Hoover', 'vitae.sodales@molestietellusAenean.net', 'P.O. Box 919, 7904 Odio St.', 'NO'), + (386, 99, 'Vanna Harrell', 'auctor.velit@eros.com', 'Ap #895-4634 Nulla. Ave', 'YES'), + (387, 3, 'Lisandra Rivers', 'Aliquam.adipiscing@a.ca', '3044 Libero St.', 'NO'), + (388, 21, 'Cadman Roth', 'egestas@tortor.edu', 'Ap #654-4627 Vehicula Rd.', 'NO'), + (389, 21, 'Uriah Rivera', 'Nulla.interdum@pharetraQuisqueac.co.uk', 'Ap #336-767 Neque. Road', 'YES'), + (390, 41, 'Ruth Hall', 'ornare.lectus@idmagna.edu', 'Ap #163-6573 Sem Rd.', 'YES'), + (391, 54, 'Selma Gray', 'Ut.sagittis@eleifendnon.ca', 'Ap #869-6896 Feugiat Av.', 'YES'), + (392, 71, 'Cathleen Short', 'Duis@dolordapibusgravida.org', '8300 Pede. St.', 'YES'), + (393, 5, 'Roanna Alexander', 'lorem.fringilla@dolor.co.uk', '914-9137 Fringilla. Av.', 'NO'), + (394, 55, 'Richard Whitfield', 'bibendum.fermentum.metus@aliquet.ca', 'Ap #742-7093 Lorem Avenue', 'NO'), + (395, 78, 'Colorado West', 'et.magnis@dui.com', '944-3861 Non Street', 'NO'), + (396, 23, 'Ebony Clements', 'Cras.vulputate.velit@odiotristique.net', 'Ap #926-6076 Nibh Avenue', 'NO'), + (397, 25, 'Rosalyn Cote', 'penatibus.et@imperdiet.net', 'Ap #557-8597 Eleifend. Rd.', 'YES'), + (398, 86, 'Dara Zimmerman', 'non@molestiesodales.co.uk', 'Ap #268-848 Orci Street', 'YES'), + (399, 65, 'Brock Riddle', 'consectetuer.adipiscing@vestibulum.edu', 'P.O. Box 143, 1841 Vestibulum St.', 'YES'), + (400, 46, 'Abra Sweeney', 'vitae.nibh.Donec@metus.ca', '435-8343 Sem Rd.', 'NO'), + (401, 11, 'Wilma Travis', 'montes@Mauris.co.uk', 'P.O. Box 821, 8866 Dictum. Rd.', 'YES'), + (402, 58, 'Blake Page', 'dignissim.tempor@Nuncmaurissapien.ca', '2195 Magna. Rd.', 'NO'); diff --git a/examples/tests/_data/secondary.sql b/examples/tests/_data/secondary.sql new file mode 100644 index 0000000..d3f0eb1 --- /dev/null +++ b/examples/tests/_data/secondary.sql @@ -0,0 +1,125 @@ +-- schema + +-- +-- Table structure for table `Audit` +-- + +CREATE TABLE IF NOT EXISTS `DemoWarehouse`.`Audit` ( + `OrganisationID` int(10) unsigned NOT NULL, + `UserID` int(10) unsigned DEFAULT NULL, + `Time` datetime NOT NULL, + `JSON` text NOT NULL, + + KEY `UserID` (`UserID`), + KEY `OrganisationID` (`OrganisationID`), + KEY `Time` (`Time`) +); + +ALTER TABLE `Audit` + ADD FOREIGN KEY (`OrganisationID`) REFERENCES `DemoConfig`.`Organisation`(`ID`) + ON DELETE CASCADE ON UPDATE CASCADE; + +-- data + +-- `DemoWarehouse`.`Audit` +INSERT INTO `DemoWarehouse`.`Audit` VALUES + (1,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (2,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (3,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (4,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (5,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (6,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (7,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (8,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (9,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (10,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (11,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (12,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (13,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (14,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (15,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (16,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (17,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (18,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (19,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (20,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (21,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (22,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (23,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (24,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (25,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (26,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (27,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (28,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (29,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (30,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (31,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (32,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (33,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (34,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (35,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (36,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (37,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (38,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (39,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (40,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (41,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (42,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (43,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (44,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (45,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (46,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (47,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (48,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (49,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (50,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (51,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (52,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (53,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (54,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (55,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (56,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (57,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (58,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (59,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (60,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (61,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (62,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (63,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (64,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (65,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (66,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (67,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (68,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (69,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (70,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (71,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (72,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (73,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (74,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (75,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (76,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (77,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (78,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (79,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (80,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (81,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (82,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (83,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (84,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (85,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (86,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (87,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (88,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (89,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (90,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (91,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (92,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (93,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (94,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (95,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (96,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (97,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (98,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (99,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'), + (100,NULL,'2016-06-17 12:35:59','{\"Description\": \"Organisation created\", \"OrderNumber\": 15371}'); diff --git a/examples/tests/acceptance.suite.yml b/examples/tests/acceptance.suite.yml index ca4b576..161d703 100644 --- a/examples/tests/acceptance.suite.yml +++ b/examples/tests/acceptance.suite.yml @@ -13,13 +13,3 @@ modules: config: PhpBrowser: url: 'http://localhost/myapp/' - Codeception\Extension\MultiDb: - connectors: - Primary: - dsn: "mysql:host=server1.example.com;port=3306;dbname=PrimaryDb" - user: 'dbuser' - password: '' - Secondary: - dsn: "mysql:host=server2.example.com;port=3306;dbname=SecondaryDb" - user: 'dbuser' - password: '' diff --git a/examples/tests/acceptance/DemoCest.php b/examples/tests/acceptance/DemoCest.php index 5d497ea..3dc6c24 100644 --- a/examples/tests/acceptance/DemoCest.php +++ b/examples/tests/acceptance/DemoCest.php @@ -12,18 +12,26 @@ public function tryToTest(AcceptanceTester $I) $user_id = $I->transaction(function () use ($I) { $I->executeSql('SELECT NOW()'); - $user_id = $I->haveInDb('PrimaryDb.User', [ - 'UserName'=>'someone@example.com', + $user_id = $I->haveInDb('DemoConfig.User', [ + 'OrganisationID'=>1, 'Name'=>'Some One', - 'CreatedAt'=>'@asis NOW()' + 'Email'=>'someone@example.com', + 'Address'=>'PO Box 1213, London, United Kingdom', + 'Active'=>'YES', ]); - $I->haveInDb('PrimaryDb.UserPassword', [ + $I->haveInDb('DemoConfig.UserPassword', [ 'UserID'=>$user_id, - 'Password'=>'topsecret', - 'CreatedAt'=>'@asis NOW()' + 'Hash'=>'@asis UNHEX(SHA1("topsecret"))', + 'CreatedAt'=>'@asis NOW()', + 'ExpiresAt'=>'@asis DATE_ADD(CreatedAt, INTERVAL 10 DAY)' ]); return $user_id; }); + + $I->amConnectedToDb('Secondary'); + codecept_debug( + $I->getFromDb('DemoWarehouse.Audit', ['OrganisationID'=>1]) + ); } } diff --git a/src/Codeception/Extension/MultiDb.php b/src/Codeception/Extension/MultiDb.php index 12ec713..2b849ed 100644 --- a/src/Codeception/Extension/MultiDb.php +++ b/src/Codeception/Extension/MultiDb.php @@ -13,7 +13,7 @@ use Codeception\Exception\ModuleConfig as ModuleConfigException; use Codeception\Module; use Codeception\TestCase; -use Codeception\Configuration as Configuration; +use Codeception\Configuration; /** * MultiDb - Module that allows tests to perform setup queries and assertions across multiple databases. @@ -97,40 +97,55 @@ public function _initialize() } } + /** + * Load SQL dump for a connector + * + * @param string $connector + * + * @throws ModuleConfigException + * @throws ModuleException + */ protected function loadDump($connector) { $config = $this->config['connectors'][$connector]; - if ($config['dump'] && ($config['cleanup'] or ($config['populate']))) { + if ($config['dump'] && ($config['cleanup'] || $config['populate'])) { if (!file_exists(Configuration::projectDir() . $config['dump'])) { throw new ModuleConfigException( - __CLASS__, - "\nFile with dump doesn't exist. - Please, check path for sql file: " . $config['dump'] + __CLASS__, + "\n{$connector} - Dump file doesn't exist. Please check path: {$config['dump']}" ); } $sql = file_get_contents(Configuration::projectDir() . $config['dump']); - $sql = preg_replace('%/\*(?!!\d+)(?:(?!\*/).)*\*/%s', "", $sql); - if (!empty($sql)) { + // remove any comments of the form /* ... */ + $sql = preg_replace('%/\*(?!!\d+)(?:(?!\*/).)*\*/%s', '', $sql); + if ($sql) { $sql = explode("\n", $sql); } - } - if (!$sql) { - return; - } - try { - $this->getDriver($connector)->load($sql); - } catch (\PDOException $e) { - throw new ModuleException( - __CLASS__, - $e->getMessage() . "\nSQL query being executed: " . $sql - ); + + try { + $this->debugSection(__CLASS__, "{$connector} - Loading dump from {$config['dump']}"); + $this->getDriver($connector)->load($sql); + } catch (\PDOException $e) { + throw new ModuleException( + __CLASS__, + $e->getMessage() . "\nSQL query being executed: " . $sql + ); + } } } + /** + * Cleanup databases + * + * @param $connector + * + * @throws ModuleException + */ protected function cleanup($connector) { try { + $this->debugSection(__CLASS__, "$connector - Cleaning up"); $this->getDriver($connector)->cleanup(); } catch (\Exception $e) { throw new ModuleException(__CLASS__, $e->getMessage());