Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to structure applications using a RDBMS

by gav^ (Curate)
on Jul 19, 2002 at 01:10 UTC ( [id://183101]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
       My::User->set_sql(
          'getUsers', 'select * from users', 'Main'
       );
    
  2. or download this
       my $sth = My::User->sql_getUsers;
       $sth->execute();
       # etc
    
  3. or download this
        $sth->execute([qw/value1 value2/], [\my $res1]);
        my %hash = $sth->fetch_hash;
    
  4. or download this
    package User;
    use base 'Class::DBI';
    
    ...
    User->columns('All', qw/id name password/);
    User->coumns('Primary', 'id');
    User->set_db('Main', 'dbi:mysql', 'gav', 'perlmonks');
    
  5. or download this
        my $user1 = User->new({ name => 'gav', password => 'monk' });
        my $user2 = User->retrieve(1023);
        printf "Id: %d, Name: %s, Pass %s\n", $user2->id, $user2->name, 
            $user2->password;
    
  6. or download this
        my $user = User->search(name => 'gav');
        if ($user && ($user = $user->next) && $user->password eq 'monk') {
            print "Welcome gav^!\n";
        } else {
            print "Schoo!\n";
        }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://183101]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (None)
    As of 2024-04-25 01:07 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found