savannah-dev
[Top][All Lists]
Advanced

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

[Savannah-dev] DBI


From: Mathieu Roy
Subject: [Savannah-dev] DBI
Date: 29 May 2003 19:53:05 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Does anyone know why with a function like this

sub GetDB {
    my $table = $_[0];
    my $criterion;
    my $fields = "*";
    my $hop;

    $criterion = "WHERE ".$_[1] if $_[1];
    $fields = $_[2] if $_[2];

    $hop = $dbd->prepare("SELECT ".$fields." FROM ".$table." ".$criterion);
    $hop->execute;
    while (my (@line) = $hop->fetchrow_array) {
        push(@ret, join(",", map {defined $_ ? $_ : "0"} @line));
        
    }
    $hop->finish;
    $dbd->disconnect;
    return @ret;
}

The second time I run GetDB() in a script, it returns the result of
the new request but also the result of the old - independantly of the
fact that the two requests are different?

The DBI man page, apart from being an advertisement for mSQL and
Oracle, does not help me that much. Any good doc that I surely missed?


Note that the mysql log tells me that the requests are just fine.

                    303 Connect     address@hidden on savannah
                    303 Query       SELECT 
user_name,email,realname,authorized_keys,gpg_key,status,unix_status FROM user
                    303 Query       SELECT user_name,unix_group_name FROM 
user_group,groups,user WHERE groups.group_id=user_group.group_id AND 
user.user_id=user_group.user_id






-- 
Mathieu Roy
 
  Homepage:
    http://yeupou.coleumes.org
  Not a native english speaker: 
    http://stock.coleumes.org/doc.php?i=/misc-files/flawed-english




reply via email to

[Prev in Thread] Current Thread [Next in Thread]