dongxietao0263 2013-07-10 06:06
浏览 17
已采纳

idiorm查看sql进行调试

Using https://github.com/j4mie/idiorm for my php website.

How do I view the actual SQL that is generate?

ie:

$sql        = ORM::for_table('tbl')->create();
$sql->set(array(
    'another_id'=> $another_id,
    'name'  => $name,
    'active'    => 0
));
$sql->save();

Is generating an error, would like to view the output T-SQL, sometimes its just better to debug that way.

Ta

  • 写回答

1条回答 默认 最新

  • duanbei1903 2013-07-10 06:15
    关注

    I am pretty sure using the set() is usually for updating records(that could be wrong). I would just do this:

    $sql = ORM::for_table('tbl')->create();
    
    $sql->another_id = $another_id;
    $sql->name = $name;
    $sql->active = 0;
    
    $sql->save();
    

    As far as getting the query, there is a 'logging' option in the config as well as a get_last_query function.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥20 对文档进行操作,有偿 有意向的可以加我v
  • ¥15 brainstorm进行致痫指数分析
  • ¥30 beeline连接hive集群会卡住
  • ¥15 julia语言画表面图
  • ¥15 前端css轮播图效果优化
  • ¥15 如何在已有的土地利用类型图中加入新的地类呢
  • ¥20 TCIA数据库下载报错,请问如何解决
  • ¥30 vue3使用@imgly/background-removal给图片去除背景
  • ¥15 从mysql导入数据到hive
  • ¥15 海康视频线上无法正常播放