SHOW VARIABLES LIKE "%CHAR%";
CREATE DATABASE IF NOT EXISTS test;
USE test;

CREATE OR REPLACE TABLE table_coupon_varchar (
  coupon_no varchar(10) NOT NULL DEFAULT '',
  memo varchar(30) DEFAULT NULL,
  discount double DEFAULT NULL,
  PRIMARY KEY (coupon_no)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO table_coupon_varchar VALUES ("4","abc'def",250),("5","abc'def",250),("6","gh\\ij",200),("7","gh\\ij",200);
SELECT * FROM table_coupon_varchar;

CREATE OR REPLACE TABLE maria_table_coupon_varchar
ENGINE=CONNECT DEFAULT CHARSET=utf8 TABLE_TYPE='MYSQL' TABNAME='table_coupon_varchar' DBNAME='test' OPTION_LIST='user=root,host=10.0.1.36';
SELECT * FROM maria_table_coupon_varchar;

INSERT INTO maria_table_coupon_varchar SELECT coupon_no, memo, discount FROM table_coupon_varchar WHERE coupon_no = "4";
SELECT * FROM maria_table_coupon_varchar;

INSERT INTO maria_table_coupon_varchar SELECT coupon_no,  REPLACE( memo, "'", "''"), discount FROM table_coupon_varchar WHERE coupon_no = "5";
SELECT * FROM maria_table_coupon_varchar;

INSERT INTO maria_table_coupon_varchar SELECT coupon_no, memo, discount FROM table_coupon_varchar WHERE coupon_no = "6";
SELECT * FROM maria_table_coupon_varchar;

INSERT INTO maria_table_coupon_varchar SELECT coupon_no, REPLACE( memo, "\\", "\\\\"), discount FROM table_coupon_varchar WHERE coupon_no = "7";
SELECT * FROM maria_table_coupon_varchar;
