826
Source / Compiling the source in Windows
« on: June 29, 2007, 08:39:01 PM »
I just put the 2.1 binaries in the "What's New" section to download. I will have the 2.1 source up soon.
John
John
Forum Registration Disabled - Send a request to support@scriptbasic.org to join the forum.
User Guide
Developers Guide
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#!/usr/bin/scriba -c
INCLUDE cgi.bas
INCLUDE pgsql.bas
OPTION cgi$Method cgi::Post or cgi::Get
cgi::Header 200,"text/html"
cgi::FinishHeader
PRINT """
<html>
<head>
<title>PostgreSQL</title>
</head>
<body>
<font face="Verdana, Arial, Helvetica, sans-serif">
<table border="1" cellpadding="3">
"""
c = PGSQL::PGopen("dbname='database' user='user' password='password'")
IF ISSTRING(c) THEN
PRINT "Connect Error: (", RTRIM(c), ")\n"
END
END IF
r = PGSQL::PGexec(c, "SELECT * FROM contact")
IF ISSTRING(r) THEN
PRINT "Query Error: (", RTRIM(r), ")\n"
END
END IF
PRINT "<b>PGSQL Handle: </b>" & c & "<br>"
PRINT "<b>Command Status: </b>" & PGSQL::PGcmdStatus(r) & "<br>"
PRINT "<b>Command Tuples: </b>" & PGSQL::PGcmdTuples(r) & "<br>"
PRINT "<br>"
' Column Names
PRINT "<tr>"
nf=PGSQL::PGncols(r)
FOR i=0 TO nf-1
PRINT "<td>" & PGSQL::PGcol(r,i) & "</td>"
NEXT
PRINT "</tr>"
' Data
nrows=PGSQL::PGnrows(r)
FOR row=0 TO nrows-1
PRINT "<tr>"
FOR col=0 TO nf-1
IF PGSQL::PGgetisnull(r,row,col) THEN
PRINT "<td>NULL</td>"
ELSE
PRINT "<td>" & PGSQL::PGgetvalue(r,row,col) & "</td>"
END IF
NEXT
PRINT "</tr>"
NEXT
PRINT """
</table>
</body>
</html>
"""
PGSQL::PGclose(r)
PGSQL::PGclose(c)
END