File: disable_sth_caching.t

package info (click to toggle)
libdbix-class-perl 0.082844-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (26 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

##!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
## This test uses undocumented internal methods
## DO NOT USE THEM IN THE SAME MANNER
## They are subject to ongoing change
##!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

# Set up the "usual" sqlite for DBICTest
my $schema = DBICTest->init_schema;
my $dbh = $schema->storage->_get_dbh;

my $sth_one = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
my $sth_two = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
$schema->storage->disable_sth_caching(1);
my $sth_three = $schema->storage->_prepare_sth($dbh, 'SELECT 42');

ok($sth_one == $sth_two, "statement caching works");
ok($sth_two != $sth_three, "disabling statement caching works");

done_testing;