Loader with "NOT NULL DEFAULT VALUE" fields

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Licences AAW
Posts: 10
Joined: Tue 21 Jul 2015 07:43

Loader with "NOT NULL DEFAULT VALUE" fields

Post by Licences AAW » Tue 27 Oct 2015 08:16

[UniDac 6.1.5]

Hello,
I'm facing a case I don't know how to handle. In a SQL Server database, I have a table with some "NOT NULL DEFAULT VALUE" fields.
In my application, I have a bulk of data to load in this table with a TUniLoader. But some of the data doesn't permit to "calculate" those fields values. So I want the server apply their "DEFAULT VALUE" constraints.
The problem is that I can't find a way to inform TUniLoader a column is "not assigned" (neither valued nor "null"). It seems TUniLoader consider not assigned values as null and send "null" to the server. And then the server raises a "Not null" exception.

Until now, the only way I found is to load data in two phases: a phase with pre-calculated "not null default value" fields, and a phase where those fields are excluded from TUniLoader. Not very convenient in my case.

So, is there a way to prevent TUniLoader to send "Null" when the field is "Unassigned" ?

(with SQLServer provider, it seems the case when MSParam.IsBound is False, but nothing allows to change this property)

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Loader with "NOT NULL DEFAULT VALUE" fields

Post by azyk » Tue 27 Oct 2015 16:00

Currently, there is no possibility to set the DEFAULT value, that is declared on the server, for a field in the TUniLoader.OnPutData event handler. You can suggest this feature at our UserVoice ( http://devart.uservoice.com/forums/1046 ... 939-unidac ). If the suggestion gets a lot of votes, we will consider the possibility to implement it.

Licences AAW
Posts: 10
Joined: Tue 21 Jul 2015 07:43

Re: Loader with "NOT NULL DEFAULT VALUE" fields

Post by Licences AAW » Wed 28 Oct 2015 08:23

Thank's for the answer

I add suggestion for new feature:
http://devart.uservoice.com/forums/1046 ... tuniloader

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Loader with "NOT NULL DEFAULT VALUE" fields

Post by azyk » Fri 30 Oct 2015 13:12

If any other questions come up, please contact us.

Post Reply