database write error
Pete
pete at mollysrevenge.com
Tue Jan 31 16:02:22 EST 2012
You're right, it would mess things up - sorry, didn't look closely enough
at your code. The only way you could do it would be to use LC's quote
constant but that would make setting up the merge command a horrendous
mess!
To be honest though, I usually just build the VALUES part of the SQL
command manually rather than using merge, just because of these
complications. I've got a standard handler that takes a variable number of
parameters (the raw values you want in the VALUES clause), puts single
quotes around non-numeric values and escapes any single quotes that might
be in there, then returns the VALUES clause, so I just have to:
put buildValuesClause(globaldate,tmaternalname,tmaternalphin,<etc>) after
tSQL
I put that together before I knew revexecuteSQL substitution deals with
all that and more but it kinda works for me.
Pete
On Tue, Jan 31, 2012 at 12:22 PM, Mark Smith <Mark_Smith at cpe.umanitoba.ca>wrote:
>
> Peter Haworth-2 wrote
> >
> > If you use single quotes, double quotes don't need to be escaped in the
> > literal, and vice versa. So, if you're sure that your data won't contain
> > double quotes, then you can use double quotes to enclose the literals and
> > single quotes won't cause a problem.
> >
> > Pete
> >
>
> Thanks for the suggestion Pete. I was going to try that but the relevant
> code section reads as follows
> merge("VALUES ('[[globaldate]]', '[[tmaternalname]]', '[[tmaternalphin]]',
> '[[tmaternalmhsc]]', '[[tmaternaldob]]', '[[tmaternalage]]',
> '[[tmaternalpc]]', '[[tmaternaled]]'," & \
> "'[[tmaternalocc]]', '[[tmaternalage]]', '[[tsite]]',
> '[[tmaternalchart]]', '[[tcareprovider1]]', '[[tcareprovider2]]',
> '[[tcareprovider3]]', '[[tnote]]')") into tCmd
>
> Wouldn't replacing the single quotes with double quotes mess up the merge
> command (ie. it would not know where the string beings/ends??) Or can you
> replace the "outer" quotes with single quotes as well?
>
> -- Mark
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/database-write-error-tp4343759p4345754.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
>
>
--
Pete
Molly's Revenge <http://www.mollysrevenge.com>
More information about the use-livecode
mailing list