Custom function in Entity Model removes quotes from columns

Custom function in Entity Model removes quotes from columns

Postby dresel » Tue 20 Nov 2012 13:54

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
dresel
 
Posts: 18
Joined: Tue 20 Nov 2012 13:38

Re: Custom function in Entity Model removes quotes from columns

Postby dresel » Thu 22 Nov 2012 08:15

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
dresel
 
Posts: 18
Joined: Tue 20 Nov 2012 13:38


Return to dotConnect for PostgreSQL