Bug #12688 Error with Access escape sequence
Submitted: 19 Aug 2005 19:31 Modified: 30 Aug 2005 21:17
Reporter: Jesse Fulton Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Migration Toolkit Severity:S3 (Non-critical)
Version:1.013 OS:Windows (Windows XP Professional)
Assigned to: MySQL Verification Team CPU Architecture:Any

[19 Aug 2005 19:31] Jesse Fulton
Description:
Not sure if this is a MySQL bug, or a Migration ToolKit bug...

I'm migrating an Access 2000 database to MySQL and the Migration Toolkit works great.  However, there is one record in the access database which will not be inserted and causes the rest of the insert statements to not be executed.

The access column is of type "memo" and this is the text that is causing the problems:
*********************************
Try this:

<pre id=code><font face=courier size=2 id=code>
#include "windows.h"

int WINAPI WinMain(HINSTANCE hInstance,
		   HINSTANCE hPrevInstance,
		   LPTSTR    lpCmdLine,
		   int       nCmdShow)
{
	ULARGE_INTEGER	uliFree;
	ULARGE_INTEGER	uliTotal;
	MEMORYSTATUS	msMemory;

	RETAILMSG(TRUE, (_T("------ ADS System Resource Report ------\r\n")));

	GetDiskFreeSpaceEx(_T("\\FlashFX Disk"), &uliFree, &uliTotal, NULL);
	RETAILMSG(TRUE, (_T("FlashFX Disk:\r\n")));
	RETAILMSG(TRUE, (_T("  Size:      %i bytes\r\n"), uliTotal));
	RETAILMSG(TRUE, (_T("  Available: %i bytes\r\n\n"), uliFree));
	
	msMemory.dwLength = sizeof(MEMORYSTATUS);
	GlobalMemoryStatus(&msMemory);
	RETAILMSG(TRUE, (_T("RAM:\r\n")));
	RETAILMSG(TRUE, (_T("  Total Physical: %i bytes\r\n"), msMemory.dwTotalPhys));
	RETAILMSG(TRUE, (_T("  Avail Physical: %i bytes\r\n"), msMemory.dwAvailPhys));
	RETAILMSG(TRUE, (_T("  Total Virtual:  %i bytes\r\n"), msMemory.dwTotalVirtual));
	RETAILMSG(TRUE, (_T("  Avail Virtual:  %i bytes\r\n"), msMemory.dwAvailVirtual));
	RETAILMSG(TRUE, (_T("  Current load:   %i%%\r\n"), msMemory.dwMemoryLoad));

	RETAILMSG(TRUE, (_T("----------------------------------------\r\n\n")));

	return 0;
}</font id=code></pre id=code>

*********************************************

this is the same string generated for insert by the migration toolkit:
***************************************************
"Try this:\r\n\r\n<pre id=code><font face=courier size=2 id=code>\r\n#include \"windows.h\"\r\n\r\nint WINAPI WinMain(HINSTANCE hInstance,\r\n		   HINSTANCE hPrevInstance,\r\n		   LPTSTR    lpCmdLine,\r\n		   int       nCmdShow)\r\n{\r\n	ULARGE_INTEGER	uliFree;\r\n	ULARGE_INTEGER	uliTotal;\r\n	MEMORYSTATUS	msMemory;\r\n\r\n	RETAILMSG(TRUE, (_T(\"------ ADS System Resource Report ------\\r\\n\")));\r\n\r\n	GetDiskFreeSpaceEx(_T(\"\\\\FlashFX Disk\"), &uliFree, &uliTotal, NULL);\r\n	RETAILMSG(TRUE, (_T(\"FlashFX Disk:\\r\\n\")));\r\n	RETAILMSG(TRUE, (_T(\"  Size:      %i bytes\\r\\n\"), uliTotal));\r\n	RETAILMSG(TRUE, (_T(\"  Available: %i bytes\\r\\n\\n\"), uliFree));\r\n	\r\n	msMemory.dwLength = sizeof(MEMORYSTATUS);\r\n	GlobalMemoryStatus(&msMemory);\r\n	RETAILMSG(TRUE, (_T(\"RAM:\\r\\n\")));\r\n	RETAILMSG(TRUE, (_T(\"  Total Physical: %i bytes\\r\\n\"), msMemory.dwTotalPhys));\r\n	RETAILMSG(TRUE, (_T(\"  Avail Physical: %i bytes\\r\\n\"), msMemory.dwAvailPhys));\r\n	RETAILMSG(TRUE, (_T(\"  Total Virtual:  %i bytes\\r\\n\"), msMemory.dwTotalVirtual));\r\n	RETAILMSG(TRUE, (_T(\"  Avail Virtual:  %i bytes\\r\\n\"), msMemory.dwAvailVirtual));\r\n	RETAILMSG(TRUE, (_T(\"  Current load:   %i%%\\r\\n\"), msMemory.dwMemoryLoad));\r\n\r\n	RETAILMSG(TRUE, (_T(\"----------------------------------------\\r\\n\\n\")));\r\n\r\n	return 0;\r\n}</font id=code></pre id=code>\r\n\r\n-----------------\r\n
*********************

