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

From Dmitry Samersoff
Subject RE: [HACKERS] web-based front end development
Date
Msg-id XFMail.990729234959.dms@wplus.net
Whole thread Raw
In response to web-based front end development  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Responses Re: [HACKERS] web-based front end development
RE: [HACKERS] web-based front end development
List pgsql-hackers
On 29-Jul-99 Thomas Lockhart wrote:
> Hi. There is interest at work in doing some fairly simple inventory
> control using a database. We've already got Postgres up and running
> (for obvious reasons) and I was wondering if anyone had suggestions
> for a good approach to app development for brower-based user
> interfaces.

You begin the star war ;-))

I use three different interface for different tasks 

Firstly, I use php3 to make web based interface 
http://www.piter-press.ru is an example (not the best, but the only public
available)
PHP3 code looks like
$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);

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); my $query =
"selectuid from users where(opstatus=1 and manstatus=1 and units
 
< $insure)
$result = $conn->exec("BEGIN");$result = $conn->exec("DECLARE killer001 CURSOR FOR $query;");
 open(EMP,"|$empress");
 while( ($result = Voip::runSQL($conn, "FETCH FORWARD 1 IN
killer001;"))  ) { while (@row = $result->fetchrow)    {      runSQL($conn, "begin");      runSQL($conn, "update users
setopstatus=2 where(uid = '$row[0]');");       print EMP "update its_user set acctstatus=1 where(userid =
 
'$row[0]');\n";      runSQL($conn, "commit");      print "User $row[0] disabled\n";    }  }
 runSQL($conn,"CLOSE killer001;"); runSQL($conn, "END"); $conn->reset();

Third, I use C++ for really hard tasks (By historical reasons, I use my own
library, not libpq++) 
C++ code looks like 
 pgs = new PgSQL(listdb); pgs->trace();
sprintf( (char *)qbuf,"select id, email from %s where( msgid < %d );",                                       (char *)
list,msgid);pgs->openCursor( (char *)qbuf);
 
      while( pgs->fetchNext() )        {            sprintf(update,"update %s set msgid=%d where( id = %s);",
                                          (char *)listn, msgid            send_proc(qbuf, (char *) (*pgs)["email"], fm,
(char*)                                                             update );        } // while 
 
    pgs->closeCursor();    delete pgs;

I also try to use Java but I find no appropriate task for it.
Main disadvantage to Java - is lots of incompatible browser versions,
for example Lucent made java interface works only on 2 MS Win based 
workstations and 0 of UNIX based from about 80 comps. All other have
fonts, security manager or other problems ;-)) 
(but it's my opinion - any of Java gurus may be completely disagree with me
;-))  )


IMHO, PHP3 is the best choice for Web it self, but bakground programs 
should be written in C/C++

So, make your choice and good luck  ;-))


> 
> There are other applications which would be of interest, so something
> with some growth potential would be helpful.
> 
> We have a bit of expertise in Java servlets, etc, so that is one
> option via the jdbc interface.
> 
> Are there any options which are particularly "approachable" which
> would allow newbies to get something working if they have some
> existing code to look at?
> 
> TIA
> 
>                      - Thomas
> 
> -- 
> Thomas Lockhart                               lockhart@alumni.caltech.edu
> South Pasadena, California

---
Dmitry Samersoff, dms@wplus.net, ICQ:3161705
http://devnull.wplus.net
* There will come soft rains ...


pgsql-hackers by date:

Previous
From: Michael Robinson
Date:
Subject: Re: [HACKERS] web-based front end development
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] cvs log for libpq-int.h ...