dotConnect converts empty string to null

dotConnect converts empty string to null

Postby 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!
Albert
 
Posts: 20
Joined: Fri 06 Dec 2013 06:38

Re: dotConnect converts empty string to null

Postby 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/13278773/null-vs-empty-string-in-oracle
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: dotConnect converts empty string to null

Postby 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!
Albert
 
Posts: 20
Joined: Fri 06 Dec 2013 06:38

Re: dotConnect converts empty string to null

Postby 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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: dotConnect converts empty string to null

Postby 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=e2db3a53f01d7507&id=E2DB3A53F01D7507%21110&ithint=file,zip&authkey=!AERkBGmY4Mybw_0
Albert
 
Posts: 20
Joined: Fri 06 Dec 2013 06:38

Re: dotConnect converts empty string to null

Postby 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

Postby 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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for Oracle