database write error
bdrunrev at gmail.com
Wed Feb 1 04:33:57 CST 2012
Perhaps I am misunderstanding the problem here. I am a great fan of
the concept of merge. And it is certainly possible to use merge() to
produce the list of fields with each field value enclosed by either
single or double quotes. It just requires a litte indirection.
(I've put some arbitrary values into the first 2 variables in your list).
put "globaldate tmaternalname tmaternalphin tmaternalphin
tmaternalmhsc tmaternaldob" & \
"tmaternalage tmaternalpc tmaternaled tmaternalocc
tmaternalage tsite tmaternalchart" & \
"tcareprovider1 tcareprovider2 tcareprovider3 tnote" into tColumnWords
put "women's" into globaldate
put "and she said" && quote & "Hi!" & quote into tmaternalname
repeat for each word tCol in tColumnWords
--put "[[quote &" & tCol & " & quote]]," after tColItems
put "[[' &" & tCol & " & ']]," after tColItems
delete char -1 of tColItems
put "Values(" & tColItems & ")" into tStatement
I hope that helps.
On Tue, Jan 31, 2012 at 8: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.
> 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:
More information about the use-livecode