Dear friends,

I have a little problem that I am not sure I understand. Its about
bind_columns. I use it a lot cause its really fast in retrieving a lot of
data. I tie the values from table to keys in hash based on array of keys
that I pass to it in bind columns statement. (like in one of the fancy
examples in docs)
My problem is that if my sql had a specific order of fields to select at the
time of passing it to prepare/execute, I cannot change it even if I sort the
array before passing it to bind_columns. More than that, since those would
be keys in a hash, I should be able to print out my hash in any way I want,
which is not the case :( Maybe i have a mistake somewhere in my thinking? 
Here is a sample code that I am working on.


Thanx much for your help.

Daniel

for example i create:
my $sql = "select c, b, a from foo";
my @ClnFldsArray=('c', 'b', 'a');

# sort an array alphabetically i.e. 'a', 'b', 'c'
if ($sort_flg eq "Y"){
        my @tmp=sort @ClnFldsArray; 
        @[EMAIL PROTECTED]; 
}

print OUTFILE join('|',@ClnFldsArray)."\n"; # print header record. Printed
in sorted form

my      %row;
my      $sth = $dbh->prepare_cached($sql) || die $dbh->errstr;
        $sth->execute;  $sth->bind_columns( \( @[EMAIL PROTECTED] )); 
while($sth->fetch) {
# print each row with | as delimiter
# Basically should not matter what order got into hash, as long as i go by
@ClnFldsArray order. I think....
        print OUTFILE map "$row{$_}|", @ClnFldsArray; 
        print OUTFILE "\n";
}#while
        



____________________________________________________________________

IMPORTANT NOTICES: 
          This message is intended only for the addressee. Please notify the
sender by e-mail if you are not the intended recipient. If you are not the
intended recipient, you may not copy, disclose, or distribute this message
or its contents to any other person and any such actions may be unlawful.
 
         Banc of America Securities LLC("BAS") does not accept time
sensitive, action-oriented messages or transaction orders, including orders
to purchase or sell securities, via e-mail.

         BAS reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the BAS e-mail system.
__________________________________________________________________

Reply via email to