Refactor sth preparation/binding - no functional changes
[dbsrgits/DBIx-Class.git] / t / storage / disable_sth_caching.t
CommitLineData
b33697ef 1use strict;
f54428ab 2use warnings;
b33697ef 3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7
9930caaf 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##!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
b33697ef 13
14# Set up the "usual" sqlite for DBICTest
15my $schema = DBICTest->init_schema;
9930caaf 16my $dbh = $schema->storage->_get_dbh;
b33697ef 17
9930caaf 18my $sth_one = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
19my $sth_two = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
b33697ef 20$schema->storage->disable_sth_caching(1);
9930caaf 21my $sth_three = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
b33697ef 22
23ok($sth_one == $sth_two, "statement caching works");
24ok($sth_two != $sth_three, "disabling statement caching works");
9930caaf 25
26done_testing;