#!/usr/bin/perl

use DBI;
my @drv = DBI->available_drivers();
print join("\n", @drv), "\n";

# Parametres de connection a la base de donnees
$bd    = '/tmp/memory/fah.db';
$identifiant = '';      # identifiant
$motdepasse  = '';

# Connection a la base de donnees mysql
print("Connexion a la base de donnees $bd\n");
$db = DBI->connect(
        "DBI:SQLite:dbname=$bd",
        $identifiant, $motdepasse, {RaiseError => 1}
      ) or die "Connection impossible a la base de donnees $bd !\n $! \n $@\n$DBI::errstr";

$do = $db->prepare("SELECT nom,score,pos_general FROM Alliance WHERE rec = 1");
$ErrNum = $do->execute() or die $DBI::errstr;
while ($ErrNum >= 0 and my @data = $do->fetchrow_array()) {
  print($data[0]."|".$data[1]."|".$data[2]."\n");
}
$db->disconnect();
print("Fin.\n");
