Dany inny (wcześniejszy) przykładowy plik bazy, o dziwo działa.

Namierzania problemu ciąg dalszy.
master
Cranix 2013-03-25 16:15:35 -04:00
parent 8aaed63fc2
commit a6efcc3ef8
2 changed files with 8 additions and 13 deletions

View File

@ -13,13 +13,10 @@ my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "");
get '/' => sub
{
my $sth = $dbh->prepare("select * from ksiazki");
$sth->execute();
my $i=0;
my $sth = $dbh->prepare("select * from ksiazki;") or die "Nie mozna spreparowac zapytania";
$sth->execute() or die "Nie mozna wykonac zapytania";
#my $sth=$dbh->do("select * from ksiazki");
my @result;
my $ii=0;
(@result)=@{$sth->fetchall_arrayref} or die "blad przy pobieraniu danych";
# |kolejne rekordy|kolejne pola rekordow
@ -35,13 +32,13 @@ get '/req/:book' => sub
my $id=params->{book};
my $sth;
$sth=$dbh->prepare("select type from ksiazki where id=?");
$sth->execute($id);
my $type = $sth->fetchrow_array;
$sth=$dbh->prepare("select type from ksiazki where id=?") or die "Nie mozna spreparowac zapytania";
$sth->execute($id) or die "Nie mozna wykonac";
my $type = $sth->fetchrow_array or die "Nie mozna pobrac danych";
if ($type == 1)
{
$sth = $dbh->prepare("update ksiazki set state=not state where id=?");
$sth->execute($id);
$sth = $dbh->prepare("update ksiazki set state=not state where id=?") or die "Nie mozna spreparowac zapytania";
$sth->execute($id) or die "Nie mozna wykonac zapytania";
return 0;
}
elsif ($type == 0)
@ -54,7 +51,5 @@ get '/req/:book' => sub
}
};
$sth->finish();
$dbh->disconnect();
dance;

Binary file not shown.