1 package DBIx::Class::Storage::DBI::mysql;
7 DBIx::Class::Storage::DBI::MultiColumnIn
8 DBIx::Class::Storage::DBI::AmbiguousGlob
9 DBIx::Class::Storage::DBI
12 __PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks::MySQL');
14 sub with_deferred_fk_checks {
15 my ($self, $sub) = @_;
17 $self->dbh->do('SET foreign_key_checks=0');
19 $self->dbh->do('SET foreign_key_checks=1');
22 sub connect_call_set_ansi_mode {
24 $self->dbh->do(q|SET sql_mode = 'ANSI,TRADITIONAL'|);
25 $self->dbh->do(q|SET sql_mode = 'ANSI,TRADITIONAL'|);
28 sub _dbh_last_insert_id {
29 my ($self, $dbh, $source, $col) = @_;
30 $dbh->{mysql_insertid};
38 my ($self, $name) = @_;
40 $self->dbh->do("SAVEPOINT $name");
44 my ($self, $name) = @_;
46 $self->dbh->do("RELEASE SAVEPOINT $name");
50 my ($self, $name) = @_;
52 $self->dbh->do("ROLLBACK TO SAVEPOINT $name")
56 my $status = shift->dbh->selectrow_hashref('show slave status');
57 return ($status->{Slave_IO_Running} eq 'Yes') && ($status->{Slave_SQL_Running} eq 'Yes');
60 sub lag_behind_master {
61 return shift->dbh->selectrow_hashref('show slave status')->{Seconds_Behind_Master};
64 # MySql can not do subquery update/deletes, only way is slow per-row operations.
65 # This assumes you have set proper transaction isolation and use innodb.
66 sub _subq_update_delete {
67 return shift->_per_row_update_delete (@_);
74 DBIx::Class::Storage::DBI::mysql - Automatic primary key class for MySQL
78 # In your table classes
79 __PACKAGE__->load_components(qw/PK::Auto Core/);
80 __PACKAGE__->set_primary_key('id');
84 This class implements autoincrements for MySQL.
88 Matt S. Trout <mst@shadowcatsystems.co.uk>
92 You may distribute this code under the same terms as Perl itself.