无法解析 zend_db_select 中的默认模式

发布于 2024-12-10 21:07:04 字数 2244 浏览 0 评论 0原文

为什么 zend_db_select 不从配置文件中获取模式?我该如何解决它?

配置:

resources.database.adapter = "Oracle"
resources.database.params.dbname = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521)) (CONNECT_DATA = (SID = xx)))"
resources.database.params.username = ''
resources.database.params.password = ''
resources.database.params.trace =
resources.database.params.schema = YYY

选择:

$select->from(
                array('pm' => 'tab_1'),
                array(
                    'pm_id',
                    'status',
                    'pm_status',
                    'pm_tabno',
                    'pm_cardno',
                    'pm_start_dt',
                    'pm_endtk_dt',
                    'pm_signature',
                    'pm_servrec_no',
                    'pm_isdirector'
                )
            )
            ->joinLeft(
                array('pa' => 'tab_2'),
                'pm.pm_id = pa.pa_pm',
                array(
                    'PRL_NAME',
                    'PRF_NAME',
                    'PRS_NAME'
                )
            )
            ->joinLeft(
                array('ddpst' => 'tab_3'),
                'pm.status = ddpst.dic_value',
                'dic_name'
            )
            ->joinLeft(
                array('pst' => 'tab_4'),
                'pm.pm_status = pst.dic_value',
                'dic_sname'
            )
            ->where(
                'pa.status = 1'
        );

结果:

SELECT z2.*
            FROM (
                SELECT z1.*, ROWNUM AS "zend_db_rownum"
                FROM (
                    SELECT pm.pm_id, pm.status, pm.pm_status, pm.pm_tabno, pm.pm_cardno, pm.pm_start_dt, pm.pm_endtk_dt, pm.pm_signature, pm.pm_servrec_no, pm.pm_isdirector, pa.PRL_NAME, pa.PRF_NAME, pa.PRS_NAME, ddpst.dic_name, pst.dic_sname FROM tab_1 pm
 LEFT JOIN tab_2 pa ON pm.pm_id = pa.pa_pm
 LEFT JOIN tab_3 ddpst ON pm.status = ddpst.dic_value
 LEFT JOIN tab_4 pst ON pm.pm_status = pst.dic_value WHERE (pa.status = 1) ORDER BY PRL_NAME ASC
                ) z1
            ) z2
            WHERE z2."zend_db_rownum" BETWEEN 1 AND 50

why zend_db_select does not pick up schema from config file? and how can i fix it?

config:

resources.database.adapter = "Oracle"
resources.database.params.dbname = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521)) (CONNECT_DATA = (SID = xx)))"
resources.database.params.username = ''
resources.database.params.password = ''
resources.database.params.trace =
resources.database.params.schema = YYY

select:

$select->from(
                array('pm' => 'tab_1'),
                array(
                    'pm_id',
                    'status',
                    'pm_status',
                    'pm_tabno',
                    'pm_cardno',
                    'pm_start_dt',
                    'pm_endtk_dt',
                    'pm_signature',
                    'pm_servrec_no',
                    'pm_isdirector'
                )
            )
            ->joinLeft(
                array('pa' => 'tab_2'),
                'pm.pm_id = pa.pa_pm',
                array(
                    'PRL_NAME',
                    'PRF_NAME',
                    'PRS_NAME'
                )
            )
            ->joinLeft(
                array('ddpst' => 'tab_3'),
                'pm.status = ddpst.dic_value',
                'dic_name'
            )
            ->joinLeft(
                array('pst' => 'tab_4'),
                'pm.pm_status = pst.dic_value',
                'dic_sname'
            )
            ->where(
                'pa.status = 1'
        );

result:

SELECT z2.*
            FROM (
                SELECT z1.*, ROWNUM AS "zend_db_rownum"
                FROM (
                    SELECT pm.pm_id, pm.status, pm.pm_status, pm.pm_tabno, pm.pm_cardno, pm.pm_start_dt, pm.pm_endtk_dt, pm.pm_signature, pm.pm_servrec_no, pm.pm_isdirector, pa.PRL_NAME, pa.PRF_NAME, pa.PRS_NAME, ddpst.dic_name, pst.dic_sname FROM tab_1 pm
 LEFT JOIN tab_2 pa ON pm.pm_id = pa.pa_pm
 LEFT JOIN tab_3 ddpst ON pm.status = ddpst.dic_value
 LEFT JOIN tab_4 pst ON pm.pm_status = pst.dic_value WHERE (pa.status = 1) ORDER BY PRL_NAME ASC
                ) z1
            ) z2
            WHERE z2."zend_db_rownum" BETWEEN 1 AND 50

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谁的新欢旧爱 2024-12-17 21:07:04

Schema 似乎不是 Zend_Application_Resrouce_Db 或 Zend_Db_Adapter_Oracle 接受的有效参数。如果您使用 Zend_Db_Table_Abstract 来定义 DbTable,则可以从 DbTable 类设置模式。

请参阅示例#4

Schema doesn't appear to be a valid parameter accepted by Zend_Application_Resrouce_Db or Zend_Db_Adapter_Oracle. You can set the schema from your DbTable classes if you are using Zend_Db_Table_Abstract to define your DbTables.

See Example #4.

陌上青苔 2024-12-17 21:07:04

通过重写 Zend_Db_Select (_join() 用于添加默认模式)+重写 Zend_Db_Adapter (用于返回自己的 Select)来解决

rsolved by overriding Zend_Db_Select (_join() for adding default schema) + overriding Zend_Db_Adapter (for returning own Select)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文