Skip site navigation (1) Skip section navigation (2)

RE: [HACKERS] web-based front end development

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Dmitry Samersoff <dms(at)wplus(dot)net>, Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Postgres Hackers List <hackers(at)postgreSQL(dot)org>
Subject: RE: [HACKERS] web-based front end development
Date: 1999-07-30 18:13:39
Message-ID: 3.0.1.32.19990730111339.00e0a864@mail.pacifier.com (view raw or flat)
Thread:
Lists: pgsql-hackers
At 11:49 PM 7/29/99 +0400, Dmitry Samersoff wrote:
...

> $qu = pg_exec($conn, "select * from users where (uid = '$uid');" );
>        $nm = pg_numrows($qu);
>        if ($nm > 0)
>           {
>             $data = pg_fetch_object ($qu, $i);
>             $xpin = crypt($pin, $data->pin);
>             if ($xpin == $data->pin)
>                 { BlueEcho("PIN of user '$uid' is valid");
>                 }
>               else
>                {  RedEcho("Sorry, you enter incorrect PIN for user '$uid'");
>                }
>           }
>
>       pg_close($conn);

Tcl code in AOLserver looks roughly like this (using the utilities
package from ArsDigita as well as AOLserver Tcl extensions):

# Note that this gets a persistent handle, i.e. the overhead is
# simply that of assigning a handle pointer from a pool

set db [ns_db gethandle]
set selection [ns_db select $db "select * from users where (uid='$uid')"
while {[ns_db getrow $db $selection]} {
    set_variables_after_query
    if {$pin == ...

}

ns_db releasehandle $db

>and seems to be very convenient for sambody familiar with perl or C
>
>Secondly, I use Perl every time as I need write anything for five minits 
>just because I use Perl about five years.
>
>Perl code looks like (I skip any error check, usually doing inside runSQL)

>  my $connect_args = 'dbname=voip host=nymph.wplus.net user=dms';
>  my $conn = Pg::connectdb($connect_args);

This is bad for websites - building a new db connection is expensive.

This is why AOLserver provides pooled connections.

This is why Apache/modperl types use packages that pool persistent
connections if they plan to build a busy site.

>  my $query = "select uid from users where(opstatus=1 and manstatus=1 and
units
>< $insure)
>
> $result = $conn->exec("BEGIN");
> $result = $conn->exec("DECLARE killer001 CURSOR FOR $query;");

As you can see, when it gets down to it, all of these solutions have
more in common than in differences.

The key to look at, IMO, is the efficiency of the webserver and its
database connectivity.

...




- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
  Nature photos, on-line guides, and other goodies at
  http://donb.photo.net

In response to

pgsql-hackers by date

Next:From: Tatsuo IshiiDate: 1999-07-30 21:37:16
Subject: Re: [HACKERS] Patches for Postgresql on Linux/Alpha!
Previous:From: Bruce MomjianDate: 1999-07-30 18:08:09
Subject: Re: [HACKERS] Cannot insert into temp tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group