mysql只插入字符串值

时间:2016-09-26 13:03:14

标签: mysql sql mariadb

MySql(MariaDB)仅在TEXT字段中插入字符串文件内容的一部分。

52年5月5日 - MariaDB的-lubuntu0.14.04.1

文件内容:

1,"NODAÏA 01",0.00,1,0,0,0,1,0,0
2,"NODAÏA 02",0.00,1,0,0,0,1,0,0
3,"NODAÏA 03",0.00,1,0,0,0,1,0,0
....

仅限MySQL插入:

1, "NODA

在这个领域没有更多。

剪切此符号的位置:Ï

为什么吗

Laravel将完整的文件内容发送到mysql。

Mysql查询日志。:

  

93执行插入tracking_parsed_datacash_register_id,   api_idcommand_iddata_typereport_timestamp_first,   report_timestamp_lastreceived_dataparsed_dataupdated_at,   created_at)值('1356','0','0','1','20160919140001',NULL,   '1,\“NODAÏA01\”,0.00,1,0,0,0,1,0,0 \ r \ n2,\“NODAÏA   02 \ “0.00,1,0,0,0,1,0,0 \ r \ N3,\” NODAÏA   03 \ “0.00,1,0,0,0,1,0,0 \ r \ N4,\” NODAÏA   04 \ “0.00,1,0,0,0,1,0,0 \ r \ N5,\” NODAÏA   05 \ “0.00,1,0,0,0,1,0,0 \ r \ N6,\” NODAÏA   06 \ “0.00,1,0,0,0,1,0,0 \ r \ N7,\” NODAÏA   07 \ “0.00,1,0,0,0,1,0,0 \ r \ n8,\” NODAÏA   08 \ “0.00,1,0,0,0,1,0,0 \ r \ N9,\” NODAÏA   09 \ “0.00,1,0,0,0,1,0,0 \ r \ N10 \” NODAÏA   10 \ “0.00,1,0,0,0,1,0,0 \ r \ N11,\” NODAÏA   11 \ “0.00,1,0,0,0,1,0,0 \ r \ N12 \” NODAÏA   12 \ “0.00,1,0,0,0,1,0,0 \ r \ N13,\” NODAÏA   13 \ “0.00,1,0,0,0,1,0,0 \ r \ N14 \” NODAÏA   14 \ “0.00,1,0,0,0,1,0,0 \ r \ N15,\” NODAÏA   15 \ “0.00,1,0,0,0,1,0,0 \ r \ N16 \” NODAÏA   16 \ “0.00,1,0,0,0,1,0,0 \ r \ N17 \” NODAÏA   17 \ “0.00,1,0,0,0,1,0,0 \ r \ N18 \” NODAÏA   18 \ “0.00,1,0,0,0,1,0,0 \ r \ N19,\” NODAÏA   19 \ “0.00,1,0,0,0,1,0,0 \ r \ N20 \” NODAÏA   20 \ “0.00,1,0,0,0,1,0,0 \ r \ N21 \” NODAÏA   21 \ “0.00,1,0,0,0,1,0,0 \ r \ N22 \” NODAÏA   22 \ “0.00,1,0,0,0,1,0,0 \ r \ N23,\” NODAÏA   23 \ “0.00,1,0,0,0,1,0,0 \ r \ N24 \” NODAÏA   24 \ “0.00,1,0,0,0,1,0,0 \ r \ N25 \” NODAÏA   25 \ “0.00,1,0,0,0,1,0,0 \ r \ N26 \” NODAÏA   26 \ “0.00,1,0,0,0,1,0,0 \ r \ N27 \” NODAÏA   27 \ “0.00,1,0,0,0,1,0,0 \ r \ N28 \” NODAÏA   28 \ “0.00,1,0,0,0,1,0,0 \ r \ N29,\” NODAÏA   29 \ “0.00,1,0,0,0,1,0,0 \ r \ N30 \” NODAÏA   30 \ “0.00,1,0,0,0,1,0,0 \ r \ N31,\” NODAÏA   31 \ “0.00,1,0,0,0,1,0,0 \ r \ N32,\” NODAÏA   32 \ “0.00,1,0,0,0,1,0,0 \ r \ N33,\” NODAÏA   33 \ “0.00,1,0,0,0,1,0,0 \ r \ N34,\” NODAÏA   34 \ “0.00,1,0,0,0,1,0,0 \ r \ N35,\” NODAÏA   35 \ “0.00,1,0,0,0,1,0,0 \ r \ N36,\” NODAÏA   36 \ “0.00,1,0,0,0,1,0,0 \ r \ N37,\” NODAÏA   37 \ “0.00,1,0,0,0,1,0,0 \ r \ N38,\” NODAÏA   38 \ “0.00,1,0,0,0,1,0,0 \ r \ N39,\” NODAÏA   39 \ “0.00,1,0,0,0,1,0,0 \ r \ N40 \” NODAÏA   40 \ “0.00,1,0,0,0,1,0,0 \ r \ N41,\” NODAÏA   41 \ “0.00,1,0,0,0,1,0,0 \ r \ N42,\” NODAÏA   42 \ “0.00,1,0,0,0,1,0,0 \ r \ N43,\” NODAÏA   43 \ “0.00,1,0,0,0,1,0,0 \ r \ N44,\” NODAÏA   44 \ “0.00,1,0,0,0,1,0,0 \ r \ N45,\” NODAÏA   45 \ “0.00,1,0,0,0,1,0,0 \ r \ N46,\” NODAÏA   46 \ “0.00,1,0,0,0,1,0,0 \ r \ N47,\” NODAÏA   47 \ “0.00,1,0,0,0,1,0,0 \ r \ N48 \” NODAÏA   48 \ “0.00,1,0,0,0,1,0,0 \ r \ N49,\” NODAÏA   49 \“,0.00,1,0,0,0,1,0,0 \ r \ n50,\”NODAÏA50\“,0.00,1,0,0,0,1,0,0 \ r \ n ”,   NULL,'2016-09-26 15:46:09','2016-09-26 15:46:09')

如果我这个插入查询运行i mysql workbench,一切正常。

1 个答案:

答案 0 :(得分:0)

由于我有一个比较不同记录的密钥,所以我做了以下。

$fileContent = mb_convert_encoding($fileContent, 'UTF-8', 'UTF-8');

现在 - >

1,"NODA?A 01",0.00,1,0,0,0,1,0,0
2,"NODA?A 02",0.00,1,0,0,0,1,0,0
3,"NODA?A 03",0.00,1,0,0,0,1,0,0
...

用这个我可以工作。现在。