dotConnect converts empty string to null

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Albert
Posts: 20
Joined: Fri 06 Dec 2013 06:38

dotConnect converts empty string to null

Post by Albert » Fri 05 Sep 2014 07:01

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!

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: dotConnect converts empty string to null

Post by MariiaI » Fri 05 Sep 2014 10:24

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

Albert
Posts: 20
Joined: Fri 06 Dec 2013 06:38

Re: dotConnect converts empty string to null

Post by Albert » Fri 05 Sep 2014 11:40

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!

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: dotConnect converts empty string to null

Post by MariiaI » Mon 08 Sep 2014 13:21

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.

Albert
Posts: 20
Joined: Fri 06 Dec 2013 06:38

Re: dotConnect converts empty string to null

Post by Albert » Tue 09 Sep 2014 04:59

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: dotConnect converts empty string to null

Post by MariiaI » Wed 10 Sep 2014 05:39

Thank you for the additional information. We will investigate this behaviour in more details and inform you about the results as soon as possible.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: dotConnect converts empty string to null

Post by MariiaI » Fri 07 Nov 2014 12:11

We have investigated this behaviour and, currently, there are no plans to make changes for such scenarios due to the complexity of the issue.

Post Reply