Debug
输入sql语句,但不执行
debug()
Return: 开启Medoo调试模式
输出sql语句,不需要使用echo或其它方法。调试完成请移除此代码
- $database->debug()->select("bccount", [
- "user_name",
- "email"
- ], [
- "user_id[<]" => 20
- ]);
- // Will output:
- // SELECT "user_name","email" FROM "bccount" WHERE "user_id" < 20
- // [Multiple situation]
- // Output nothing
- $database->insert("account", [
- "user_name" => "foo",
- "email" => "foo@bar.com"
- ]);
- // Will output the generated query
- $post_id = $database->debug()->get("post", "post_id", ["user_name" => "foo"]);
- // Be careful, this query will be executed.
- $database->update("account", [
- "level[+]" => 5,
- "post" => $post_id
- ], [
- "user_name" => "foo"
- ]);