About MC as a very suitable PostGreSQL linkeable WAS...
Pierre Sahores
psahores at easynet.fr
Tue Apr 16 10:58:01 EDT 2002
Hi List,
Just some scripts to share there, about how to drive PostGreSQL from
within Metacard...
> on SQLbyMC
> global Retour
> -- fld "Saisie" of substack "Procedures" (ISQL alike browser) contains the SQL request (no ended by ";")
> put "&r=" & fld "Saisie" of stack "Procedures" & "zzzzzzzzzzzzzzzzzzzzzz" into dbAsked
> set httpheaders to "Content-Type: application/x-www-form-urlencoded" & cr & "Content-Length:" && the length of dbAsked & cr & cr # Apache :oui ; IIS : non
> post dbAsked to url "http://localhost/wmctopg.xml"
> put it into dbReplied -- the db output
> ----------------------------
>
> -- do what you need with the datas, before parsing them back to the mc output
>
> -----------------------------
> put dbReplied into Retour -- the mc output
>
> repeat until "<" is not in Retour -- control structure
> put " " into char offset ("<",Retour) to offset (">",Retour) of Retour
> end repeat
> answer Retour -- end control structure
> end SQLbyMC
> on mouseUp -- clicked to POST the SQL request to the PostGreSQL (.php based) sockets listener
> send SQLbyMC to btn "WMCtoPGSQL" of stack "WMCPE"
> end mouseUp
> <?
>
> // the "wmctopg.xml" (.php script) PostGreSQL sockets listener
>
> if ($REQUEST_METHOD == POST) {
>
> $conn = pg_connect("host=localhost port=5432 user=postgres password='' dbname=citalis");
> if ($conn) {
>
> $headers = $HTTP_POST_VARS;
> while (list($header, $value) = each($headers)) $exAE = "$header=$value";
> $sql = (substr($exAE,2));
> $result=@pg_exec($conn,$sql) or die(pg_errormessage());
>
> // replace the two lines below by what you need to get back from the PostGreSQL server
> $nor=@pg_numrows($result);
> echo $nor;
>
> pg_close($conn);
>
> }
> }
>
> else print("<HTML><HEAD><TITLE>ERROR: File Not Found</TITLE></HEAD>".
> "<BODY background='/gif/fond-maison.gif'><H1>File Not Found</H1><P>".
> "<H3>The file you have requested does not exist on this server.</H3></BODY></HTML><BR>\n");
>
> ?>
Comment : PostGreSQL is not more complex to use than MySQL is but,
PostGreSQL is many more suitable than MySQL is...
Have fun ;-)
Best Regards, Pierre Sahores
WEB & VPN applications & databases servers
Inspection académique de Seine-Saint-Denis
Qualifier & produire l'avantage compétitif
More information about the metacard
mailing list