免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3613 | 回复: 7
打印 上一主题 下一主题

perl5.8 数据库操作错误会弹出"perl.exe应用程序错误"对话框 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-09-23 13:36 |只看该作者 |倒序浏览
当往数据库里插入已存在的主键时,就会弹出"perl.exe应用程序错误"的对话框,必须得手动关掉它才可以进行下一步操作。但在Perl5.0中不会弹出这样的对话框。请问这是不是5.8个bug啊。怎么才能让它不弹出对话框?
  我的环境:Win2K,Sybase数据库,

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2006-09-23 19:06 |只看该作者
错误框是什么样的?文字呢?

论坛徽章:
0
3 [报告]
发表于 2006-09-23 19:31 |只看该作者

Perl.exe-应用程序错误

"0x77f87eeb"指令引用的"0x0000003e"内存。该内存不能为"read"

这种情况只有在插入重复主键时才会出现,其他象数据类型错误就不会弹出

论坛徽章:
0
4 [报告]
发表于 2006-09-24 09:29 |只看该作者
eval,怎么用?请指教!

[ 本帖最后由 lanparky 于 2006-9-24 09:34 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2006-09-25 09:28 |只看该作者
我试着这样:  eval{  $db->ct_execute($sql);};
可还是会弹出错误的对话框!哪位还有别的解决方法?我想是不是要设置参数的问题,我看了Sybase::CTLib模块,有个参数SkipEED,描述是这样的If set, then I<Extended Error Data> will I<not> be fetched in error
handlers. The default is to fetch extended error data, which includes
things like the index name that caused a duplicate insert error, for
example.
我把SkipEED设置了还是不行
$db=new Sybase::CTlib 'sa', '123', 'mydb', undef,
                           { CON_PROPS => { CS_SYB_CHARSET => 'iso-1' }
                           };
if($db==NULL) {
                print "对不起,数据服务器连接失败,请联系系统管理员!";
                exit;
        }
  $db->{SkipEED}=0;                    ##无论是0还是1都不行
$sql="insert into .....";
$db->ct_execute($sql);

论坛徽章:
0
6 [报告]
发表于 2006-09-25 10:53 |只看该作者
connect中加{-PrintError =>0}参数即可

论坛徽章:
0
7 [报告]
发表于 2006-09-28 14:20 |只看该作者
$db=new Sybase::CTlib 'sa', '123', 'mydb', undef,
                           { CON_PROPS => { CS_SYB_CHARSET => 'iso-1' ,
                                                           PrintError =>0}
                           };
还是不行。。。。。。。。。。

论坛徽章:
0
8 [报告]
发表于 2006-09-28 20:15 |只看该作者
the option 'PrintError =>0' is not belong to  Sybase::CTlib. it's for DBI. forget it!
try to set 'SkipEED' globally:
$Sybase::CTlib::Att{'SkipEED'} = 1;
or obejectly:
$dbh->{'SkipEED'} = 1;
But I think it will perhaps not help you.
Why don't you check the primary key in a table before to insert it, when this primary is not
auto increased, this a good behavior to process a database.

regards, ulmer
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP