[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



--------- Cut Here ----------
sub get_console_list {
  my($self, $ens_id) = @_;
  my @cols = ();
  my %CONSOLE = ();
  my $x = 0;
  my $sql = "select console_id, name, login, password, active, port from
console";
  if($ens_id) {
    $sql .= " where ens_id = '$ens_id'";
  }

  my $dbase = $self->{'CONNECTION'};
  my $res = $dbase->prepare($sql) or die $dbase->errstr();
  $res->execute() or die $res->errstr();
  $res->bind_columns(\$cols[0], \$cols[1], \$cols[2], \$cols[3],
\$cols[4] ,\$cols[5])
    or die $res->errstr();
  while($res->fetch()) {
    $CONSOLE{$x}{'ID'}      = $cols[0];
    $CONSOLE{$x}{'NAME'}    = $cols[1];
    $CONSOLE{$x}{'LOGIN'}     = $cols[2];
    $CONSOLE{$x}{'PASSWORD'} = $cols[3];
    $CONSOLE{$x}{'ACTIVE'}  = $cols[4];
    $CONSOLE{$x}{'PORT'}    = $cols[5];
    $x++;

  }

  return %CONSOLE;

}
--------- Cut Here -------


What I would like to do is instead of
doing $db->get_console_list(5)
I would like $db->get_console_list( 'ens_id' => 5 )
This way I can do other stuff like
$db->get_console_list ( 'ens_id' => 5 , 'active' => 'enabled');

Can someone give me a pointer on how I can do this.

Thanks
Chris



</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00793" href="msg00793.html">[ale] Perl Question</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00784.html">[ale] Burning Software</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00786.html">[ale] local mailserver and POP3</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00784.html">[ale] Burning Software</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00793.html">[ale] Perl Question</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00785"><strong>Date</strong></a></li>
<li><a href="threads.html#00785"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>