Rép : Database Problems w/ Linux Standalones (correction)...

Pierre Sahores psahores at easynet.fr
Wed Aug 25 16:32:28 EDT 2004



Hi,

I don't know if that can be helpfull but, if the RevDB feets all my  
PostgreSQL's related needs under the MacOS X platform, i use the  
following method under the linux platform as a workaround to the  
difficulties you are experimented (and because i had to connect  
PostgreSQL from Metacard, years ago) :

To stick in the preopenstack main's stack handler :

>  if the platform is "Linux" then put "psql -h localhost projetsdac -U  
> postgres" into PgPath
>   else
>     if PGLinkOpen is a number then get revdb_disconnect("projetsdac")
>     put  
> revOpenDatabase("PostgreSQL","localhost","projetsdac","postgres","postg 
> res") into PGLinkOpen
>   end if

To send the requests to the PostgreSQL server trought the psql's  
command line client (localhost only, because security tasks + TCP/IP  
activated in the postgres "hba.conf" file) :

The main SQL's parser script to stick in the main stack script :

> function presave r
>   set itemdel to "¶"
>   put item 1 of r into s
>   put item 2 of r into t
>
>   set itemdel to "&"
>   replace numtochar(10) with "##10;#" in s
>   replace "\'" with "##11;#" in s
>   replace numtochar(34) with "##34;#" in s
>   replace "##11;###11;#" with "" in s
>
>   if the platform is "macos" then put mactoiso(isotomac(s)) into s
>
>   if "NRC=insert" is in s then put item itemoffset("rneetabl=",s) of s  
> & return into datatosave
>
>   repeat for each item i in s
>     if char 1 to 4 of i is t then put i & return after datatosave
>   end repeat
>
>   repeat for each char c in datatosave
>     try
>       if c is "_"
>       then put " " after datatosavec
>       else if chartonum(c) > 223
>       then put "&#" & chartonum(c) & ";" after datatosavec
>       else if chartonum(c) > 191
>       then put "&#" & chartonum(c) & ";" after datatosavec
>       else if chartonum(c) = 39
>       then put "&#" & chartonum(c) & ";" after datatosavec
>       else put c after datatosavec
>     catch errornum
>       if c is not char 1 of datatosave
>       then if c is not char -1 of datatosave
>       then put "_" after datatosavec
>     end try
>   end repeat
>
>   set itemdelimiter to "/"
>   put item 2 of the short date & "/" & item 1 of the short date & "/"  
> & item 3 of the short date into aa
>   if length(item 1 of aa) = 1 then put "0" before item 1 of aa
>   if length(item 2 of aa) = 1 then put "0" before item 2 of aa
>   put "20" before item 3 of aa
>
>   if "rneetabl" is in datatosavec then
>     put " ( " into insertcolnames
>     put " values ( " into insertcoldatas
>     repeat for each line l in datatosavec
>       if l is line -1 of datatosavec then
>         put char 1 to 8 of l && " ) " after insertcolnames
>         put "'" & aa & "' ) " after insertcoldatas
>       else
>         put char 1 to 8 of l && " , " after insertcolnames
>         put "'" & char 10 to -1 of l & "' , " after insertcoldatas
>       end if
>     end repeat
>     put insertcolnames & insertcoldatas into updatecols
>   else
>     repeat for each line l in datatosavec
>       if l is line -1 of datatosavec then put char 1 to 8 of l && "=  
> '" & aa & "'" after updatecols
>       else put char 1 to 8 of l && "= '" & char 10 to -1 of l & "' , "  
> after updatecols
>     end repeat
>   end if
>
>   return updatecols
> end presave
>
>
>
> function parsesql s
>   global PgPath,PGLinkOpen
>   repeat for each char c in s
>     try
>       if chartonum(c) > 223
>       then put "&#" & chartonum(c) & ";" after t
>       else if chartonum(c) > 191
>       then put "&#" & chartonum(c) & ";" after t
>       else put c after t
>     catch errornum
>       if c is not char 1 of s
>       then if c is not char -1 of s
>       then put "_" after t
>     end try
>   end repeat
>   replace "\" with "" in t
>   replace "[" with "&" in t
>   replace "]" with "\" in t
>   if the platform is "MacOS" then
>     if "select" is not in t then get revdb_QueryBLOB(PGLinkOpen,t)
>     else
>       put revdb_QueryList("|",return,PGLinkOpen,t) into pgreply
>       repeat for each line l in pgreply
>         put char 1 to -1+offset("|",l) of l && char offset("|",l) to  
> -1 of l & return after d
>       end repeat
>       return d & "(" & the num of lines in pgreply && "rows)"
>     end if
>   else return shell("echo" && quote && t && quote && "|" && PgPath)
> end parsesql

and some standard SQL requests using the upon SQL's parser (examples) :

One :

> put parsesql("select * from cpacpcst where rneetabl ilike '%" & testne  
> & "%'") into sreply

...and an other :

>  if char 5 to -1 of item itemoffset("NRC=",PostIn) of PostIn is  
> "insert" then get parsesql("insert into cpacpcst" && presave(PostIn &  
> "¶dems"))
>   else get parsesql("update cpacpcst set" && presave(PostIn & "¶dems")  
> && "where recordid='" & char 5 to -1 of item itemoffset("NRC=",PostIn)  
> of PostIn & "'")

All works very fine in production mode with up to hundreds connections  
peer seconds (75% write-mode), since 09/2000, only under the linux  
platform, the RevDB doing a best job than the upon scripts under the  
Panther platform.

Best Regards,

Pierre

Le 25 août 04, à 20:19, Frank D. Engel, Jr. a écrit :

> Okay, here is an example of what is happening.
>
> The attached revolution file contains a button and a text field (used  
> as a debugging log type of thing).
>
> Again, I use Studio version 2.2.1 under Mac OS X, and I built three  
> versions of the standalone: Mac OS X, Windows, and Linux.
>
> The Windows and Mac OS X versions work "as advertised", but the Linux  
> version seems to exit the handlers after dumping the first line of  
> text to the log field.  If I comment out the line with the  
> revOpenDatabase and uncomment the second line, then it does not try to  
> connect, so the rest of the script works fine.
>
> I could understand better if I was getting an error message back from  
> revOpenDatabase, but *all* running handlers seem to be exiting -- not  
> just the one containing the function call.
>
> If it would help, I could *try* to get a Solaris/SPARC or Irix opinion  
> on the issue, but it will take some time, as I will need to set up the  
> hardware (I have those systems disconnected right now), and I don't  
> think I even have Solaris installed on my SparcStation (it would be  
> version 8, on my painfully slow SS LX).
>
> On Aug 24, 2004, at 6:47 PM, Frank D. Engel, Jr. wrote:
>
>> Yes, but even after I changed the text to all lower-case, it still  
>> doesn't work.
>>
>> I hadn't even thought of the case sensitivity -- good catch, but  
>> still not working  :-(
>>
>> On Aug 24, 2004, at 4:17 PM, Troy Rollins wrote:
>>
>>>
>>> On Aug 24, 2004, at 3:59 PM, Roger.E.Eller at sealedair.com wrote:
>>>
>>>> Linux just seems
>>>> to be more case-sensitive than Mac or Win.
>>>
>>> That would be because it is.  ;-)
>>> --
>>> Troy
>>> RPSystems, Ltd.
>>> http://www.rpsystems.net
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>

-- 
Bien cordialement, Pierre Sahores

100, rue de Paris
F - 77140 Nemours

psahores+ at +easynet.fr

GSM:   +33 6 03 95 77 70
Pro:      +33 1 64 45 05 33
Fax:      +33 1 64 45 05 33

WEB/EAI services & ACID DB over IP
"Mutualiser les deltas de productivité"



More information about the use-livecode mailing list