Refactor sth preparation/binding - no functional changes
[dbsrgits/DBIx-Class.git] / t / storage / disable_sth_caching.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use lib qw(t/lib);
6 use DBICTest;
7
8 ##!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9 ## This test uses undocumented internal methods
10 ## DO NOT USE THEM IN THE SAME MANNER
11 ## They are subject to ongoing change
12 ##!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13
14 # Set up the "usual" sqlite for DBICTest
15 my $schema = DBICTest->init_schema;
16 my $dbh = $schema->storage->_get_dbh;
17
18 my $sth_one = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
19 my $sth_two = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
20 $schema->storage->disable_sth_caching(1);
21 my $sth_three = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
22
23 ok($sth_one == $sth_two, "statement caching works");
24 ok($sth_two != $sth_three, "disabling statement caching works");
25
26 done_testing;