After "successful" migration I get this warning on the migration report under Data Bulk Transfer for the table:

Not a valid escape sequence: {\r\n	ULARGE_INTEGER	uliFree;\r\n ...
.....

followed by the rest of the records being entered.

How to repeat:
Not sure, I'm assuming use a large memo field in access and try to import it.

Suggested fix:
I generate the create and insert sql queries and then change the text in the problematic row to "temporarily unavailable."  Then I can go into MySQL and drop the migrated database and run the sql scripts to recreate the tables with no problems.  Now I just to an UPDATE to get the original text back into the troubled record.  I don't use the text from the insert.sql file with the escape characters, I must use a plain text format copy:

mysql> update table set column = 'Try this:
    '>
    '> <pre id=code><font face=courier size=2 id=code>
    '> #include "windows.h"
    '>
    '> int WINAPI WinMain(HINSTANCE hInstance,
    '>             HINSTANCE hPrevInstance,
    '>             LPTSTR    lpCmdLine,
    '>             int       nCmdShow)
    '> {
    '>  ULARGE_INTEGER  uliFree;
    '>  ULARGE_INTEGER  uliTotal;
    '>  MEMORYSTATUS    msMemory;
    '>
    '>  RETAILMSG(TRUE, (_T("------ ADS System Resource Report ------\r\n")));
    '>
......
[29 Aug 2005 13:00] MySQL Verification Team
Could you please provide an MDB file for test case.
You can upload it into a zipped file naming it with this bug report at:

ftp://ftp.mysql.com/pub/mysql/upload

Thanks in advance.
[30 Aug 2005 21:17] MySQL Verification Team
I was unable to repeat with MMT 1.0.15 rc:
--------------------------------------------------------------------------------
-- MySQL Migration Toolkit Report                                             --
--                                                                            --
-- Title:   Summary Of The Migration Process                                  --
-- Date:    2005-08-30 18:09                                                  --
--------------------------------------------------------------------------------

1. Schema Migration
-------------------

  Number of migrated schemata: 1

  Schema Name:            bug12688
  - Tables:               1
  - Views:                0
  - Routines:             0
  - Structured Types:     0

  Details:

  - Tables
      `bug12688`.`testbug`
      --------------------
  - Views
  - Routines
  - Structured Types

2. Data Bulk Transfer
---------------------

      `bug12688`.`testbug`
      --------------------
          5 row(s) transfered.

End of report.
--------------------------------------------------------------------------------

c:\mysql\bin>mysql -uroot bug12688
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11 to server version: 5.0.12-beta-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show create table testbug\G
*************************** 1. row ***************************
       Table: testbug
Create Table: CREATE TABLE `testbug` (
  `id` int(10) NOT NULL auto_increment,
  `thememo` longtext,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> select thememo from testbug where id =5\G
*************************** 1. row ***************************
thememo: <pre id=code><font face=courier size=2 id=code>
#include "windows.h"

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
        ULARGE_INTEGER  uliFree;
        ULARGE_INTEGER  uliTotal;
        MEMORYSTATUS    msMemory;

        RETAILMSG(TRUE, (_T("------ ADS System Resource Report ------\r\n")));

        GetDiskFreeSpaceEx(_T("\\FlashFX Disk"), &uliFree, &uliTotal, NULL);
        RETAILMSG(TRUE, (_T("FlashFX Disk:\r\n")));
        RETAILMSG(TRUE, (_T("  Size:      %i bytes\r\n"), uliTotal));
        RETAILMSG(TRUE, (_T("  Available: %i bytes\r\n\n"), uliFree));

        msMemory.dwLength = sizeof(MEMORYSTATUS);
        GlobalMemoryStatus(&msMemory);
        RETAILMSG(TRUE, (_T("RAM:\r\n")));
        RETAILMSG(TRUE, (_T("  Total Physical: %i bytes\r\n"), msMemory.dwTotalPhys));
        RETAILMSG(TRUE, (_T("  Avail Physical: %i bytes\r\n"), msMemory.dwAvailPhys));
        RETAILMSG(TRUE, (_T("  Total Virtual:  %i bytes\r\n"),
msMemory.dwTotalVirtual));
        RETAILMSG(TRUE, (_T("  Avail Virtual:  %i bytes\r\n"),
msMemory.dwAvailVirtual));
        RETAILMSG(TRUE, (_T("  Current load:   %i%%\r\n"), msMemory.dwMemoryLoad));

        RETAILMSG(TRUE, (_T("----------------------------------------\r\n\n")));

        return 0;
}</font id=code></pre id=code>
1 row in set (0.00 sec)

mysql>
[24 Sep 2005 14:35] Jeff Brown
I have a similar problem.  I've narrowed the offending character to: {