Help for this page

Select Code to Download


  1. or download this
    use strict;
    use DBIx::Class::Loader;
    ...
        }
    }
    print $prog;
    
  2. or download this
    create table usr(id integer primary key, name varchar(100), cityid int
    +eger);
    create table city (id integer primary key, name varchar(100));
    ...
    insert into city values (1, 'New York');
    insert into city values (2, 'London');
    insert into city values (3, 'Warsaw');
    
  3. or download this
    perl dump.pl dbi:Pg:dbname=prolog > mytables
    
  4. or download this
    % name,id
    city('New York',1).
    ...
    usr(1,'Marry',2).
    usr(2,'Eva',3).
    usr(3,'Zby',4).
    
  5. or download this
    zby@zby:~/progs/prologdata$ swipl
    Welcome to SWI-Prolog (Multi-threaded, Version 5.2.13)
    ...
    
    Yes
    ?-
    
  6. or download this
    ?- usr(Cityid, Name, Id), city('New York', Cityid).
    
    ...
    
    No
    ?-
    
  7. or download this
    my $prologDB = AI::Prolog->new( $prog );
    $prologDB->query( "usr(1,Name,Uid)." );
    while (my $results = $prologDB->results) { print "@$results\n"; }