0
私は、このようなクエリとこのようなエラーがあります値が異なるのはなぜのVertica - 文字列のオクテット長
dbadmin=> select octet_length(E'ЮлÑ\217 - Ð\237еÑ\200Ñ\203, Ð\221оливиÑ\217, ÐквадоÑ\200');
octet_length
--------------
84
(1 row)
:私はおとり捜査の長さをチェックしようとすると、私は別の値を得た
dbadmin=> update platforms set description = E'ЮлÑ\217 - Ð\237еÑ\200Ñ\203, Ð\221оливиÑ\217, ÐквадоÑ\200 where id = 189;
ERROR 4800: String of 92 octets is too long for type Varchar(80)
?
文字列を自動的に特定のオクテット番号にカットできますか?
from sqlalchemy.sql.sqltypes import String
from project import SessionVertica
def process(max_length, value):
literal_processor = String.literal_processor(SessionVertica.bind.dialect)
if literal_processor:
result = unicode(literal_processor(value))
else:
result = unicode(value)
if len(result) >= max_length:
result = result[:max_length - 2] + '\''
return 'E' + result