@@ -92,12 +92,24 @@ bool CDBModule_MQData::DBModule_MQData_Insert(XENGINE_DBMESSAGEQUEUE* pSt_DBInfo
9292 DBModule_IsErrorOccur = true ;
9393 DBModule_dwErrorCode = ERROR_XENGINE_MQCORE_DATABASE_PARAMENT;
9494 return false ;
95- }
96- XCHAR tszSQLStatement[10240 ];
95+ }
96+ XCHAR tszSQLStatement[10240 ];
97+ XCHAR tszSQLCoder[8192 ];
98+
9799 memset (tszSQLStatement, ' \0 ' , sizeof (tszSQLStatement));
100+ memset (tszSQLCoder, ' \0 ' , sizeof (tszSQLCoder));
101+
102+ DataBase_MySQL_Coder (xhDBSQL, pSt_DBInfo->tszMsgBuffer , tszSQLCoder, &pSt_DBInfo->nMsgLen );
103+ __int64u nRet = _xstprintf (tszSQLStatement, _X (" INSERT INTO `%s` (tszUserName,tszQueueName,nQueueSerial,nQueueGetTime,tszQueueLeftTime,tszQueuePublishTime,tszQueueData,nDataLen,nDataType,tszQueueCreateTime) VALUES('%s','%s',%lld,%lld,'%s','%s','" ), pSt_DBInfo->tszQueueName , pSt_DBInfo->tszUserName , pSt_DBInfo->tszQueueName , pSt_DBInfo->nQueueSerial , pSt_DBInfo->nQueueGetTime , pSt_DBInfo->tszQueueLeftTime , pSt_DBInfo->tszQueuePublishTime );
104+ memcpy (tszSQLStatement + nRet, tszSQLCoder, pSt_DBInfo->nMsgLen );
105+ nRet += pSt_DBInfo->nMsgLen ;
106+
107+ memset (tszSQLCoder, ' \0 ' , sizeof (tszSQLCoder));
108+ int nLen = _xstprintf (tszSQLCoder, _X (" ',%d,%d,now())" ), pSt_DBInfo->nMsgLen , pSt_DBInfo->byMsgType );
109+ memcpy (tszSQLStatement + nRet, tszSQLCoder, nLen);
110+ nRet += nLen;
98111
99- _xstprintf (tszSQLStatement, _X (" INSERT INTO `%s` (tszUserName,tszQueueName,nQueueSerial,nQueueGetTime,tszQueueLeftTime,tszQueuePublishTime,tszQueueData,nDataLen,nDataType,tszQueueCreateTime) VALUES('%s','%s',%lld,%lld,'%s','%s','%s',%d,%d,now())" ), pSt_DBInfo->tszQueueName , pSt_DBInfo->tszUserName , pSt_DBInfo->tszQueueName , pSt_DBInfo->nQueueSerial , pSt_DBInfo->nQueueGetTime , pSt_DBInfo->tszQueueLeftTime , pSt_DBInfo->tszQueuePublishTime , pSt_DBInfo->tszMsgBuffer , pSt_DBInfo->nMsgLen , pSt_DBInfo->byMsgType );
100- if (!DataBase_MySQL_Execute (xhDBSQL, tszSQLStatement))
112+ if (!DataBase_MySQL_Execute (xhDBSQL, tszSQLStatement, &nRet))
101113 {
102114 DBModule_IsErrorOccur = true ;
103115 DBModule_dwErrorCode = DataBase_GetLastError ();
@@ -150,6 +162,7 @@ bool CDBModule_MQData::DBModule_MQData_Query(XENGINE_DBMESSAGEQUEUE* pSt_DBInfo)
150162 return false ;
151163 }
152164 XCHAR** pptszResult = DataBase_MySQL_GetResult (xhDBSQL, xhTable);
165+ XLONG* pInt_Length = DataBase_MySQL_GetLength (xhDBSQL, xhTable);
153166
154167 if (NULL != pptszResult[1 ])
155168 {
@@ -177,11 +190,12 @@ bool CDBModule_MQData::DBModule_MQData_Query(XENGINE_DBMESSAGEQUEUE* pSt_DBInfo)
177190 }
178191 if (NULL != pptszResult[7 ])
179192 {
180- _tcsxcpy (pSt_DBInfo->tszMsgBuffer , pptszResult[7 ]);
193+ pSt_DBInfo->nMsgLen = pInt_Length[7 ];
194+ memcpy (pSt_DBInfo->tszMsgBuffer , pptszResult[7 ], pSt_DBInfo->nMsgLen );
181195 }
182196 if (NULL != pptszResult[8 ])
183197 {
184- pSt_DBInfo->nMsgLen = _ttxoi (pptszResult[8 ]);
198+ // pSt_DBInfo->nMsgLen = _ttxoi(pptszResult[8]);
185199 }
186200 if (NULL != pptszResult[9 ])
187201 {
@@ -576,7 +590,7 @@ bool CDBModule_MQData::DBModule_MQData_CreateTable(LPCXSTR lpszQueueName)
576590 " `nQueueGetTime` bigint NOT NULL COMMENT '获取次数',"
577591 " `tszQueueLeftTime` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '过期时间',"
578592 " `tszQueuePublishTime` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发布时间',"
579- " `tszQueueData` varchar(8192) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '保存数据',"
593+ " `tszQueueData` longblob NOT NULL COMMENT '保存数据',"
580594 " `nDataLen` int NOT NULL COMMENT '数据大小',"
581595 " `nDataType` tinyint NOT NULL COMMENT '数据类型',"
582596 " `tszQueueCreateTime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '插入时间',"
0 commit comments