disabling foreign key constraints

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
--
Dave Howorth
MRC Centre for Protein Engineering
Hills Road, Cambridge, CB2 2QH
01223 252960


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules [at] m .gmane.org
Dave Howorth [ Do, 12 August 2004 15:13 ] [ ID #44220 ]

Re: disabling foreign key constraints

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/perl?unsub=gcdmp-msql-mysql-modules [at] m .gmane.org
Mayuran [ Do, 12 August 2004 17:02 ] [ ID #44222 ]

Re: disabling foreign key constraints

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/perl?unsub=gcdmp-msql-mysql-modules [at] m .gmane.org
Mayuran [ Do, 12 August 2004 17:02 ] [ ID #180772 ]
Datenbanken » gmane.comp.db.mysql.perl » disabling foreign key constraints

Vorheriges Thema: script not able to connect
Nächstes Thema: disabling foreign key constraints