multi line Livecode field uploaded to MySQL

Ludovic THEBAULT ludovic.thebault at laposte.net
Sat Feb 16 02:12:40 EST 2019


> 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




More information about the Use-livecode mailing list