Medoo

开始

更新日志

Where 语句

查询

聚合

Fetch

事务

原生SQL查询

Raw object

PDO object

Debug

数据库信息

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" => "[email protected]"
]);

// 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"
]);