PDO_ODBC 使用 table 名称中的特殊字符访问 IBM DB2 table

PDO_ODBC accessing IBM DB2 tables with special characters in the table names

我正在 as/400 上开发 DB2 table。我正在尝试 运行 对其进行基本查询,但 table 名称中包含 .。例如:my.table 是 table 名称。

问题是 PDO 认为我正在用我的 table 名称 table 指定数据库名称 my。因此准备好的语句失败并且说数据库 my 中不存在这样的 table table。更改 table 名称不是一个选项。

处理 table 名称中句点的最佳方法是什么?我试过逃避这段时间,但没有成功。

这是我的问题的一些示例代码:

$sql= "select * from '[THE.TABLE]'";
        try {
            $statement = $this->db->query($sql);
            $results = $statement->execute();
            foreach ($results as $result) {
                print_r($result);
            }
            exit;
        }
        catch (\Exception $e)
        {
            //log issue and other stuff
        }

该应用程序 运行正在 Zend Framework 2 中。

我的意思是正确的。正如 aynber 在评论中提到的那样,解决方案是使用正确转义的双引号。答案可以在针对 MySQL.

的问题中找到