Re: disabling foreign key constraints

Mayuran Yogarajah <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
Dave Howorth wrote:

> I have two records with interlinked fields and foreign key 
> constraints. To insert the records, I need to turn off the constraint.
>
> In the mysql command-line client I would do this by typing:
> SET FOREIGN_KEY_CHECKS = 0;
> and
> SET FOREIGN_KEY_CHECKS = 1;
> once the fields were consistent again.
>
> How do I do this from Perl?
>
> Thanks, Dave


$dbh->do('SET FOREIGN_KEY_CHECKS=0');
# do inserts
$dbh->do('SET FOREIGN_KEY_CHECKS=1');

Hope this helps,
Mayuran.


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.