I'm loading data into a MySQL database. It is a shared calendar that is used with the baikal calendar.
I dumped the DB, and vim checked it and I can see recent events.
When I load the data into MySQL I lose most of the events.
I can see the data has a lot of lines ending in a character sequence:
\r\n
For example:
BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Apple Inc.//Mac OS X 10.12.2//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VTIMEZONE\r\nTZID:America/Toronto\r\nBEGIN:DAYLIGHT\r\nTZOFFSETFROM:-0500\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nDTSTART:20070311T020000\r\nTZNAME:EDT\r\nTZOFFSETTO:-0400\r\nEND:DAYLIGHT\r\nBEGIN:STANDARD\r\nTZOFFSETFROM:-0400\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nDTSTART:20071104T020000\r\nTZNAME:EST\r\nTZOFFSETTO:-0500\r\nEND:STANDARD\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nCREATED:20161206T015502Z\r\nUID:94FA4491-C68F-4751-B14B-A5E7B4B0370E\r\nDTEND;TZID=America/Toronto:20161209T080000\r\nTRANSP:OPAQUE\r\nX-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC\r\nSUMMARY:new caldav\r\nDTSTART;TZID=America/Toronto:20161209T070000\r\nDTSTAMP:20161206T015502Z\r\nSEQUENCE:0\r\nDESCRIPTION:some notes\\n\r\nBEGIN:VALARM\r\nX-WR-ALARMUID:2C8FDA92-BFB4-4295-86AB-2AE3E09D42A2\r\nUID:2C8FDA92-BFB4-4295-86AB-2AE3E09D42A2\r\nTRIGGER:-PT15M\r\nX-APPLE-DEFAULT-ALARM:TRUE\r\nATTACH;VALUE=URI:Basso\r\nACTION:AUDIO\r\nEND:VALARM\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n','94FA4491-C68F-4751-B14B-A5E7B4B0370E.ics',1,1485446304,'2dc6a43af5125cc1cdcb668ea61cc505',981,'VEVENT',1481284800,1481288400,'94FA4491-C68F-4751-B14B-A5E7B4B0370E'
I know I need to escape these characters when reading the below, but its new to me and I do not fully understand how I should do:
mysql -uroot -p cal < cal.sql
https://www.oreilly.com/library/view/mysql-cookbook/0596001452/ch10s05.html
Could someone kindly give me and example of how I should escape these characters? They will need to be preserved for the database.
I have t escape this
why? I don't think anyone 'escapes' this data. It's easier to properly handle new lines.