SQL Insert Syntax

Mike Kerner MikeKerner at roadrunner.com
Fri Jan 5 16:57:28 EST 2018


the only problem is your quoted column names.

On Fri, Jan 5, 2018 at 4:38 PM, Devin Asay via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Bob,
>
> You could try parameterizing your statements as described in the
> dictionary. Also, you don’t want to quote your column names.
>
> put 0,43,500,543 into tRect
> put “image “ & quote & “fresh_now.png” & quote into tObj
> put “card “ & quote & “Main” & quote into tCard
> put false into tVis
> revExecuteSQL myID, "insert into arraydata (rect,controlname,owner,visible)
> values(:1,:2,:3,:4)", “tRect" ,”tObj”,”tCard”, “tVis”
>
> This is also best practice, because it protects against SQL injection
> attacks. (Admittedly more of a concern with network databases.)
>
> HTH
>
> Devin
>
>
> > On Jan 5, 2018, at 2:24 PM, Bob Sneidar via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Possibly, but every sqLite reference I've looked at seems to indicate
> that I should enclose string values with single quotes, and since my text
> contains double quotes, I thought that would do the trick. I have tried
> escaling quotes ie. \" but that doesn't work either.
> >
> > This BTW is why I use sqlYoga, so I don't have to deal with this syntax
> crap, but I am writing a function that I want to be universally viable.
> >
> > Bob S
> >
> >
> >> On Jan 5, 2018, at 13:18 , Devin Asay via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >>
> >> Bob,
> >>
> >> Some SQL dialects accept both single and double quotes as string
> delimiters. Might that be the problem?
> >>
> >> Devin
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> Devin Asay
> Director
> Office of Digital Humanities
> Brigham Young University
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list