Page 1 of 1

dotConnect converts empty string to null

Posted: Fri 05 Sep 2014 07:01
by Albert
Hello,
I try something like this:

Code: Select all

var item = DbContext.GetTable<SomeEntity>().Select(d => new
        {
            Str1 = "",
            Str2 = d.Name,
        }).First();
But item.Str1 equals null instead of empty string. Why this happening? Thanks!

Re: dotConnect converts empty string to null

Posted: Fri 05 Sep 2014 10:24
by MariiaI
This issue is not related to dotConnect for Oracle. This is related to the fact that Oracle converts empty strings ("") to null. Please refer to:
http://stackoverflow.com/questions/1327 ... -in-oracle

Re: dotConnect converts empty string to null

Posted: Fri 05 Sep 2014 11:40
by Albert
MariiaI wrote:This issue is not related to dotConnect for Oracle. This is related to the fact that Oracle converts empty strings ("") to null.
At that rate I don't understand two things:
1) Why the same query gives me item.str1 = "" (not null) with dotConnect for Oracle v6.0.58?
2) Why the following query

Code: Select all

var item2 = DbContext.GetTable<SomeEntity>().Select(d => new
        {
            Str1 = "",
            Str2 = "",
        }).First();
gives me item2 = { Str1 = "", Str2 = "" }. Both queries are not querying empty(null) strings from oracle. For example, first query translates to:

Code: Select all

SELECT t1.NAME FROM SOMETABLE t1 WHERE ROWNUM <= 1
Thus, Str1 must be defined on client-side. Could you explain please, what is going on? Thanks!

Re: dotConnect converts empty string to null

Posted: Mon 08 Sep 2014 13:21
by MariiaI
Albert wrote: At that rate I don't understand two things:
1) Why the same query gives me item.str1 = "" (not null) with dotConnect for Oracle v6.0.58?
2) Why the following query

Code: Select all

var item2 = DbContext.GetTable<SomeEntity>().Select(d => new
        {
            Str1 = "",
            Str2 = "",
        }).First();
gives me item2 = { Str1 = "", Str2 = "" }. Both queries are not querying empty(null) strings from oracle. For example, first query translates to:

Code: Select all

SELECT t1.NAME FROM SOMETABLE t1 WHERE ROWNUM <= 1
Thus, Str1 must be defined on client-side. Could you explain please, what is going on? Thanks!
Please specify the version of Entity Framework you are working with. Also, please send us a small test project, so that we are able to reproduce the behaviour you have encountered, basing on your scenario.
In this case, we will investigate the issue in more details and find the solution for you in a shortest time.

Re: dotConnect converts empty string to null

Posted: Tue 09 Sep 2014 04:59
by Albert
I use:
- the dotConnect for Oracle v8.4.201.0 and LinqConnect v4.4.539.0 (not Entity Framework)
- the Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production.
You can download the test project from this link
https://onedrive.live.com/?cid=e2db3a53 ... GmY4Mybw_0

Re: dotConnect converts empty string to null

Posted: Wed 10 Sep 2014 05:39
by MariiaI
Thank you for the additional information. We will investigate this behaviour in more details and inform you about the results as soon as possible.

Re: dotConnect converts empty string to null

Posted: Fri 07 Nov 2014 12:11
by MariiaI
We have investigated this behaviour and, currently, there are no plans to make changes for such scenarios due to the complexity of the issue.