简体   繁体   English

Informix SQL文本Blob通配符搜索

[英]Informix SQL text Blob wildcard search

I am looking for an efficient way to use a wild card search on a text (blob) column. 我正在寻找一种在文本 (blob)列上使用通配符搜索的有效方法。
I have seen that it is internally stored as bytes... The data amount will be limited, but unfortunately my vendor has decided to use this stupid datatype. 我已经看到它在内部存储为字节......数据量将受到限制,但遗憾的是我的供应商决定使用这种愚蠢的数据类型。 I would also consider to move everything in a temp table if there is an easy system side function to modify it - unfortunately something like rpad does not work... 如果有一个简单的系统端函数来修改它,我还会考虑在临时表中移动所有东西 - 不幸的是像rpad这样的东西不起作用......
I can see the text value correctly via using the column in the select part or when reading the data via Perl's DBI module. 通过使用选择部分中的列或通过Perl的DBI模块读取数据,我可以正确地看到文本值。

Unfortunately, you are stuck - there are very few operations that you can perform on TEXT or BYTE blobs. 不幸的是,你被困住了 - 你可以在TEXT或BYTE blob上执行很少的操作。 In particular, none of these work: 特别是,这些都不起作用:

+ create table t (t text in table);
+ select t from t where t[1,3] = "abc";
SQL -615: Blobs are not allowed in this expression.
+ select t from t where t like "%abc%";
SQL -219: Wildcard matching may not be used with non-character types.
+ select t from t where t matches "*abc*";
SQL -219: Wildcard matching may not be used with non-character types.

Depending on the version of IDS, you may have options with BTS - Basic Text Search (requires IDS v11), or with other text search data blades. 根据IDS的版本,您可以选择BTS - 基本文本搜索(需要IDS v11)或其他文本搜索数据刀片。 On the other hand, if the data is already in the DB and cannot be type-converted, then you may be forced to extract the blobs and search them client-side, which is less efficient. 另一方面,如果数据已经在数据库中并且无法进行类型转换,那么您可能会被迫提取blob并在客户端搜索它们,这效率较低。 If you must do that, ensure you filter on as many other conditions as possible to minimize the traffic that is needed. 如果必须这样做,请确保过滤尽可能多的其他条件,以最大限度地减少所需的流量。

You might also notice that DBD::Informix has to go through some machinations to make blobs appear to work - machinations that it should not, quite frankly, have to go through. 您可能还会注意到DBD :: Informix必须经历一些阴谋才能使blob看起来有效 - 很明显,它不应该通过这种阴谋。 So far, in a decade of trying, I've not persuaded people that these things need fixing. 到目前为止,经过十年的尝试,我并没有说服人们这些东西需要修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM