我需要set ARITHABORT ON
对于 Catalyst 上的 DBIx::Class。
我不确定我可以这样做:
$source->storage->do("set ARITHABORT ON");
我在 MS SQL Server 2008 中遇到此错误:
SELECT failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.
在 Catalyst 中设置此类选项的最佳实践是什么?
最佳答案
在数据库模型中,您可以在 connect_info 中设置 on_connect_do
属性用于包的配置。
这是一个例子:
__PACKAGE__->config(
schema_class => 'Your::Schema',
connect_info => [
'dbi:ODBC:server=my.host.name;port=1433;driver=FreeTDS;tds_version=8.0',
'username',
'password',
undef,
{ on_connect_do => [ 'SET ARITHABORT ON' ] },
]
);
关于sql - 如何在 Catalyst 中的 DBIx::Class 上设置 sql 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14408923/