Medoo

开始

更新日志

Where 语句

查询

聚合

Fetch

事务

原生SQL查询

Raw object

PDO object

Debug

数据库信息

Debug

输入sql语句,但不执行

debug()

Return: 开启Medoo调试模式

输出sql语句,不需要使用echo或其它方法。调试完成请移除此代码

  1. $database->debug()->select("bccount", [
  2. "user_name",
  3. "email"
  4. ], [
  5. "user_id[<]" => 20
  6. ]);
  7.  
  8. // Will output:
  9. // SELECT "user_name","email" FROM "bccount" WHERE "user_id" < 20
  10.  
  11. // [Multiple situation]
  12. // Output nothing
  13. $database->insert("account", [
  14. "user_name" => "foo",
  15. "email" => "foo@bar.com"
  16. ]);
  17.  
  18. // Will output the generated query
  19. $post_id = $database->debug()->get("post", "post_id", ["user_name" => "foo"]);
  20.  
  21. // Be careful, this query will be executed.
  22. $database->update("account", [
  23. "level[+]" => 5,
  24. "post" => $post_id
  25. ], [
  26. "user_name" => "foo"
  27. ]);