我最近将我的 MySQL 版本升级到 5.6.10(Linux 上的社区版),随后我无法正确运行 Crystal Report,该报告通过 MySQL ODBC 驱动程序 3.5.1 与 MySQL 5.0.24a 通信正常。
该报告是建立在一个 SQL 命令的基础上,如果我手动输入查询和日期 ala 2013-05-15 到 MySQL 客户端,但是当通过 ODBC 将参数传递给它时(它将查询中的日期重新格式化为 { d '2013-05-15'} MySQL 返回随机结果,这意味着一次运行将返回没有负值的结果,另一次运行仅返回负值,另一次运行将不返回任何结果。在某些情况下,我实际上得到了完整的报告,但这是不可预测的。
我已经把它专门缩小到日期参数,但是在升级到 Crystal Reports 2011 和 MySQL ODBC 5.2 之后 - 问题仍然存在。我已经通过将“日期”参数更改为“字符串”参数来解决它,但这并不理想。
MySQL 5.6.10 服务器的其他一切似乎都运行良好,我仍在尝试确定 5.0 和 5.6 之间是否对 ODBC 的处理方式进行了更改,但到目前为止我还没有弄清楚只是为什么这表现得如此奇怪。
这是带有相关参数的查询的一部分...
select sql_no_cache
if(CCT.creditCardTypeName is not null, CCT.creditCardTypeName, if(OPBML.orderPaymentBMLID is not null, 'Bill Me Later', 'Cash/Check')) as theType,
'orderPayment ' as source,
date_format(OP.authorizationDate, '%Y-%m-%d') as theDate,
if (OPC.checkNumber is not null, OPC.checkNumber, '') as checkNum,
if (OPWT.wireTransferDate is not null, OPWT.wireTransferNumber, '') as wtNum,
concat(C.lastName, ', ', C.firstName) as custName,
O.orderNumber,
OP.amount
from
orders O
inner join orderPayment OP on (O.ordersID=OP.ordersID)
inner join paymentMethod PM on (PM.paymentMethodID=OP.paymentMethodID)
inner join customer C on (C.customerID=O.customerID)
inner join partner P on (C.partnerID = P.partnerID and P.businessUnit = {?businessUnit})
left outer join orderPaymentBML OPBML on (OP.orderPaymentID=OPBML.orderPaymentID)
left outer join orderPaymentCheck OPC on (OP.orderPaymentID=OPC.orderPaymentID)
left outer join orderPaymentCreditCard OPCC on (OP.orderPaymentID=OPCC.orderPaymentID)
left outer join orderPaymentWireTransfer OPWT on (OP.orderPaymentID=OPWT.orderPaymentID)
left outer join creditCardType CCT on (CCT.creditCardTypeID=OPCC.creditCardTypeID)
where
OP.authorizationDate between date_add({?date},INTERVAL "3:0:01" HOUR_SECOND) and
date_add( date_add({?date}, INTERVAL 1 DAY), INTERVAL "3:0:00" HOUR_SECOND) and
PM.paymentMethodAbbreviation in ('BM', 'CC', 'CH', 'WT')
谢谢,--SJ