You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(267) |
Nov
(344) |
Dec
(119) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(23) |
Feb
(15) |
Mar
(16) |
Apr
(388) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
|
From: <jas...@us...> - 2002-11-23 10:38:04
|
Update of /cvsroot/genex/genex-server/Genex/ExternalDatabase
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/ExternalDatabase
Modified Files:
ExternalDatabase.pm
Log Message:
new
Index: ExternalDatabase.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/ExternalDatabase/ExternalDatabase.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** ExternalDatabase.pm 15 Nov 2002 21:55:12 -0000 1.31
--- ExternalDatabase.pm 23 Nov 2002 10:18:15 -0000 1.32
***************
*** 22,26 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 22,26 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 960,963 ****
--- 960,1082 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::ExternalDatabase> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::ExternalDatabase->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::ExternalDatabase->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'ed_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::ExternalDatabase objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::ExternalDatabase objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:38:03
|
Update of /cvsroot/genex/genex-server/Genex/FeatureExtractionSoftware
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/FeatureExtractionSoftware
Modified Files:
FeatureExtractionSoftware.pm
Log Message:
new
Index: FeatureExtractionSoftware.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/FeatureExtractionSoftware/FeatureExtractionSoftware.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FeatureExtractionSoftware.pm 15 Nov 2002 21:55:13 -0000 1.5
--- FeatureExtractionSoftware.pm 23 Nov 2002 10:18:15 -0000 1.6
***************
*** 21,25 ****
use Bio::Genex::Software;
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 21,25 ----
use Bio::Genex::Software;
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 41,45 ****
$COLUMN_NAMES = [
- 'fesw_pk',
'feature_identifier_string',
'data_start_regex1',
--- 41,44 ----
***************
*** 67,71 ****
'feature_identifier_string' => 'Feature Identifier String',
'data_start_regex1' => 'Data Start Regular Expression 1',
- 'fesw_pk' => 'Accession Number',
'qd_fk' => 'Quantitation Type Dimension'
}
--- 66,69 ----
***************
*** 73,77 ****
$NAME2COLUMN = {
'Data End Regular Expression' => 'data_end_regex',
- 'Accession Number' => 'fesw_pk',
'Data Start Regular Expression 1' => 'data_start_regex1',
'Feature Identifier String' => 'feature_identifier_string',
--- 71,74 ----
***************
*** 91,95 ****
$TABLE_NAME_VIEW = q[FeatureExtractionSoftware_view];
$TABLE_TYPE = q[DATA];
! $PKEY_NAME = q[fesw_pk];
}
--- 88,92 ----
$TABLE_NAME_VIEW = q[FeatureExtractionSoftware_view];
$TABLE_TYPE = q[DATA];
! $PKEY_NAME = q[sw_pk];
}
***************
*** 128,132 ****
# or specifically
! my $fesw_pk_val = $FeatureExtractionSoftware->fesw_pk();
# retreving other DB column attributes
--- 125,129 ----
# or specifically
! my $sw_pk_val = $FeatureExtractionSoftware->sw_pk();
# retreving other DB column attributes
***************
*** 247,251 ****
my $dbh = Bio::Genex::Connect->new(%connect_args);
my $FeatureExtractionSoftware = Bio::Genex::FeatureExtractionSoftware->new(dbh=>$dbh,id=>47);
! my $val = $FeatureExtractionSoftware->fesw_pk();
The attribute's value is then cached in the object so any further calls
--- 244,248 ----
my $dbh = Bio::Genex::Connect->new(%connect_args);
my $FeatureExtractionSoftware = Bio::Genex::FeatureExtractionSoftware->new(dbh=>$dbh,id=>47);
! my $val = $FeatureExtractionSoftware->feature_identifier_string();
The attribute's value is then cached in the object so any further calls
***************
*** 287,291 ****
C<new()>, for example:
! my $obj = Bio::Genex::FeatureExtractionSoftware->new(dbh=>$dbh,fesw_pk=>'val1');
=back
--- 284,288 ----
C<new()>, for example:
! my $obj = Bio::Genex::FeatureExtractionSoftware->new(dbh=>$dbh,feature_identifier_string=>'val1');
=back
***************
*** 296,300 ****
# to initialize all the class attributes
# we get the no_lookup attributes from our superclass
! attributes (lookup=>['fesw_pk', 'feature_identifier_string', 'data_start_regex1', 'data_start_regex2', 'data_end_regex', 'qd_fk', 'qd_obj']);
--- 293,297 ----
# to initialize all the class attributes
# we get the no_lookup attributes from our superclass
! attributes (lookup=>['feature_identifier_string', 'data_start_regex1', 'data_start_regex2', 'data_end_regex', 'qd_fk', 'qd_obj']);
***************
*** 424,428 ****
This method returns the name of the column which is used as the
primary key for this DB table. This method only exists for data
! table classes, and for Bio::Genex::FeatureExtractionSoftware it returns the value 'fesw_pk';
=cut
--- 421,425 ----
This method returns the name of the column which is used as the
primary key for this DB table. This method only exists for data
! table classes, and for Bio::Genex::FeatureExtractionSoftware it returns the value 'sw_pk';
=cut
***************
*** 458,462 ****
PASSWORD=>$SU_PASSWORD);
my FeatureExtractionSoftware = Bio::Genex::FeatureExtractionSoftware->new();
! FeatureExtractionSoftware->feature_identifier_string('some_value');
FeatureExtractionSoftware->insert_db($dbh);
--- 455,459 ----
PASSWORD=>$SU_PASSWORD);
my FeatureExtractionSoftware = Bio::Genex::FeatureExtractionSoftware->new();
! FeatureExtractionSoftware->data_start_regex1('some_value');
FeatureExtractionSoftware->insert_db($dbh);
***************
*** 516,520 ****
if ($DEBUG) {
printf STDERR "%sIn Bio::Genex::FeatureExtractionSoftware::insert_db: pkey = %s\n",
! ' ' x $::indent, $self->get_attribute('fesw_pk');
$::indent +=2;
}
--- 513,517 ----
if ($DEBUG) {
printf STDERR "%sIn Bio::Genex::FeatureExtractionSoftware::insert_db: pkey = %s\n",
! ' ' x $::indent, $self->get_attribute('sw_pk');
$::indent +=2;
}
***************
*** 603,607 ****
);
$pkey = $pkey->[0][0];
! $values{fesw_pk} = $pkey;
$self->id($pkey);
--- 600,604 ----
);
$pkey = $pkey->[0][0];
! $values{sw_pk} = $pkey;
$self->id($pkey);
***************
*** 655,659 ****
PASSWORD=>$SU_PASSWORD);
my FeatureExtractionSoftware = Bio::Genex::FeatureExtractionSoftware->new(dbh=>$dbh,id=>43);
! FeatureExtractionSoftware->feature_identifier_string('some_value');
FeatureExtractionSoftware->update_db();
--- 652,656 ----
PASSWORD=>$SU_PASSWORD);
my FeatureExtractionSoftware = Bio::Genex::FeatureExtractionSoftware->new(dbh=>$dbh,id=>43);
! FeatureExtractionSoftware->data_start_regex1('some_value');
FeatureExtractionSoftware->update_db();
***************
*** 662,666 ****
B<NOTE:> Any modification of the primary key value will be discarded
! ('fesw_pk' for module Bio::Genex::FeatureExtractionSoftware).
=cut
--- 659,663 ----
B<NOTE:> Any modification of the primary key value will be discarded
! ('feature_identifier_string' for module Bio::Genex::FeatureExtractionSoftware).
=cut
***************
*** 671,675 ****
assert_dbh($dbh);
die "Bio::Genex::FeatureExtractionSoftware::update_db: object not in DB"
! unless defined $self->id() && defined $self->fesw_pk();
# before we can update the values for the object
--- 668,672 ----
assert_dbh($dbh);
die "Bio::Genex::FeatureExtractionSoftware::update_db: object not in DB"
! unless defined $self->id() && defined $self->sw_pk();
# before we can update the values for the object
***************
*** 713,717 ****
# execute the UPDATE
! my $WHERE = 'fesw_pk=' . $dbh->quote($self->fesw_pk());
my $table_name = Bio::Genex::FeatureExtractionSoftware->table_or_viewname($dbh);
my $sql = $dbh->create_update_sql(
--- 710,714 ----
# execute the UPDATE
! my $WHERE = 'sw_pk=' . $dbh->quote($self->sw_pk());
my $table_name = Bio::Genex::FeatureExtractionSoftware->table_or_viewname($dbh);
my $sql = $dbh->create_update_sql(
***************
*** 937,940 ****
--- 934,1056 ----
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::FeatureExtractionSoftware> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::FeatureExtractionSoftware->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::FeatureExtractionSoftware->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'sw_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::FeatureExtractionSoftware objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::FeatureExtractionSoftware objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
+
# ObjectTemplate automagically creates a new() method for us
# that method invokes $self->initialize() after first setting all
***************
*** 1121,1129 ****
classes. This method returns the value of the primary key attribute of
the given instance (and for class Bio::Genex::FeatureExtractionSoftware it is synonomous
! with the C<fesw_pk()>method). The C<id()> method can be useful
in writing generic methods because it avoids having to know the name
of the primary key column.
! =item fesw_pk()
This is the primary key attribute for Bio::Genex::FeatureExtractionSoftware. It has no setter method.
--- 1237,1245 ----
classes. This method returns the value of the primary key attribute of
the given instance (and for class Bio::Genex::FeatureExtractionSoftware it is synonomous
! with the C<feature_identifier_string()>method). The C<id()> method can be useful
in writing generic methods because it avoids having to know the name
of the primary key column.
! =item feature_identifier_string()
This is the primary key attribute for Bio::Genex::FeatureExtractionSoftware. It has no setter method.
|
|
From: <jas...@us...> - 2002-11-23 10:38:03
|
Update of /cvsroot/genex/genex-server/Genex/Feature
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/Feature
Modified Files:
Feature.pm
Log Message:
new
Index: Feature.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/Feature/Feature.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Feature.pm 15 Nov 2002 21:55:12 -0000 1.13
--- Feature.pm 23 Nov 2002 10:18:15 -0000 1.14
***************
*** 22,26 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 22,26 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 1024,1028 ****
=item insert_matrix($class,%args)
! This method inserts the data for the object into the database
specified by the DB handle $dbh. To use this method, create a blank
container object with C<new()> (for class C<Bio::Genex::Feature> the
--- 1024,1028 ----
=item insert_matrix($class,%args)
! This method inserts a matrix of data into the database
specified by the DB handle $dbh. To use this method, create a blank
container object with C<new()> (for class C<Bio::Genex::Feature> the
***************
*** 1039,1042 ****
--- 1039,1043 ----
$arraydesign->insert_db($dbh);
+
Supported %args
***************
*** 1047,1062 ****
an active database handle
- =item * fkey
-
- the container objects primary key that will be entered in the foreign
- key slot for each matrix row
-
=item * matrix
an array ref holding the matrix
! =item * name
- the person responisible for the insertion
=back
--- 1048,1060 ----
an active database handle
=item * matrix
an array ref holding the matrix
! =item * fkey
!
! the container objects primary key that will be entered in the foreign
! key slot for each matrix row
=back
***************
*** 1069,1072 ****
--- 1067,1071 ----
container object.
+
=cut
***************
*** 1080,1088 ****
my ($pack,$file,$line,$sub) = caller(0);
push(@error_args, caller=>"$pack:$file:$line:$sub");
my $lt_pkey = $args{fkey};
- my $matrix = $args{matrix};
# first we ensure that the container instance is really in the DB
! my $sql = $dbh->create_select_sql( COLUMNS=>['ad_pk'],
FROM=>[Bio::Genex::ArrayDesign->table_or_viewname($dbh)],
WHERE=>qq[ad_pk='$lt_pkey'],
--- 1079,1094 ----
my ($pack,$file,$line,$sub) = caller(0);
push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
my $lt_pkey = $args{fkey};
# first we ensure that the container instance is really in the DB
! $sql = $dbh->create_select_sql( COLUMNS=>['ad_pk'],
FROM=>[Bio::Genex::ArrayDesign->table_or_viewname($dbh)],
WHERE=>qq[ad_pk='$lt_pkey'],
***************
*** 1094,1101 ****
if not defined $ref or not scalar @{$ref};
# ok to proceed with insert
! my $header = shift @{$matrix};
push(@{$header},'ad_fk','feature_pk');
# pre-fetch the next value of the sequence
my $seq = 'GENEX_ID_SEQ';
--- 1100,1109 ----
if not defined $ref or not scalar @{$ref};
+
# ok to proceed with insert
! # add lookup table fkey and primary key to each row
push(@{$header},'ad_fk','feature_pk');
+
# pre-fetch the next value of the sequence
my $seq = 'GENEX_ID_SEQ';
***************
*** 1114,1118 ****
--- 1122,1129 ----
message=>"Couldn't prepare insert sql",
sql=>$sql);
+
+ my $count;
foreach my $row (@{$matrix}) {
+ $count++;
$seq_sth->execute()
or $dbh->error(@error_args,
***************
*** 1129,1138 ****
# DBI won't re-run the SQL until we finish
$seq_sth->finish();
$sth->execute(@{$row},$lt_pkey,$pkey->[0])
or $dbh->error(@error_args,
message=>"Couldn't execute insert sql with args: "
! . join(',',@{$row},$pkey->[0]),
sth=>$sth,
sql=>$sql);
}
my $ga_db = Bio::Genex::GenexAdmin->new();
--- 1140,1155 ----
# DBI won't re-run the SQL until we finish
$seq_sth->finish();
+
$sth->execute(@{$row},$lt_pkey,$pkey->[0])
or $dbh->error(@error_args,
message=>"Couldn't execute insert sql with args: "
! . join(',',@{$row},$lt_pkey,$pkey->[0]),
sth=>$sth,
sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::Feature objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
}
my $ga_db = Bio::Genex::GenexAdmin->new();
|
|
From: <jas...@us...> - 2002-11-23 10:38:03
|
Update of /cvsroot/genex/genex-server/Genex/GenexAdmin
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/GenexAdmin
Modified Files:
GenexAdmin.pm
Log Message:
new
Index: GenexAdmin.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/GenexAdmin/GenexAdmin.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** GenexAdmin.pm 15 Nov 2002 21:55:13 -0000 1.18
--- GenexAdmin.pm 23 Nov 2002 10:18:16 -0000 1.19
***************
*** 21,25 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 21,25 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 914,917 ****
--- 914,1036 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::GenexAdmin> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::GenexAdmin->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::GenexAdmin->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'ga_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::GenexAdmin objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::GenexAdmin objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:38:02
|
Update of /cvsroot/genex/genex-server/Genex/GroupLink
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/GroupLink
Modified Files:
GroupLink.pm
Log Message:
new
Index: GroupLink.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/GroupLink/GroupLink.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** GroupLink.pm 15 Nov 2002 21:55:13 -0000 1.30
--- GroupLink.pm 23 Nov 2002 10:18:16 -0000 1.31
***************
*** 22,26 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 22,26 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 746,749 ****
--- 746,868 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::GroupLink> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::GroupLink->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::GroupLink->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::GroupLink objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::GroupLink objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:25:45
|
Update of /cvsroot/genex/genex-server In directory sc8-pr-cvs1:/tmp/cvs-serv7826 Modified Files: ChangeLog Log Message: usual Index: ChangeLog =================================================================== RCS file: /cvsroot/genex/genex-server/ChangeLog,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** ChangeLog 23 Nov 2002 08:01:17 -0000 1.113 --- ChangeLog 23 Nov 2002 10:25:42 -0000 1.114 *************** *** 1,2 **** --- 1,14 ---- + 2002-11-23 Jason E. Stewart <ja...@op...> + + * DB/xml/functions-sql.xml.in (Repository): + MAJOR SPEEDUP: removed refence to TableAdmin + + * DB/xml/MeasuredBioAssay.xml (Repository): + now references sw_pk + + * DB/xml/FeatureExtractionSoftware.xml (Repository): + removed redundant column fesw_pk + made sw_pk the primary key + 2002-11-22 Jason E. Stewart <ja...@op...> |
|
From: <jas...@us...> - 2002-11-23 10:25:34
|
Update of /cvsroot/genex/genex-server/Genex In directory sc8-pr-cvs1:/tmp/cvs-serv7772/Genex Modified Files: ChangeLog Log Message: usual Index: ChangeLog =================================================================== RCS file: /cvsroot/genex/genex-server/Genex/ChangeLog,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** ChangeLog 23 Nov 2002 08:01:05 -0000 1.123 --- ChangeLog 23 Nov 2002 10:25:31 -0000 1.124 *************** *** 1,6 **** --- 1,10 ---- 2002-11-23 Jason E. Stewart <ja...@op...> + * scripts/create_genex_db.pl.in (Repository): + removed TableAdmin + * Genex.pm.in (Repository): new version (2.7.20021122) + new version (2.7.20021123) 2002-11-22 Jason E. Stewart <ja...@op...> |
|
From: <jas...@us...> - 2002-11-23 10:25:16
|
Update of /cvsroot/genex/genex-server/Genex/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv7722/Genex/scripts Modified Files: mbad-insert.pl.in Log Message: now references sw_pk Index: mbad-insert.pl.in =================================================================== RCS file: /cvsroot/genex/genex-server/Genex/scripts/mbad-insert.pl.in,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mbad-insert.pl.in 23 Nov 2002 01:21:53 -0000 1.7 --- mbad-insert.pl.in 23 Nov 2002 10:25:13 -0000 1.8 *************** *** 242,246 **** ro_groupname_obj=>$ro_group, rw_groupname_obj=>$rw_group, ! fesw_obj=>$fe_sw_db, es_obj=>$es_db, ); --- 242,246 ---- ro_groupname_obj=>$ro_group, rw_groupname_obj=>$rw_group, ! sw_obj=>$fe_sw_db, es_obj=>$es_db, ); |
|
From: <jas...@us...> - 2002-11-23 10:24:57
|
Update of /cvsroot/genex/genex-server/Genex/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv7606/Genex/scripts
Modified Files:
make_classes.pl
Log Message:
removed TableAdmin
Index: make_classes.pl
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/scripts/make_classes.pl,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** make_classes.pl 15 Oct 2002 14:44:17 -0000 1.27
--- make_classes.pl 23 Nov 2002 10:24:55 -0000 1.28
***************
*** 102,106 ****
{target=>'Identifiable'},
{target=>'Feature'},
- {target=>'TableAdmin'},
{target=>'ContactType'},
{target=>'AM_Spots'},
--- 102,105 ----
|
|
From: <jas...@us...> - 2002-11-23 10:24:16
|
Update of /cvsroot/genex/genex-server/Genex/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv7501/Genex/scripts
Modified Files:
create_genex_db.pl.in
Log Message:
* scripts/create_genex_db.pl.in (Repository):
removed TableAdmin
Index: create_genex_db.pl.in
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/scripts/create_genex_db.pl.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** create_genex_db.pl.in 23 Nov 2002 05:10:56 -0000 1.8
--- create_genex_db.pl.in 23 Nov 2002 10:24:13 -0000 1.9
***************
*** 15,19 ****
use Bio::Genex::Connect;
use Bio::Genex::XMLUtils qw(xml2sql);
- use Bio::Genex::TableAdmin;
use Bio::Genex::GenexAdmin;
use vars qw(%OPTIONS);
--- 15,18 ----
***************
*** 140,147 ****
PERMS=>[qw(INSERT SELECT UPDATE DELETE)],
);
- $sql .= $dbh->create_grant_sql(TABLE=>'TableAdmin',
- USERS=>['PUBLIC'],
- PERMS=>[qw(SELECT UPDATE)],
- );
$dbh->do($sql);
$dbh->error(@error_args,
--- 139,142 ----
***************
*** 259,273 ****
if $dbh->err;
- print STDERR "\n\n\tCreating TableAdmin DB Triggers ...\n\n";
- my $table = 'tableadmin';
-
- # check to see if the trigger exists already, if so, drop it
- my $sql = create_trigger($table,'audit',INSERT);
- $dbh->do($sql);
- $dbh->error(@error_args,
- sql=>$sql,
- message=>"creating triggers for table $table")
- if $dbh->err;
-
print STDERR "\n\n\tCreating Modification_Time DB Triggers ...\n\n";
foreach my $table ('Sessions') {
--- 254,257 ----
***************
*** 280,296 ****
message=>"creating modification_time triggers for table $table")
if $dbh->err;
- }
-
- # we need to do this after the triggers are added so that TableAdmin
- # gets the Audit trigger
- unless (exists $OPTIONS{no_tables}) {
- print STDERR "\n\nAdding tables to TableAdmin ...\n\n";
- foreach my $table (@{$all_tables}) {
- my $ta = Bio::Genex::TableAdmin->new(table_name=>lc($table));
- $dbh->error(@error_args,message=>'Creating TableAdmin object')
- unless defined $ta;
- $ta->insert_db($dbh) ||
- $dbh->error(@error_args, message=>'Inserting $table in TableAdmin');
- }
}
--- 264,267 ----
|
|
From: <jas...@us...> - 2002-11-23 10:23:39
|
Update of /cvsroot/genex/genex-server/Genex/t
In directory sc8-pr-cvs1:/tmp/cvs-serv7307/Genex/t
Modified Files:
FeatureExtractionSoftware.t MeasuredBioAssay.t
Log Message:
renamed pkey
Index: FeatureExtractionSoftware.t
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/t/FeatureExtractionSoftware.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FeatureExtractionSoftware.t 7 Nov 2002 14:49:32 -0000 1.2
--- FeatureExtractionSoftware.t 23 Nov 2002 10:23:36 -0000 1.3
***************
*** 7,11 ****
# (It may become useful if the test is moved to ./t subdirectory.)
! BEGIN { $| = 1; print "1..26\n"; }
END {print "not ok 1\n" unless $loaded;}
use Carp;
--- 7,11 ----
# (It may become useful if the test is moved to ./t subdirectory.)
! BEGIN { $| = 1; print "1..25\n"; }
END {print "not ok 1\n" unless $loaded;}
use Carp;
***************
*** 32,39 ****
my $obj = Bio::Genex::FeatureExtractionSoftware->new();
- # testing the fesw_pk attribute method
- $obj->fesw_pk(555);
- result ($obj->fesw_pk() == 555);
-
# testing the feature_identifier_string attribute method
$obj->feature_identifier_string(555);
--- 32,35 ----
***************
*** 81,85 ****
# testing the pkey_name method
! result($obj->pkey_name() eq 'fesw_pk');
--- 77,81 ----
# testing the pkey_name method
! result($obj->pkey_name() eq 'sw_pk');
Index: MeasuredBioAssay.t
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/t/MeasuredBioAssay.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MeasuredBioAssay.t 15 Oct 2002 14:42:58 -0000 1.1
--- MeasuredBioAssay.t 23 Nov 2002 10:23:36 -0000 1.2
***************
*** 44,54 ****
result ($obj->es_fk() == 555);
! # testing the fesw_fk attribute method
! $obj->fesw_fk(555);
! result ($obj->fesw_fk() == 555);
! # testing the fesw_obj attribute method
! $obj->fesw_obj(555);
! result ($obj->fesw_obj() == 555);
# testing the es_obj attribute method
--- 44,54 ----
result ($obj->es_fk() == 555);
! # testing the sw_fk attribute method
! $obj->sw_fk(555);
! result ($obj->sw_fk() == 555);
! # testing the sw_obj attribute method
! $obj->sw_obj(555);
! result ($obj->sw_obj() == 555);
# testing the es_obj attribute method
|
|
From: <jas...@us...> - 2002-11-23 10:23:14
|
Update of /cvsroot/genex/genex-server/Genex/t In directory sc8-pr-cvs1:/tmp/cvs-serv7190/Genex/t Removed Files: TableAdmin-pre.xml TableAdmin.t Log Message: unneeded --- TableAdmin-pre.xml DELETED --- --- TableAdmin.t DELETED --- |
|
From: <jas...@us...> - 2002-11-23 10:23:13
|
Update of /cvsroot/genex/genex-server/Genex/TableAdmin In directory sc8-pr-cvs1:/tmp/cvs-serv7190/Genex/TableAdmin Removed Files: .cvsignore Makefile.PL TableAdmin.pm Log Message: unneeded --- .cvsignore DELETED --- --- Makefile.PL DELETED --- --- TableAdmin.pm DELETED --- |
|
From: <jas...@us...> - 2002-11-23 10:18:48
|
Update of /cvsroot/genex/genex-server/Genex/ExperimentFactors
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/ExperimentFactors
Modified Files:
ExperimentFactors.pm
Log Message:
new
Index: ExperimentFactors.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/ExperimentFactors/ExperimentFactors.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** ExperimentFactors.pm 15 Nov 2002 21:55:12 -0000 1.31
--- ExperimentFactors.pm 23 Nov 2002 10:18:15 -0000 1.32
***************
*** 24,28 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 24,28 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 1022,1025 ****
--- 1022,1144 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::ExperimentFactors> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::ExperimentFactors->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::ExperimentFactors->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'ef_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::ExperimentFactors objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::ExperimentFactors objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:48
|
Update of /cvsroot/genex/genex-server/Genex/ExperimentSet
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/ExperimentSet
Modified Files:
ExperimentSet.pm
Log Message:
new
Index: ExperimentSet.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/ExperimentSet/ExperimentSet.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** ExperimentSet.pm 15 Nov 2002 21:55:12 -0000 1.37
--- ExperimentSet.pm 23 Nov 2002 10:18:15 -0000 1.38
***************
*** 29,33 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 29,33 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 1134,1137 ****
--- 1134,1256 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::ExperimentSet> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::ExperimentSet->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::ExperimentSet->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'es_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::ExperimentSet objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::ExperimentSet objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:47
|
Update of /cvsroot/genex/genex-server/Genex/ContactType
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/ContactType
Modified Files:
ContactType.pm
Log Message:
new
Index: ContactType.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/ContactType/ContactType.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ContactType.pm 15 Nov 2002 21:55:11 -0000 1.18
--- ContactType.pm 23 Nov 2002 10:18:14 -0000 1.19
***************
*** 21,25 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 21,25 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 905,908 ****
--- 905,1027 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::ContactType> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::ContactType->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::ContactType->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'con_fk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::ContactType objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::ContactType objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:47
|
Update of /cvsroot/genex/genex-server/Genex/ControlledVocab
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/ControlledVocab
Modified Files:
ControlledVocab.pm
Log Message:
new
Index: ControlledVocab.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/ControlledVocab/ControlledVocab.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** ControlledVocab.pm 15 Nov 2002 21:55:11 -0000 1.30
--- ControlledVocab.pm 23 Nov 2002 10:18:15 -0000 1.31
***************
*** 22,26 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 22,26 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 978,981 ****
--- 978,1100 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::ControlledVocab> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::ControlledVocab->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::ControlledVocab->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'cv_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::ControlledVocab objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::ControlledVocab objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:47
|
Update of /cvsroot/genex/genex-server/Genex/Contact
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/Contact
Modified Files:
Contact.pm
Log Message:
new
Index: Contact.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/Contact/Contact.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** Contact.pm 15 Nov 2002 21:55:11 -0000 1.37
--- Contact.pm 23 Nov 2002 10:18:14 -0000 1.38
***************
*** 23,27 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 23,27 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 1018,1021 ****
--- 1018,1140 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::Contact> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::Contact->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::Contact->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'con_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::Contact objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::Contact objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:47
|
Update of /cvsroot/genex/genex-server/Genex/Citation
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/Citation
Modified Files:
Citation.pm
Log Message:
new
Index: Citation.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/Citation/Citation.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** Citation.pm 15 Nov 2002 21:55:10 -0000 1.37
--- Citation.pm 23 Nov 2002 10:18:14 -0000 1.38
***************
*** 21,25 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 21,25 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 975,978 ****
--- 975,1097 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::Citation> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::Citation->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::Citation->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'cit_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::Citation objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::Citation objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:47
|
Update of /cvsroot/genex/genex-server/Genex/Chromosome
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/Chromosome
Modified Files:
Chromosome.pm
Log Message:
new
Index: Chromosome.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/Chromosome/Chromosome.pm,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** Chromosome.pm 15 Nov 2002 21:55:10 -0000 1.41
--- Chromosome.pm 23 Nov 2002 10:18:14 -0000 1.42
***************
*** 22,26 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 22,26 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 941,944 ****
--- 941,1063 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::Chromosome> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::Chromosome->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::Chromosome->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'chr_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::Chromosome objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::Chromosome objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:46
|
Update of /cvsroot/genex/genex-server/Genex/BlastHits
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/BlastHits
Modified Files:
BlastHits.pm
Log Message:
new
Index: BlastHits.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/BlastHits/BlastHits.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** BlastHits.pm 15 Nov 2002 21:55:08 -0000 1.31
--- BlastHits.pm 23 Nov 2002 10:18:13 -0000 1.32
***************
*** 21,25 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 21,25 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 926,929 ****
--- 926,1048 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::BlastHits> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::BlastHits->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::BlastHits->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'bh_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::BlastHits objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::BlastHits objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:46
|
Update of /cvsroot/genex/genex-server/Genex/Audit
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/Audit
Modified Files:
Audit.pm
Log Message:
new
Index: Audit.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/Audit/Audit.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Audit.pm 15 Nov 2002 21:55:08 -0000 1.7
--- Audit.pm 23 Nov 2002 10:18:13 -0000 1.8
***************
*** 21,25 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 21,25 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 921,924 ****
--- 921,1043 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::Audit> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::Audit->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::Audit->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'audit_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::Audit objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::Audit objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:46
|
Update of /cvsroot/genex/genex-server/Genex/Channel
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/Channel
Modified Files:
Channel.pm
Log Message:
new
Index: Channel.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/Channel/Channel.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Channel.pm 15 Nov 2002 21:55:09 -0000 1.9
--- Channel.pm 23 Nov 2002 10:18:14 -0000 1.10
***************
*** 20,24 ****
use Bio::Genex::Identifiable;
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 20,24 ----
use Bio::Genex::Identifiable;
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 895,898 ****
--- 895,1017 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::Channel> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::Channel->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::Channel->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'channel_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::Channel objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::Channel objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:46
|
Update of /cvsroot/genex/genex-server/Genex/Array
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/Array
Modified Files:
Array.pm
Log Message:
new
Index: Array.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/Array/Array.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Array.pm 15 Nov 2002 21:55:07 -0000 1.7
--- Array.pm 23 Nov 2002 10:18:12 -0000 1.8
***************
*** 26,30 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 26,30 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 1082,1085 ****
--- 1082,1204 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::Array> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::Array->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::Array->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'array_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::Array objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::Array objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|
|
From: <jas...@us...> - 2002-11-23 10:18:46
|
Update of /cvsroot/genex/genex-server/Genex/ArrayDesign
In directory sc8-pr-cvs1:/tmp/cvs-serv5789/Genex/ArrayDesign
Modified Files:
ArrayDesign.pm
Log Message:
new
Index: ArrayDesign.pm
===================================================================
RCS file: /cvsroot/genex/genex-server/Genex/ArrayDesign/ArrayDesign.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ArrayDesign.pm 15 Nov 2002 21:55:08 -0000 1.7
--- ArrayDesign.pm 23 Nov 2002 10:18:13 -0000 1.8
***************
*** 24,28 ****
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW);
require Exporter;
--- 24,28 ----
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $FKEYS $COLUMN2NAME $NAME2COLUMN $COLUMN_NAMES %_CACHE $USE_CACHE $LIMIT $FKEY_OBJ2RAW $TABLE2PKEY $UNIQUE_COLUMNS $SUPER_CLASSES $TABLE_TYPE $PKEY_NAME $TABLE_NAME $DEBUG $TABLE_NAME_VIEW $COUNT);
require Exporter;
***************
*** 1043,1046 ****
--- 1043,1165 ----
}
+
+ =item insert_matrix($class,%args)
+
+
+ This method inserts a matrix of data into the database specified by
+ the DB handle $dbh. Class C<Bio::Genex::ArrayDesign> has no foreign keys of
+ type 'lookup table', so C<insert_matrix> may be invoked as a ordinary
+ class method.
+
+ my $matrix = some_method_returning_data();
+ Bio::Genex::ArrayDesign->insert_matrix(dbh=>$dbh,matrix=>$matrix);
+
+
+
+ Supported %args
+
+ =over
+
+ =item * dbh
+
+ an active database handle
+
+ =item * matrix
+
+ an array ref holding the matrix
+
+
+
+ =back
+
+ B<NOTE:> You must log into the DB with a user/password that has INSERT
+ priveleges in the DB, otherwise you will get a DBI error.
+
+
+
+ =cut
+
+ sub insert_matrix {
+ my ($class,%args) = @_;
+ my $dbh = $args{dbh};
+ assert_dbh($dbh);
+
+ my $table_name = Bio::Genex::ArrayDesign->table_or_viewname($dbh);
+ my @error_args = ();
+ my ($pack,$file,$line,$sub) = caller(0);
+ push(@error_args, caller=>"$pack:$file:$line:$sub");
+ my $matrix = $args{matrix};
+ $dbh->error(@error_args,
+ message=>"Must supply array reference for 'matrix'",
+ no_errstr=>1,
+ )
+ unless ref($matrix) eq 'ARRAY';
+ my $header = shift @{$matrix};
+ my $sql;
+
+
+
+ # add primary key to each row
+ push(@{$header},'ad_pk');
+
+
+ # pre-fetch the next value of the sequence
+ my $seq = 'GENEX_ID_SEQ';
+ my $seq_sql = qq[SELECT nextval('"$seq"'::text)];
+ my $seq_sth = $dbh->prepare($seq_sql)
+ or $dbh->error(@error_args,
+ sql=>$seq_sql,
+ message=>"Couldn't prepare nextval for sequence $seq",
+ );
+
+ $sql = $dbh->create_insert_sql($table_name,
+ $header,
+ );
+ my $sth = $dbh->prepare($sql)
+ or $dbh->error(@error_args,
+ message=>"Couldn't prepare insert sql",
+ sql=>$sql);
+
+ my $count;
+ foreach my $row (@{$matrix}) {
+ $count++;
+ $seq_sth->execute()
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql);
+ my $pkey = $seq_sth->fetchrow_arrayref();
+ $dbh->error(@error_args,
+ message=>"Couldn't fetch nextval from sequence $seq",
+ sth=>$seq_sth,
+ sql=>$seq_sql)
+ unless defined $pkey && $pkey->[0];
+
+ # DBI won't re-run the SQL until we finish
+ $seq_sth->finish();
+
+ $sth->execute(@{$row},$pkey->[0])
+ or $dbh->error(@error_args,
+ message=>"Couldn't execute insert sql with args: "
+ . join(',',@{$row},$pkey->[0]),
+ sth=>$sth,
+ sql=>$sql);
+
+
+ print STDERR "Handled $count Bio::Genex::ArrayDesign objects
+ "
+ if $DEBUG and $COUNT and ($count % $COUNT == 0);
+ }
+ my $ga_db = Bio::Genex::GenexAdmin->new();
+ my $description = "inserted " . scalar @{$matrix} . " Bio::Genex::ArrayDesign objects";
+ $ga_db->description($description);
+ $ga_db->insert_db($dbh);
+
+ $dbh->error(@error_args,
+ message=>"Couldn't insert GenexAdmin record")
+ if $dbh->err;
+
+ return 1;
+ }
# ObjectTemplate automagically creates a new() method for us
|