自从预备查询出现在SugarCRM中以来,它使调试查询变得更具挑战性。当您将日志级别设置为INFO并收集可疑查询时,将显示如下查询 :
SELECT meetings.id, meetings.date_modified meetings__date_modified FROM meetings LEFT JOIN meetings_users meetings_users ON (meetings.id = meetings_users.meeting_id) AND (meetings_users.deleted = ?) LEFT JOIN users jt0_users ON (jt0_users.id = meetings_users.user_id) AND (jt0_users.deleted = ?) WHERE ((meetings.reminder_time >= ?) AND (meetings.status = ?) AND (meetings_users.accept_status != ?) AND (meetings.date_start BETWEEN ? AND ?) AND (jt0_users.id = ?)) AND (meetings.deleted = ?) ORDER BY meetings.date_modified DESC, meetings.id DESC LIMIT 21nParams: {"1":0,"2":0,"3":0,"4":"Planned","5":"decline","6":"2021-01-25 01:47:49","7":"2021-01-26 01:52:49","8":"1","9":0}nTypes: {"1":5,"2":5,"3":1,"4":2,"5":2,"6":2,"7":2,"8":2,"9":5}
也许我错了,有一种简单的方法可以将其转换为可以在Workbench或phpMyAdmin中运行的东西,但到目前为止我还没有找到它。所以我创建了sqlViewer。它不仅使我能够重新格式化这些查询,还使在日志文件中查找正确的查询变得更加容易,并且可以从界面直接运行它。
从这一本书中学到的东西可能并不多,但是我发现它在很多场合都具有无价的价值。可加载模块的所有代码和说明可在https://github.com/kenbrill/sqlViewer上获得。如果愿意,欢迎您提交改进和错误修复。