du1843 2014-03-25 03:17
浏览 47
已采纳

可以将原始SQL解析为Zend \ Db \ Sql \ Select对象吗?

is there a way to parse a SQL statement string into a Zend\Db\Sql\Select object?

something along the lines of:

$sql = 'SELECT * FROM table WHERE col1 = "x"';
$select = new Select();
$select->parseSql($sql);

I have many uses for this, basically maintaining the use of a Select object when executing a raw SQL statement, for example to pass to Zend\Paginator\Adapter\DbSelect without having to write a custom Zend\Paginator\Adapter\DbSelect Class.

  • 写回答

1条回答 默认 最新

  • doukezi4606 2014-03-26 03:39
    关注

    got one answer through a twitter response, specific to the Paginator use case:

    $resultSet = iterator_to_array($adapter->query($sql_statement)->execute());
    $iteratorAdapter = new ArrayAdapter($resultSet);
    $paginator = new Paginator($iteratorAdapter);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码