1 package DBIx::Class::Storage::DBI::mysql;
7 DBIx::Class::Storage::DBI::MultiColumnIn
8 DBIx::Class::Storage::DBI::AmbiguousGlob
9 DBIx::Class::Storage::DBI
13 __PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks::MySQL');
15 sub with_deferred_fk_checks {
16 my ($self, $sub) = @_;
18 $self->_do_query('SET FOREIGN_KEY_CHECKS = 0');
20 $self->_do_query('SET FOREIGN_KEY_CHECKS = 1');
23 sub connect_call_set_ansi_mode {
25 $self->_do_query(q|SET SQL_MODE = 'ANSI,TRADITIONAL'|);
26 $self->_do_query(q|SET SQL_AUTO_IS_NULL = 0|);
29 sub _dbh_last_insert_id {
30 my ($self, $dbh, $source, $col) = @_;
31 $dbh->{mysql_insertid};
39 my ($self, $name) = @_;
41 $self->dbh->do("SAVEPOINT $name");
45 my ($self, $name) = @_;
47 $self->dbh->do("RELEASE SAVEPOINT $name");
51 my ($self, $name) = @_;
53 $self->dbh->do("ROLLBACK TO SAVEPOINT $name")
57 my $status = shift->dbh->selectrow_hashref('show slave status');
58 return ($status->{Slave_IO_Running} eq 'Yes') && ($status->{Slave_SQL_Running} eq 'Yes');
61 sub lag_behind_master {
62 return shift->dbh->selectrow_hashref('show slave status')->{Seconds_Behind_Master};
65 # MySql can not do subquery update/deletes, only way is slow per-row operations.
66 # This assumes you have set proper transaction isolation and use innodb.
67 sub _subq_update_delete {
68 return shift->_per_row_update_delete (@_);
75 DBIx::Class::Storage::DBI::mysql - Automatic primary key class for MySQL
79 # In your table classes
80 __PACKAGE__->load_components(qw/PK::Auto Core/);
81 __PACKAGE__->set_primary_key('id');
85 This class implements autoincrements for MySQL.
89 Matt S. Trout <mst@shadowcatsystems.co.uk>
93 You may distribute this code under the same terms as Perl itself.