Hello, i'm having trouble with Rmysql.
Here is my line of code which is not working, i want to send this request, annee_court is just a variable :
sql=paste0("REPLACE INTO TABLE donstat_fr.com_insee_revenus",annee_court,"_s CHARACTER SET 'latin1' FIELDS ESCAPED BY '\' TERMINATED BY '\t' LINES TERMINATED BY '\r\n' IGNORE 1 LINES")
When i do dbExecute or dbquery etc..., the problem is that '\r\n' and '\t' is acting like my request be :
REPLACE INTO TABLE donstat_fr.com_insee_revenus",annee_court,"_s CHARACTER SET 'latin1' FIELDS ESCAPED BY '\' TERMINATED BY ' ' LINES TERMINATED BY '
' IGNORE 1 LINES
paste0("REPLACE INTO TABLE donstat_fr.com_insee_revenus",annee_court,"_s CHARACTER SET 'latin1' FIELDS ESCAPED BY '\' TERMINATED BY '\\t' LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES")
\t, \r, and \n might be removed since \ is an escape character, so \\ will un-escape the escape.
Just a little presition, \\ will not un-escape the escape, it is going to escape the control characters (i.e. \n : line feed, \r : carriage return and \t : horizontal tabulation).