allow SQL statements to be added to test cleanup
This commit is contained in:
parent
eb97a8d50e
commit
88e8fe77fb
2 changed files with 6 additions and 1 deletions
2
t/SQL.t
2
t/SQL.t
|
|
@ -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');
|
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('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');
|
$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 $dbh2 = WebGUI::SQL->connect($session,$session->config->get("dsn"), $session->config->get("dbuser"), $session->config->get("dbpass"));
|
||||||
my ($sth, $sth2, $rc);
|
my ($sth, $sth2, $rc);
|
||||||
|
|
|
||||||
|
|
@ -819,6 +819,10 @@ Example call:
|
||||||
my ($class, $ident) = @_;
|
my ($class, $ident) = @_;
|
||||||
return WebGUI::Storage->get($CLASS->session, $ident);
|
return WebGUI::Storage->get($CLASS->session, $ident);
|
||||||
},
|
},
|
||||||
|
'SQL' => sub {
|
||||||
|
my (undef, $sql) = @_;
|
||||||
|
return $CLASS->session->db->dbh->prepare($sql);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
my %clone = (
|
my %clone = (
|
||||||
|
|
@ -898,6 +902,7 @@ Example call:
|
||||||
'CODE' => sub {
|
'CODE' => sub {
|
||||||
(shift)->();
|
(shift)->();
|
||||||
},
|
},
|
||||||
|
'SQL' => 'execute',
|
||||||
);
|
);
|
||||||
|
|
||||||
sub cleanupGuard {
|
sub cleanupGuard {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue