I have next table in two databases:

CREATE TABLE TABLE2(
    ID INTEGER NOT NULL,
    FIELD1 VARCHAR(256),
    FIELD2 VARCHAR(256),
    FIELD3 VARCHAR(512),
    FIELD4 VARCHAR(100),
    FIELD5 VARCHAR(2048))

Using EF I'm trying to copy data from one database to another. I want
to copy full data including Ids, so I disabled Identity Generation for
a destination database.

Problem is the next when EF generates insert it looks like the following:
"INSERT INTO \"TABLE2\"(\"ID\", \"FIELD1\", \"FIELD2\", \"FIELD3\",
\"FIELD4\", \"FIELD5\")\r\nVALUES (@p0, @p1, @p2, @p3, @p4, @p5,
NULL)\r\n"

And I have a problem here, parameters for these fields are treated
like SQL_TEXT and it tries to put UTF8 byte array to VARCHAR fields,
which is wrong. And a query fails on some long strings that in utf8
interpretation longer than 256 for example.

When I turn Identity Generation on, query looks like following:
EXECUTE BLOCK (
 p1 BLOB SUB_TYPE TEXT = @p1, p7 BLOB SUB_TYPE TEXT = @p7, p8 BLOB
SUB_TYPE TEXT = @p8, p9 BLOB SUB_TYPE TEXT = @p9
) RETURNS (
"ID" INT)
AS BEGIN
INSERT INTO "TABLE2"("FIELD2",  "FIELD3", "FIELD4", "FIELD5", "FIELD6")
VALUES (:p1, :p7, :p8, :p9, NULL)
RETURNING "ID" INTO :"ID";
SUSPEND;
END

And it doesn't fail.

------------------------------------------------------------------------------
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to