8 use DBIC::SqlMakerTest;
9 use DBI::Const::GetInfoType;
11 { # Fake storage driver for SQLite + no bind variables
12 package DBICTest::SQLite::NoBindVars;
15 DBIx::Class::Storage::DBI::NoBindVars
16 DBIx::Class::Storage::DBI::SQLite
20 my $schema = DBICTest->init_schema (storage_type => 'DBICTest::SQLite::NoBindVars', no_populate => 1);
22 # test primary key handling
23 my $new = $schema->resultset('Artist')->create({ name => 'foo' });
24 ok($new->artistid, "Auto-PK worked");
28 $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
30 my $it = $schema->resultset('Artist')->search( {},
33 order_by => 'artistid' }
36 is( $it->count, 3, "LIMIT count ok" ); # ask for 3 rows out of 7 artists
39 my $orig_debugobj = $schema->storage->debugobj;
40 my $orig_debug = $schema->storage->debug;
41 $schema->storage->debugobj (DBIC::DebugObj->new (\$sql, \@bind) );
42 $schema->storage->debug (1);
44 is( $it->next->name, "Artist 2", "iterator->next ok" );
47 is( $it->next, undef, "next past end of resultset ok" );
49 $schema->storage->debugobj ($orig_debugobj);
50 $schema->storage->debug ($orig_debug);
55 'SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me ORDER BY artistid LIMIT 3 OFFSET 2',
57 'Correctly interpolated SQL'