我尝试像这样执行简单的LINQ查询
var images = context.IMAGES;
images = from img in images
join imt in context.IMAGE_TAG on img.ID equals imt.ID_IMAGE
where tags.Any(tag => imt.TAGS.NAME.Contains(tag))
select img;
当firebird适配器转换为SQL查询时,它会尝试将我的西里尔文本转换为utf-8,如下所示
CAST(_UTF8'тату' AS VARCHAR(8191)) AS "C1"
我得到了
"动态SQL错误\ r \ nSQL错误代码= -104 \ r \ n已形成字符串"
更新: 生成的查询:
SELECT "C"."ID" AS "ID", "C"."GUID" AS "GUID", "C"."EXT" AS "EXT", "C"."ID_USER" AS "ID_USER", "C"."IS_NEW" AS "IS_NEW"FROM "IMAGES" AS "C"INNER JOIN "IMAGE_TAG" AS "D" ON "C"."ID" = "D"."ID_IMAGE"WHERE EXISTS (SELECT 1 AS "C1" FROM (SELECT CAST(_UTF8'тату' AS VARCHAR(8191)) AS "C1" FROM ( SELECT 1 AS X FROM RDB$DATABASE) AS "G" UNION ALL SELECT CAST(_UTF8'tatuir' AS VARCHAR(8191)) AS "C1" FROM ( SELECT 1 AS X FROM RDB$DATABASE) AS "H") AS "I" LEFT OUTER JOIN (SELECT "K"."ID" AS "ID", "K"."NAME" AS "NAME"
FROM "TAGS" AS "K"
WHERE "D"."ID_TAG" = "K"."ID" ) AS "L" ON CAST(1 AS SMALLINT) = CAST(1 AS SMALLINT) WHERE (POSITION("I"."C1", "L"."NAME")) > 0)
标签简单表:
CREATE TABLE TAGS (
ID INTEGER NOT NULL,
NAME VARCHAR(50) NOT NULL
);
" NAME"列有WIN1251字符集。
答案 0 :(得分:1)
您似乎使用了一些非UTF8字符集进行连接。用户UTF8作为连接字符集,你很好。