[Bio] / Sprout / ERDBQueryConsole.pm Repository:
ViewVC logotype

Diff of /Sprout/ERDBQueryConsole.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Thu Jun 18 01:29:58 2009 UTC revision 1.6, Tue Jun 30 19:53:01 2009 UTC
# Line 46  Line 46 
46    
47  =item erdb  =item erdb
48    
49  [[ErdbPm]] database object for the current database.  L<ERDB> database object for the current database.
50    
51  =item query  =item query
52    
53  [[ERDBQueryPm]] object for obtaining the query results.  L<ERDBQuery> object for obtaining the query results.
54    
55  =item fields  =item fields
56    
# Line 95  Line 95 
95    
96  =item db  =item db
97    
98  Database against which to run the query. This can be either an [[ErdbPm]]  Database against which to run the query. This can be either an L<ERDB>
99  object for the database or a string containing the database name.  object for the database or a string containing the database name.
100    
101  =item options  =item options
# Line 361  Line 361 
361          $self->AddStat(duration => time() - $start);          $self->AddStat(duration => time() - $start);
362          # Only proceed if a record was found.          # Only proceed if a record was found.
363          if (defined $record) {          if (defined $record) {
364                $self->AddStat(records => 1);
365              # Now we have the data for this row, and it's time to              # Now we have the data for this row, and it's time to
366              # stuff it into the return list. Loop through the fields.              # stuff it into the return list. Loop through the fields.
367              for my $field (@{$self->{fields}}) {              for my $field (@{$self->{fields}}) {
# Line 425  Line 426 
426    
427  =cut  =cut
428    
429    use constant GET_VAR_NAME => { Get => '$qh', GetFlat => '@results',
430                                   GetAll => '@rows' };
431    
432  sub GetCode {  sub GetCode {
433      # Get the parameters.      # Get the parameters.
434      my ($self, $dbVarName, $codeStyle, @parameters) = @_;      my ($self, $dbVarName, $codeStyle, @parameters) = @_;
# Line 470  Line 474 
474      $quotedObjectNameString =~ s/\s+/ /;      $quotedObjectNameString =~ s/\s+/ /;
475      # Quote the filter string.      # Quote the filter string.
476      my $quotedFilterString = Quotify($self->{filterString});      my $quotedFilterString = Quotify($self->{filterString});
     # The result from the Get call depends on the type: a list for  
     # GetAll, a scalar for Get.  
     my $getResultName = ($codeStyle eq 'Get' ? '$qh' : '@resultRows');  
477      # Not we compute the function name. It's the same as the code style      # Not we compute the function name. It's the same as the code style
478      # unless we're doing a GetAll and there's only one field. In that case      # unless we're doing a GetAll and there's only one field. In that case
479      # we do a GetFlat.      # we do a GetFlat.
480      my $getName = ($codeStyle eq 'GetAll' && scalar(@$fields) == 1 ? 'GetFlat' : $codeStyle);      my $getName = ($codeStyle eq 'GetAll' && scalar(@$fields) == 1 ? 'GetFlat' : $codeStyle);
481        # The result from the Get call depends on the type: a list for
482        # GetAll or GetFlat, a scalar for Get.
483        my $getResultName = GET_VAR_NAME->{$getName};
484      # Build the Get. It's multiple lines, so we need to compute how far to      # Build the Get. It's multiple lines, so we need to compute how far to
485      # indent the secondary lines. In addition, we need to decide here whether      # indent the secondary lines. In addition, we need to decide here whether
486      # we're doing a Get or a GetAll.      # we're doing a Get or a GetAll.

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3