allow SQL statements to be added to test cleanup

This commit is contained in:
Graham Knop 2010-04-12 17:55:42 -05:00
parent eb97a8d50e
commit 88e8fe77fb
2 changed files with 6 additions and 1 deletions

View file

@ -174,7 +174,7 @@ SKIP: {
skip("No InnoDB tables in this MySQL. Skipping all transaction related tests.",7) if (lc $mysqlVariables{have_innodb} ne 'yes');
$session->db->dbh->do('DROP TABLE IF EXISTS testTable');
$session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message CHAR(64), PRIMARY KEY(myIndex)) TYPE=InnoDB');
addToCleanup( sub { $session->db->dbh->do('DROP TABLE testTable') });
addToCleanup( SQL => 'DROP TABLE testTable' );
my $dbh2 = WebGUI::SQL->connect($session,$session->config->get("dsn"), $session->config->get("dbuser"), $session->config->get("dbpass"));
my ($sth, $sth2, $rc);

View file

@ -819,6 +819,10 @@ Example call:
my ($class, $ident) = @_;
return WebGUI::Storage->get($CLASS->session, $ident);
},
'SQL' => sub {
my (undef, $sql) = @_;
return $CLASS->session->db->dbh->prepare($sql);
},
);
my %clone = (
@ -898,6 +902,7 @@ Example call:
'CODE' => sub {
(shift)->();
},
'SQL' => 'execute',
);
sub cleanupGuard {