ゴ ガ ギ グ ゲ ザ ジ ズ ヅ デ ド ポ ベ プ ビ パ ヴ ボ ペ ブ ピ バ ヂ ダ ゾ ゼ
当字段内包含了这26个日文字符任意一个多个时,就会导致在执行SQL语句中包含了
[字段] like '%aaaaa%' 或 inStr(1,[字段],'aaaaa',1)>0
这样的查询时,毫无道理的出现了
"Microsoft JET Database Engine 错误 '80040e14' 内存溢出"的错误
其他Jet SQL函数命令未作测试,大概与字符搜索定位匹配相关的都可能出错
搜索相关资料得知被微软工程师证实是Access的bug,可能是语法关系都是微软的东东
在vbs中 执行inStr(1,日文平假名变量,"aaaaa",1)依然要出现错误
Microsoft VBScript 运行时错误 错误 '800a0005' 无效的过程调用或参数: 'instr'
没有搜索,因这几个字符出现Access的论坛网站搜索无法进行,何等痛苦
昨天一朋友大叫怪事,他的音乐数据库无法搜索了,只有30000条记录时是好的
毫无疑问,日文片假名是祸根,花几分钟把有包含上面的日文替换成"?"搜索顺利恢复
找来论坛程序用户群最大的动网dvBBS AC版本 7.0SP2 版测试,同样有这个日文发帖后 导致无法搜索并且运行时出错的问题
线上去搜索 '80040e14' 内存溢出" 的错误 多的是!
一简单有效的解决办法:
对这26个字符进行编码和解码,可能效率感觉不理想,测试下来问题不大,速度影响不是太大
编码:
Function Jencode(byVal iStr)
if isnull(iStr) or isEmpty(iStr) then
Jencode=""
Exit function
end if
dim F,i,E
' F=array("ゴ","ガ","ギ","グ","ゲ","ザ","ジ","ズ","ヅ","デ",_
' "ド","ポ","ベ","プ","ビ","パ","ヴ","ボ","ペ","ブ","ピ","バ",_
' "ヂ","ダ","ゾ","ゼ")
E=array("Jn0;","Jn1;","Jn2;","Jn3;","Jn4;","Jn5;","Jn6;","Jn7;","Jn8;","Jn9;","Jn10;","Jn11;","Jn12;","Jn13;","Jn14;","Jn15;","Jn16;","Jn17;","Jn18;","Jn19;","Jn20;","Jn21;","Jn22;","Jn23;","Jn24;","Jn25;")
F=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
Jencode=iStr
for i=0 to 25
Jencode=replace(Jencode,F(i),E(i))
next
End Function
解码:
Function Juncode(byVal iStr)
if isnull(iStr) or isEmpty(iStr) then
Juncode=""
Exit function
end if
dim F,i,E
' F=array("ゴ","ガ","ギ","グ","ゲ","ザ","ジ","ズ","ヅ","デ",_
' "ド","ポ","ベ","プ","ビ","パ","ヴ","ボ","ペ","ブ","ピ","バ",_
' "ヂ","ダ","ゾ","ゼ")
E=array("Jn0;","Jn1;","Jn2;","Jn3;","Jn4;","Jn5;","Jn6;","Jn7;","Jn8;","Jn9;","Jn10;","Jn11;","Jn12;","Jn13;","Jn14;","Jn15;","Jn16;","Jn17;","Jn18;","Jn19;","Jn20;","Jn21;","Jn22;","Jn23;","Jn24;","Jn25;")
F=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
Juncode=iStr
for i=0 to 25
Juncode=replace(Juncode,E(i),F(i))'□
next
End Function
注意,如果直接使用字符不方便(windows还没装日文支持),注释掉的部分提供有 chr(-23804) ..这样的定义
本新闻共3页,当前在第1页 1 2 3