[Gambas-user] MySQL query problems with apostropies
Keith Clark
keithclark at ...2185...
Wed Apr 7 22:58:36 CEST 2010
On Wed, 2010-04-07 at 21:55 +0200, Fabien Bodard wrote:
> 2010/4/7 Keith Clark <keithclark at ...2185...>:
> > On Wed, 2010-04-07 at 14:40 -0500, nando wrote:
> >> Replace will work for quote and backslash
> >> For double quote:
> >>
> >> doublequote$ is chr$(34)
> >> Replace$(mystring, chr$(34), "\" & chr$(34)
> >>
> >> But, Benoit had an email of the nice solution.
> >> -Fernando
> >
> > I did not understand that solution either.
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Download Intel® Parallel Studio Eval
> > Try the new software tools for yourself. Speed compiling, find bugs
> > proactively, and fine-tune applications for parallel performance.
> > See why Intel Parallel Studio got high marks during beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> did you understand how subst() function work ijn gambas ??
>
> mystring = subst("this is my &1 &2", "black", "dog")
>
> print mystring give :
>
> this my black dog
>
> &1 and &2 are replaced by subst param
>
> for the sql queries it work at the same ... but with an automatic escaping.
> so the argument are corrected in backgroud by an excape function.
>
>
> hresult = db.exec("select &1 From &2 where titi=&3", "titi", "tititable", 1)
>
Ok, I finally got it now!!!!!
Whew, that one took awhile to sink in!
Thanks everyone for your help.
Keith
More information about the User
mailing list