More problems with revExecuteSQL

Dave dave at looktowindward.com
Thu Nov 1 19:31:24 EDT 2007


Thanks Trevor,  I found it by experimenting and from what others had  
said. I then looked at your library stack and say the (very nicely  
formatted  and well written code). I forgot I could use your library  
as an abstraction layer.

All the Best
Dave


On 1 Nov 2007, at 14:07, Trevor DeVore wrote:

> Dave,
>
> Variable substitution doesn't escape characters for in version of  
> Rev prior to 2.9. Just run all values you want to insert into the  
> database through a function such as the following. Note that the  
> PostGreSQL switch statement is based on what I read in the docs. I  
> haven't used PostGreSQL myself so I haven't tested it.
>
> -- 
> Trevor DeVore
> Blue Mango Learning Systems
> www.bluemangolearning.com    -    www.screensteps.com
>
>
>
> on _escapeStringByRef pDBType, @pString
>     switch word 1 of pDBType
>         case "valentina"
>             replace numtochar(92) with numtochar(92) & numtochar 
> (92) in pString --> \ to \\
>                     replace numtochar(39) with numtochar(39) &  
> numtochar(39) in pString --> ' to ''
>             break
>
>         case "mysql"
>             replace numtochar(92) with numtochar(92) & numtochar 
> (92) in pString --> \ to \\
>                     replace numtochar(39) with numtochar(92) &  
> numtochar(39) in pString --> ' to \'
>             replace numtochar(34) with numtochar(92) & numtochar 
> (34) in pString --> " to \"
>             replace numtochar(0) with numtochar(92) & numtochar(48)  
> in pString --> NULL to \0
>             replace numtochar(26) with numtochar(92) & numtochar 
> (90) in pString --> Control-Z to \Z
>             replace numtochar(10) with numtochar(92) & numtochar 
> (110) in pString --> newline to \n
>             replace numtochar(13) with numtochar(92) & numtochar 
> (114) in pString --> carriage return to \r
>             replace numtochar(9) with numtochar(92) & numtochar 
> (116) in pString --> tab to \t
>             replace numtochar(8) with numtochar(92) & numtochar(98)  
> in pString --> backspace to \b
>             break
>         case "postgresql"
>             replace numtochar(92) with numtochar(92) & numtochar 
> (92) in pString --> \ to \\
>                     replace numtochar(39) with numtochar(39) &  
> numtochar(39) in pString --> ' to ''
>             replace numtochar(12) with numtochar(92) & numtochar 
> (102) in pString --> formfeed to \f
>             replace numtochar(10) with numtochar(92) & numtochar 
> (110) in pString --> newline to \n
>             replace numtochar(13) with numtochar(92) & numtochar 
> (114) in pString --> carriage return to \r
>             replace numtochar(9) with numtochar(92) & numtochar 
> (116) in pString --> tab to \t
>             replace numtochar(8) with numtochar(92) & numtochar(98)  
> in pString --> backspace to \b
>             break
>         case "sqlite"
>         default
>             replace numtochar(39) with numtochar(39) & numtochar 
> (39) in pString --> ' to ''
>             break
>     end SWITCH
> end _escapeStringByRef
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list