RE: [HACKERS] web-based front end development - Mailing list pgsql-hackers

From Don Baccus
Subject RE: [HACKERS] web-based front end development
Date
Msg-id 3.0.1.32.19990730111339.00e0a864@mail.pacifier.com
Whole thread Raw
In response to RE: [HACKERS] web-based front end development  (Dmitry Samersoff <dms@wplus.net>)
List 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@pacifier.com> Nature photos, on-line guides, and other goodies at
http://donb.photo.net


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Cannot insert into temp tables
Next
From: Tatsuo Ishii
Date:
Subject: Re: [HACKERS] Patches for Postgresql on Linux/Alpha!