multi line Livecode field uploaded to MySQL

Tim Selander selander at tkf.att.ne.jp
Sat Feb 16 03:17:23 EST 2019


Thank you for your reply, but I haven't gotten it working yet.

The code in my first post was from my working stack. Here is what 
I have from my non-working stack after re-writing to follow your 
instructions:
------------
# Construct SQL
  put "INSERT INTO 
contactInfo(key,organization,denomination,address,category,tel,fax,email,access,founded,staff,servicetime,web,character)" 
& \
" VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)" into tSQL
# Execute SQL
revExecuteSQL(gconnection,tSQL,vkey,vorg,vdenom,vadd,vcategory,vtel,vfax,vemail,vaccess,vfounded,vstaff,vtime,vweb,vcat) 

put the result into tTmp
------------

The table name is "contactInfo" and the list of the table's 
fields is in the paranthesis.

The VALUES(:1,:2....  syntax is something I haven't seen before. 
I assume that you need as many numbers as you have fields?

You say to use variables, and I am assuming in the 
"revExecuteSQL" line. Is that correct? I tried the list of 
variables both with the quotes you used, and without just to see. 
I also tried replacing the revExecuteSQL comman with 
revdb_execute. Both result in this error: {execution error at 
line n/a (External handler execution error: revdberr,syntax 
error) near "revdberr,syntax error"}

I appreciate your taking the time to educate me.

Tim Selander




On 2019.02.16 16:12, Ludovic THEBAULT via use-livecode wrote:
>
>> Le 16 févr. 2019 à 07:59, Tim Selander via use-livecode <use-livecode at lists.runrev.com> a écrit :
>>
>> I have a routine to take data from fields on a card and upload to a mysql database. Has worked well for years, got the original script off the Livecode learning site.
>> -------
>>       # Construct SQL
>>       put "INSERT INTO podcast(IP,accesstime,access_date,pgm_name,access_code,bytes,agent,city,region,country)" & \
>>        " VALUES(" & tRowData & ")" into tSQL
>>        # Execute SQL
>>        put revdb_execute(gconnection,tSQL) into tTmp
>>
>>        if the result is not 1 then
>>          put the result && tSQL & return after message
>>       end if
>> ---------
>>
>> tRowData has the data from the card fields, comma delimited.
>>
>> Now, I'm needing to upload fields with multiple lines. But the returns in the data mess it up. Tried enclosing the field data in quotes, like .csv files, but that didn't work either.
>>
>> MySQL can handle multi-line text fields.... so how do I upload them from LC? Any hints greatly appreciated.
>>
>
> Hello,
>
> use this syntax :
>
>   put "INSERT INTO podcast(IP,accesstime,access_date,pgm_name,access_code,bytes,agent,city,region,country)" & \
>        " VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9)" into tSQL
>        # Execute SQL
>        revExecuteSQL gconnection,tSQL,"IP","accesstime","access_date","pgm_name","access_code","bytes","agent","city","region », "country »)
> 	put the result into tTmp
>
> // where IP, accesstime… are variables
>
> Ludovic
>
> _______________________________________________
> 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
>





More information about the use-livecode mailing list