[Bioperl-l] Re: [Bioperl-guts-l] bioperl commit

Aaron J Mackey amackey at pcbi.upenn.edu
Wed Oct 29 07:15:48 EST 2003


Note that DSN's can also have "db=foo", "dbname=foo", "port=1234", etc.  
etc.  Additionally, one can pass DBI parameters (RaiseError, AutoCommit,
etc) via the DSN.  To make your day even worse, these parameters can
legitimately come in any order.

Why do you have to mangle the DSN?

On Wed, 29 Oct 2003, Chuah Aaron wrote:

> 
> baaron
> Wed Oct 29 05:30:44 EST 2003
> Update of /home/repository/bioperl/bioperl-live/scripts/Bio-DB-GFF
> In directory pub.open-bio.org:/tmp/cvs-serv17394
> 
> Modified Files:
> 	bulk_load_gff.PLS 
> Log Message:
> added support for dsn strings in the form of "dbi:mysql:database=xxx;host=xxx"
> 
> bioperl-live/scripts/Bio-DB-GFF bulk_load_gff.PLS,1.13,1.14
> ===================================================================
> RCS file: /home/repository/bioperl/bioperl-live/scripts/Bio-DB-GFF/bulk_load_gff.PLS,v
> retrieving revision 1.13
> retrieving revision 1.14
> diff -u -r1.13 -r1.14
> --- /home/repository/bioperl/bioperl-live/scripts/Bio-DB-GFF/bulk_load_gff.PLS	2003/10/28 06:32:40	1.13
> +++ /home/repository/bioperl/bioperl-live/scripts/Bio-DB-GFF/bulk_load_gff.PLS	2003/10/29 10:30:44	1.14
> @@ -155,14 +155,17 @@
>    $AUTH .= " -p$PASSWORD";
>  }
>  
> +$DSN=~s/database=//i;
> +$DSN=~s/;host=/:/i; #cater for dsn in the form of "dbi:mysql:database=$dbname;host=$host"
> +
>  my($DBI,$DBD,$DBNAME,$HOST)=split /:/,$DSN;
>  if (defined $HOST) {
>    $AUTH .= " -h$HOST";  
>  }
> +$DBNAME=$DSN unless $DSN=~/:/;
>  if (defined $DBNAME) {
>    $AUTH .= " -D$DBNAME";
>  }
> -
>  if (defined $LOCAL) {
>    $LOCAL='local';
>    $AUTH.=' --local-infile=1';
> @@ -170,6 +173,7 @@
>    $LOCAL='';
>  }
>  
> +
>  my $db = Bio::DB::GFF->new(-adaptor=>'faux',-dsn => $DSN, at auth)
>    or die "Can't open database: ",Bio::DB::GFF->error,"\n";
>  
> 
> _______________________________________________
> Bioperl-guts-l mailing list
> Bioperl-guts-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-guts-l
> 




More information about the Bioperl-l mailing list