SetEmptyStrToNull & TMyStoredProc

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
yurasek
Posts: 2
Joined: Fri 17 May 2013 17:33

SetEmptyStrToNull & TMyStoredProc

Post by yurasek » Fri 17 May 2013 17:37

When using TMyStoredProc not pass an empty string not looking of the fact that the property MyStoredProc.Options.SetEmptyStrToNull default False. Version MyDAC 7.6.11.

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: SetEmptyStrToNull & TMyStoredProc

Post by DemetrionQ » Mon 20 May 2013 14:21

Hello.

The SetEmptyStrToNull option affects only editing of the record set returned by TMyStoredProc. This option doesn't affect transferred parameters. If you want to transfer NULL as a parameter, you can do it using the TParam.Clear method, e.g.:
MyStoredProc1.ParamByName('param1').Clear;

yurasek
Posts: 2
Joined: Fri 17 May 2013 17:33

Re: SetEmptyStrToNull & TMyStoredProc

Post by yurasek » Wed 22 May 2013 17:09

My problem is just the opposite - I need to pass an empty string, not NULL. How can I do this?

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: SetEmptyStrToNull & TMyStoredProc

Post by DemetrionQ » Thu 23 May 2013 09:17

Hello.

I couldn't reproduce the problem. I assign an empty string to the function parameter in the following way:

Code: Select all

MyStoredProc1.ParamByName('param1').AsString := '';
And the function receives just the empty string, not NULL.

Post Reply