LiangTyan Fui a �crit : > > On 4/16/02 11:49 PM, Pierre Sahores wrote: > > > Hi List, > > > > Just some scripts to share there, about how to drive PostGreSQL from > > within Metacard... > > <snip> > > I am using the psql command with MetaCard shell instead. > Some incomplete code sample attached. > > function sqlexe @sql > #! postgresql interface > # sql["sqlcmd"] = the sql query > # sql["db"] = the database name > # sql["rsform"] = table format [line | ""], "" for array. > > #! hard code some of the command here > put "psql" into sql["cmd"] > put "postgres" into sql["user"] > put "-A" into sql["cmdsuffix"] > replace cr with " " in sql["sqlcmd"] > > if sql["db"] = "" then put "test" into sql["db"] > #! construct the command line > put sql["cmd"] &&"-U"&& sql["user"] &" -d "& \ > sql["db"] &" -c '"& sql["sqlcmd"] &"' "& \ > sql["cmdsuffix"] into shellcmd > #! execute the command in shell > put shell(shellcmd) into rs > > put 0 into x > put line 1 of rs into sql[x] #! result description > delete line 1 of rs > put last line of rs into sql["lastline"] #! record description > delete last line of rs > > if sql["rsform"] = "line" then > put rs into sql["raw"] > put number of lines of sql["raw"] into x > else > #! build the record table as array > set itemdel to "|" > repeat for each line therec in rs > put 0 into y > add 1 to x > repeat for each item theitem in therec > add 1 to y > put theitem into sql[x,y] > end repeat > end repeat > end if > > put x into sql["row"] # number of row > put y into sql["col"] # number of column > > end sqlexe > > The PHP glue could be faster. But I've tried using the shell command to > obtain a 16 MB data stream without problem: and you don't have to deal with > PHP if you don't feel comfortable with ;-) > > Regards, > LiangTyan Fui > > _______________________________________________ > metacard mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/metacard
Hi LiangTyan, That seems very interesting too ! I will try to test your way and send back some comparative benchmarks. Kind Regards, Pierre Sahores WEB & VPN applications & databases servers Inspection acad�mique de Seine-Saint-Denis Qualifier & produire l'avantage comp�titif _______________________________________________ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
