sql update statement

Jim Ault JimAultWins at yahoo.com
Sun Oct 1 03:33:39 EDT 2006


After thought about the storage of replaced apostrophes....
You might need to put a line of code to reverse this after retrieving from
the database, in case the   apostrophe (single quote)   is important

replace numtochar(96) with "'" in sqlOutputString

Jim Ault
Las Vegas

On 10/1/06 12:18 AM, "Jim Ault" <JimAultWins at yahoo.com> wrote:

> A quick technique I use to accumulate text lines in a long string and still
> make it readable is to do the following (starting with your SQL example)
> 
>> 2srd3 = '"& fld "2srd3" &"',
>> 2srd4 = '"& fld "2srd4" &"',
>> 2srd5 = '"& fld "2srd5" &"',
>> srideht = '"& fld "srideht" &"',
>> smisccomment = '"& fld "smisccomment" &"',
> 
> put "'" into p  --this makes the ' easier to see in code
> get "2srd3 = " &p& fld 2srd3 &p
> get it & ",2srd4 = " &p& fld 2srd4 &p
> get it & ",2srd5 = " &p& fld 2srd5 &p
> get it & ",2srd5 = " &p& fld 2srd5 &p
> get it & ", srideht = " &p& fld srideht &p
> get it & ", smisccomment = " &p& fld smisccomment &p
> put it into updateColValListOf123Pairs
> 
> An advantage to doing this technique is that you can step along in the
> debugger and check for errors as the parts are concatenating.
> 
> There are several other more elaborate ways, but this should get you where
> you want to go.
> 
> Further note.. I see a label ' smisccomment ' which may be a user input
> item, and you need to watch for apostrophes there... such as don't, won't,
> can't, the Thomas' garden party... since these could produce a syntax error.
> 
> one way to do this is to convert to a
> numtochar(96) = it is the key just to the left of the '1' key
>  or 
> numtochar(250) = opt-h on the Mac
> and do the folowing line
> replace "'" with numtochar(250) in fld smisccomment
> 
> --Or use the following version of the above -----------------
> --temporarily use the  [opt-j on the Mac] and build the string
> get "2srd3 =" & fld 2srd3
> get it & ",2srd4 =" & fld 2srd4
> get it & ",2srd5 =" & fld 2srd5
> get it & ",2srd5 =" & fld 2srd5
> get it & ", srideht =" & fld srideht
> get it & ", smisccomment =" & fld smisccomment
> put it  & "" into updateColValListOf123Pairs
> --now do a little cleanup
> replace "'" with numtochar(96) in updateColValListOf123Pairs
> --all maverick apostrophes have been converted to `
> replace "" with "'" in updateColValListOf123Pairs
> --now apostrophes only happen in the right places
> 
> 
> Hope this helps.
> 
> Jim Ault
> Las Vegas
> 
> On 9/30/06 6:37 PM, "Robert Mann" <robmann at gp-racing.com> wrote:
> 
>> I have a sql update statement that has several hundred items in it, is it
>> possible to leave it in list format like this
>> 
>> 2srd3 = '"& fld "2srd3" &"',
>> 2srd4 = '"& fld "2srd4" &"',
>> 2srd5 = '"& fld "2srd5" &"',
>> srideht = '"& fld "srideht" &"',
>> smisccomment = '"& fld "smisccomment" &"',
>> 
>> and not like this
>> 
>>  2srd3 = '"& fld "2srd3" &"', 2srd4 = '"& fld "2srd4" &"', 2srd5 = '"& fld
>> "2srd5" &"', srideht = '"& fld "srideht" &"', smisccomment = '"& fld
>> "smisccomment" &"',
>> 
>> why you might ask do I want to do this, well once I get out quit a ways on
>> one line rev seems to not like it and starts to give me problems run slow,
>> and not want to copy and paste
>> 
>> I tried the above list format but it does not like the returns after each
>> comma, what can I do to correct this?
>> 
>> Robert Mann
>> 
>> 
>> _______________________________________________
>> 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
> 
> 
> _______________________________________________
> 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