Page 1 of 1

Custom function in Entity Model removes quotes from columns

Posted: Tue 20 Nov 2012 13:54
by dresel
Hi,

im trying to use a custom update function defined in SSDL part (see here).

It seems like the dataprovider is removing the quotes from the CommandText and lower casing it. When using

Code: Select all

<CommandText>UPDATE "TestTable" SET "TestColumn" = @TestColumn WHERE "TestTableID" = @TestTableID;</CommandText>
an exception is thrown that column testcolumn does not exist.

Is there any option to prevent this behaviour?

Thanks,
Dresel

Re: Custom function in Entity Model removes quotes from columns

Posted: Thu 22 Nov 2012 08:15
by dresel
I solved this issue. Coming from a MSSQL background, i missunderstood devart ef parameter mapping.

When using "@" for a parameter, you also have to add it to the parametername - otherwise it is (silently?) removed and treated as a column - thats why i thought the error is about the column and not about the parameter...

So with "@" as prefix possible solutions would be

Code: Select all

<CommandText>UPDATE "TestTable" SET "TestColumn" = @TestColumn WHERE "TestTableID" = @TestTableID;</CommandText>
<Parameter Name="@TestColumn" Type="int" Mode="In" />
<Parameter Name="@TestTableID" Type="int" Mode="In" />
or with ":" as prefix

Code: Select all

<CommandText>UPDATE "TestTable" SET "TestColumn" = :TestColumn WHERE "TestTableID" = :TestTableID;</CommandText>
<Parameter Name="TestColumn" Type="int" Mode="In" />
<Parameter Name="TestTableID" Type="int" Mode="In" />
Thanks,
Dresel