Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Bhathiya Jayasekara
On Tue, Jan 10, 2017 at 12:06 PM, Malintha Amarasinghe 
wrote:

> On Tue, Jan 10, 2017 at 12:03 PM, Bhathiya Jayasekara 
> wrote:
>
>>
>> On Tue, Jan 10, 2017 at 11:53 AM, Malintha Amarasinghe <
>> malint...@wso2.com> wrote:
>>
>>> If we can fix this without breaking the user experience is ideal. But
>>> the problem I see is how can we manage those changes; are we going to do
>>> that in each and every query? If we miss one place that will introduce a
>>> bug. Is there any way we can manage this in a central manner?
>>>
>>
>> If we do this in model classes, we don't need to change anywhere else.
>>
> So we need to do this in all String variables in all models classes?
>

Yes.


> Are we going to do this in code generator level?
>

No, models are not auto generated. Here we are talking about core service
level, but not REST API level.

Thanks,
Bhathiya


>
> Thanks,
> Malintha
>
>>
>> Thanks,
>> Bhathiya
>>
>>
>>>
>>> On Tue, Jan 10, 2017 at 11:46 AM, Ishara Cooray 
>>> wrote:
>>>
 IMO user experience is the most important thing and what ever the logic
 we have implemented should not do any difference in end user experience.
 Hence, keeping things simple, prefer using a space character if and
 only if user has provided an empty string. Otherwise keep the default
 value.



 Thanks & Regards,
 Ishara Cooray
 Senior Software Engineer
 Mobile : +9477 262 9512 <+94%2077%20262%209512>
 WSO2, Inc. | http://wso2.com/
 Lean . Enterprise . Middleware

 On Tue, Jan 10, 2017 at 11:29 AM, Akalanka Pagoda Arachchi <
 darsha...@wso2.com> wrote:

> We can say that the string we use is a reserved keyword. In any
> complex system we have to have such restriction in order address these 
> kind
> of issues.
>
> On Tue, Jan 10, 2017 at 11:23 AM, Malintha Amarasinghe <
> malint...@wso2.com> wrote:
>
>>
>>
>> On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi <
>> darsha...@wso2.com> wrote:
>>
>>> Replacing an empty string with a space is generally a bad practice
>>> in database perspective due to few reasons.
>>>
>>> 1. Issues with visibility (a DBA cannot tell the difference by
>>> directly looking at it)
>>> 2. As Madhawa pointed out, space is a different character and when
>>> we really want to represent a space in the column and differentiate 
>>> between
>>> the empty and the space, it will be impossible.
>>> 3. Adds processing complexity
>>>
>>> The suggestion to use a space for empty strings is actually to
>>> denote an empty string by a special character since empty string is not
>>> supported in Oracle. Therefore instead of using a meaningless space
>>> character which introduces more complexity why not use a special string
>>> such as NULL or EMPTY?
>>>
>> If we select a special string we should ensure that those will never
>> come as a user input; I am doubtful we can assume that always.. Otherwise
>> if a user give "NULL" as an input, it will come back as "" right?
>>
>>>
>>> Thanks,
>>> Akalanka.
>>>
>>> On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara <
>>> madha...@wso2.com> wrote:
>>>
 So what will happen if the user sends a space? So It's better to
 add a configuration to avoid these situations. then user can handle 
 this.
 WDYT ?

 On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
 uvin...@wso2.com> wrote:

> To be more precise, if a user explicitly sends "" then we will set
> the value to space, enabling us to convert back to "".
>
> But if the field is not set(ignored by the user) then the default
> NULL will be saved. This will make things consistant across all DB's.
>
> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha <
> uvin...@wso2.com> wrote:
>
>> Note that there is a clear break in the UX of the REST API if we
>> allow pass empty strings to Oracle(due to the conversion to NULL). 
>> Oracle
>> treats "" as NULL but this is incorrect in the REST/JSON world.
>>
>> If a user enters an empty string "" they will expect to get ""
>> back, which will not happen with Oracles default behaviour. 
>> Therefore in
>> order to keep consistency of the REST API I dont see an alternative 
>> other
>> than having space as the default value. We can get rid of the space 
>> when
>> returning by simply trimming the String so we don't need to have any
>> special filtering logic.
>>
>> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
>> darsha...@wso2.com> wrote:
>>
>>> +1 to keep default as NULL instead of a space.
>>>
>>> Having a space will require adding trim

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Malintha Amarasinghe
On Tue, Jan 10, 2017 at 12:03 PM, Bhathiya Jayasekara 
wrote:

>
> On Tue, Jan 10, 2017 at 11:53 AM, Malintha Amarasinghe  > wrote:
>
>> If we can fix this without breaking the user experience is ideal. But the
>> problem I see is how can we manage those changes; are we going to do that
>> in each and every query? If we miss one place that will introduce a bug. Is
>> there any way we can manage this in a central manner?
>>
>
> If we do this in model classes, we don't need to change anywhere else.
>
So we need to do this in all String variables in all models classes? Are we
going to do this in code generator level?

Thanks,
Malintha

>
> Thanks,
> Bhathiya
>
>
>>
>> On Tue, Jan 10, 2017 at 11:46 AM, Ishara Cooray  wrote:
>>
>>> IMO user experience is the most important thing and what ever the logic
>>> we have implemented should not do any difference in end user experience.
>>> Hence, keeping things simple, prefer using a space character if and only
>>> if user has provided an empty string. Otherwise keep the default value.
>>>
>>>
>>>
>>> Thanks & Regards,
>>> Ishara Cooray
>>> Senior Software Engineer
>>> Mobile : +9477 262 9512 <+94%2077%20262%209512>
>>> WSO2, Inc. | http://wso2.com/
>>> Lean . Enterprise . Middleware
>>>
>>> On Tue, Jan 10, 2017 at 11:29 AM, Akalanka Pagoda Arachchi <
>>> darsha...@wso2.com> wrote:
>>>
 We can say that the string we use is a reserved keyword. In any complex
 system we have to have such restriction in order address these kind of
 issues.

 On Tue, Jan 10, 2017 at 11:23 AM, Malintha Amarasinghe <
 malint...@wso2.com> wrote:

>
>
> On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi <
> darsha...@wso2.com> wrote:
>
>> Replacing an empty string with a space is generally a bad practice in
>> database perspective due to few reasons.
>>
>> 1. Issues with visibility (a DBA cannot tell the difference by
>> directly looking at it)
>> 2. As Madhawa pointed out, space is a different character and when we
>> really want to represent a space in the column and differentiate between
>> the empty and the space, it will be impossible.
>> 3. Adds processing complexity
>>
>> The suggestion to use a space for empty strings is actually to denote
>> an empty string by a special character since empty string is not 
>> supported
>> in Oracle. Therefore instead of using a meaningless space character which
>> introduces more complexity why not use a special string such as NULL or
>> EMPTY?
>>
> If we select a special string we should ensure that those will never
> come as a user input; I am doubtful we can assume that always.. Otherwise
> if a user give "NULL" as an input, it will come back as "" right?
>
>>
>> Thanks,
>> Akalanka.
>>
>> On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara <
>> madha...@wso2.com> wrote:
>>
>>> So what will happen if the user sends a space? So It's better to add
>>> a configuration to avoid these situations. then user can handle this. 
>>> WDYT ?
>>>
>>> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
>>> uvin...@wso2.com> wrote:
>>>
 To be more precise, if a user explicitly sends "" then we will set
 the value to space, enabling us to convert back to "".

 But if the field is not set(ignored by the user) then the default
 NULL will be saved. This will make things consistant across all DB's.

 On 10 January 2017 at 10:41, Uvindra Dias Jayasinha <
 uvin...@wso2.com> wrote:

> Note that there is a clear break in the UX of the REST API if we
> allow pass empty strings to Oracle(due to the conversion to NULL). 
> Oracle
> treats "" as NULL but this is incorrect in the REST/JSON world.
>
> If a user enters an empty string "" they will expect to get ""
> back, which will not happen with Oracles default behaviour. Therefore 
> in
> order to keep consistency of the REST API I dont see an alternative 
> other
> than having space as the default value. We can get rid of the space 
> when
> returning by simply trimming the String so we don't need to have any
> special filtering logic.
>
> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
> darsha...@wso2.com> wrote:
>
>> +1 to keep default as NULL instead of a space.
>>
>> Having a space will require adding trimming logic to the
>> underlying code and methods like 'isNullOrEmpty' will bypass this 
>> string if
>> there's a space.
>>
>> Thanks,
>> Akalanka.
>>
>> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray > > wrote:
>>
>>>
>>>
>>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththo

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Bhathiya Jayasekara
On Tue, Jan 10, 2017 at 11:53 AM, Malintha Amarasinghe 
wrote:

> If we can fix this without breaking the user experience is ideal. But the
> problem I see is how can we manage those changes; are we going to do that
> in each and every query? If we miss one place that will introduce a bug. Is
> there any way we can manage this in a central manner?
>

If we do this in model classes, we don't need to change anywhere else.

Thanks,
Bhathiya


>
> On Tue, Jan 10, 2017 at 11:46 AM, Ishara Cooray  wrote:
>
>> IMO user experience is the most important thing and what ever the logic
>> we have implemented should not do any difference in end user experience.
>> Hence, keeping things simple, prefer using a space character if and only
>> if user has provided an empty string. Otherwise keep the default value.
>>
>>
>>
>> Thanks & Regards,
>> Ishara Cooray
>> Senior Software Engineer
>> Mobile : +9477 262 9512 <+94%2077%20262%209512>
>> WSO2, Inc. | http://wso2.com/
>> Lean . Enterprise . Middleware
>>
>> On Tue, Jan 10, 2017 at 11:29 AM, Akalanka Pagoda Arachchi <
>> darsha...@wso2.com> wrote:
>>
>>> We can say that the string we use is a reserved keyword. In any complex
>>> system we have to have such restriction in order address these kind of
>>> issues.
>>>
>>> On Tue, Jan 10, 2017 at 11:23 AM, Malintha Amarasinghe <
>>> malint...@wso2.com> wrote:
>>>


 On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi <
 darsha...@wso2.com> wrote:

> Replacing an empty string with a space is generally a bad practice in
> database perspective due to few reasons.
>
> 1. Issues with visibility (a DBA cannot tell the difference by
> directly looking at it)
> 2. As Madhawa pointed out, space is a different character and when we
> really want to represent a space in the column and differentiate between
> the empty and the space, it will be impossible.
> 3. Adds processing complexity
>
> The suggestion to use a space for empty strings is actually to denote
> an empty string by a special character since empty string is not supported
> in Oracle. Therefore instead of using a meaningless space character which
> introduces more complexity why not use a special string such as NULL or
> EMPTY?
>
 If we select a special string we should ensure that those will never
 come as a user input; I am doubtful we can assume that always.. Otherwise
 if a user give "NULL" as an input, it will come back as "" right?

>
> Thanks,
> Akalanka.
>
> On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara <
> madha...@wso2.com> wrote:
>
>> So what will happen if the user sends a space? So It's better to add
>> a configuration to avoid these situations. then user can handle this. 
>> WDYT ?
>>
>> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
>> uvin...@wso2.com> wrote:
>>
>>> To be more precise, if a user explicitly sends "" then we will set
>>> the value to space, enabling us to convert back to "".
>>>
>>> But if the field is not set(ignored by the user) then the default
>>> NULL will be saved. This will make things consistant across all DB's.
>>>
>>> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha <
>>> uvin...@wso2.com> wrote:
>>>
 Note that there is a clear break in the UX of the REST API if we
 allow pass empty strings to Oracle(due to the conversion to NULL). 
 Oracle
 treats "" as NULL but this is incorrect in the REST/JSON world.

 If a user enters an empty string "" they will expect to get ""
 back, which will not happen with Oracles default behaviour. Therefore 
 in
 order to keep consistency of the REST API I dont see an alternative 
 other
 than having space as the default value. We can get rid of the space 
 when
 returning by simply trimming the String so we don't need to have any
 special filtering logic.

 On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
 darsha...@wso2.com> wrote:

> +1 to keep default as NULL instead of a space.
>
> Having a space will require adding trimming logic to the
> underlying code and methods like 'isNullOrEmpty' will bypass this 
> string if
> there's a space.
>
> Thanks,
> Akalanka.
>
> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
> wrote:
>
>>
>>
>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa <
>> isu...@wso2.com> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
>>> uvin...@wso2.com> wrote:
>>>
 Setting a default value for empty fields being sent seems to be
 best.

 Furthermore we can have 

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Malintha Amarasinghe
If we can fix this without breaking the user experience is ideal. But the
problem I see is how can we manage those changes; are we going to do that
in each and every query? If we miss one place that will introduce a bug. Is
there any way we can manage this in a central manner?

On Tue, Jan 10, 2017 at 11:46 AM, Ishara Cooray  wrote:

> IMO user experience is the most important thing and what ever the logic we
> have implemented should not do any difference in end user experience.
> Hence, keeping things simple, prefer using a space character if and only
> if user has provided an empty string. Otherwise keep the default value.
>
>
>
> Thanks & Regards,
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512 <+94%2077%20262%209512>
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> On Tue, Jan 10, 2017 at 11:29 AM, Akalanka Pagoda Arachchi <
> darsha...@wso2.com> wrote:
>
>> We can say that the string we use is a reserved keyword. In any complex
>> system we have to have such restriction in order address these kind of
>> issues.
>>
>> On Tue, Jan 10, 2017 at 11:23 AM, Malintha Amarasinghe <
>> malint...@wso2.com> wrote:
>>
>>>
>>>
>>> On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi <
>>> darsha...@wso2.com> wrote:
>>>
 Replacing an empty string with a space is generally a bad practice in
 database perspective due to few reasons.

 1. Issues with visibility (a DBA cannot tell the difference by directly
 looking at it)
 2. As Madhawa pointed out, space is a different character and when we
 really want to represent a space in the column and differentiate between
 the empty and the space, it will be impossible.
 3. Adds processing complexity

 The suggestion to use a space for empty strings is actually to denote
 an empty string by a special character since empty string is not supported
 in Oracle. Therefore instead of using a meaningless space character which
 introduces more complexity why not use a special string such as NULL or
 EMPTY?

>>> If we select a special string we should ensure that those will never
>>> come as a user input; I am doubtful we can assume that always.. Otherwise
>>> if a user give "NULL" as an input, it will come back as "" right?
>>>

 Thanks,
 Akalanka.

 On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara >>> > wrote:

> So what will happen if the user sends a space? So It's better to add a
> configuration to avoid these situations. then user can handle this. WDYT ?
>
> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
> uvin...@wso2.com> wrote:
>
>> To be more precise, if a user explicitly sends "" then we will set
>> the value to space, enabling us to convert back to "".
>>
>> But if the field is not set(ignored by the user) then the default
>> NULL will be saved. This will make things consistant across all DB's.
>>
>> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha > > wrote:
>>
>>> Note that there is a clear break in the UX of the REST API if we
>>> allow pass empty strings to Oracle(due to the conversion to NULL). 
>>> Oracle
>>> treats "" as NULL but this is incorrect in the REST/JSON world.
>>>
>>> If a user enters an empty string "" they will expect to get "" back,
>>> which will not happen with Oracles default behaviour. Therefore in 
>>> order to
>>> keep consistency of the REST API I dont see an alternative other than
>>> having space as the default value. We can get rid of the space when
>>> returning by simply trimming the String so we don't need to have any
>>> special filtering logic.
>>>
>>> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
>>> darsha...@wso2.com> wrote:
>>>
 +1 to keep default as NULL instead of a space.

 Having a space will require adding trimming logic to the underlying
 code and methods like 'isNullOrEmpty' will bypass this string if 
 there's a
 space.

 Thanks,
 Akalanka.

 On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
 wrote:

>
>
> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa  > wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
>> uvin...@wso2.com> wrote:
>>
>>> Setting a default value for empty fields being sent seems to be
>>> best.
>>>
>>> Furthermore we can have default values set in our DTO objects in
>>> case a given field is omitted altogether.
>>>
>>> So handling both the above scenarios can overcome the limitation
>>> in Oracle.
>>>
>>> But I dont know if this is good for the REST API user
>>> experience, when retrieving data that contains these default values.
>>>

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Ishara Cooray
IMO user experience is the most important thing and what ever the logic we
have implemented should not do any difference in end user experience.
Hence, keeping things simple, prefer using a space character if and only if
user has provided an empty string. Otherwise keep the default value.



Thanks & Regards,
Ishara Cooray
Senior Software Engineer
Mobile : +9477 262 9512
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

On Tue, Jan 10, 2017 at 11:29 AM, Akalanka Pagoda Arachchi <
darsha...@wso2.com> wrote:

> We can say that the string we use is a reserved keyword. In any complex
> system we have to have such restriction in order address these kind of
> issues.
>
> On Tue, Jan 10, 2017 at 11:23 AM, Malintha Amarasinghe  > wrote:
>
>>
>>
>> On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi <
>> darsha...@wso2.com> wrote:
>>
>>> Replacing an empty string with a space is generally a bad practice in
>>> database perspective due to few reasons.
>>>
>>> 1. Issues with visibility (a DBA cannot tell the difference by directly
>>> looking at it)
>>> 2. As Madhawa pointed out, space is a different character and when we
>>> really want to represent a space in the column and differentiate between
>>> the empty and the space, it will be impossible.
>>> 3. Adds processing complexity
>>>
>>> The suggestion to use a space for empty strings is actually to denote an
>>> empty string by a special character since empty string is not supported in
>>> Oracle. Therefore instead of using a meaningless space character which
>>> introduces more complexity why not use a special string such as NULL or
>>> EMPTY?
>>>
>> If we select a special string we should ensure that those will never come
>> as a user input; I am doubtful we can assume that always.. Otherwise if a
>> user give "NULL" as an input, it will come back as "" right?
>>
>>>
>>> Thanks,
>>> Akalanka.
>>>
>>> On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara 
>>> wrote:
>>>
 So what will happen if the user sends a space? So It's better to add a
 configuration to avoid these situations. then user can handle this. WDYT ?

 On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
 uvin...@wso2.com> wrote:

> To be more precise, if a user explicitly sends "" then we will set the
> value to space, enabling us to convert back to "".
>
> But if the field is not set(ignored by the user) then the default NULL
> will be saved. This will make things consistant across all DB's.
>
> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
> wrote:
>
>> Note that there is a clear break in the UX of the REST API if we
>> allow pass empty strings to Oracle(due to the conversion to NULL). Oracle
>> treats "" as NULL but this is incorrect in the REST/JSON world.
>>
>> If a user enters an empty string "" they will expect to get "" back,
>> which will not happen with Oracles default behaviour. Therefore in order 
>> to
>> keep consistency of the REST API I dont see an alternative other than
>> having space as the default value. We can get rid of the space when
>> returning by simply trimming the String so we don't need to have any
>> special filtering logic.
>>
>> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
>> darsha...@wso2.com> wrote:
>>
>>> +1 to keep default as NULL instead of a space.
>>>
>>> Having a space will require adding trimming logic to the underlying
>>> code and methods like 'isNullOrEmpty' will bypass this string if 
>>> there's a
>>> space.
>>>
>>> Thanks,
>>> Akalanka.
>>>
>>> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
>>> wrote:
>>>


 On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
 wrote:

>
>
> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
> uvin...@wso2.com> wrote:
>
>> Setting a default value for empty fields being sent seems to be
>> best.
>>
>> Furthermore we can have default values set in our DTO objects in
>> case a given field is omitted altogether.
>>
>> So handling both the above scenarios can overcome the limitation
>> in Oracle.
>>
>> But I dont know if this is good for the REST API user experience,
>> when retrieving data that contains these default values.
>>
> Additionally this could affect the user experience in UIs as well.
>
> How about we just keep a default value to NULL in DB level and
> then filter it from UI? Since anyway Oracle treats zero length String 
> as
> NULLs, even if the user enters an empty String it will then be
> automatically. The rest API will still return the default value if 
> invoked
> directly though.
>

 +1 to keep default as NULL which is 

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Akalanka Pagoda Arachchi
We can say that the string we use is a reserved keyword. In any complex
system we have to have such restriction in order address these kind of
issues.

On Tue, Jan 10, 2017 at 11:23 AM, Malintha Amarasinghe 
wrote:

>
>
> On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi <
> darsha...@wso2.com> wrote:
>
>> Replacing an empty string with a space is generally a bad practice in
>> database perspective due to few reasons.
>>
>> 1. Issues with visibility (a DBA cannot tell the difference by directly
>> looking at it)
>> 2. As Madhawa pointed out, space is a different character and when we
>> really want to represent a space in the column and differentiate between
>> the empty and the space, it will be impossible.
>> 3. Adds processing complexity
>>
>> The suggestion to use a space for empty strings is actually to denote an
>> empty string by a special character since empty string is not supported in
>> Oracle. Therefore instead of using a meaningless space character which
>> introduces more complexity why not use a special string such as NULL or
>> EMPTY?
>>
> If we select a special string we should ensure that those will never come
> as a user input; I am doubtful we can assume that always.. Otherwise if a
> user give "NULL" as an input, it will come back as "" right?
>
>>
>> Thanks,
>> Akalanka.
>>
>> On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara 
>> wrote:
>>
>>> So what will happen if the user sends a space? So It's better to add a
>>> configuration to avoid these situations. then user can handle this. WDYT ?
>>>
>>> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
>>> uvin...@wso2.com> wrote:
>>>
 To be more precise, if a user explicitly sends "" then we will set the
 value to space, enabling us to convert back to "".

 But if the field is not set(ignored by the user) then the default NULL
 will be saved. This will make things consistant across all DB's.

 On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
 wrote:

> Note that there is a clear break in the UX of the REST API if we allow
> pass empty strings to Oracle(due to the conversion to NULL). Oracle treats
> "" as NULL but this is incorrect in the REST/JSON world.
>
> If a user enters an empty string "" they will expect to get "" back,
> which will not happen with Oracles default behaviour. Therefore in order 
> to
> keep consistency of the REST API I dont see an alternative other than
> having space as the default value. We can get rid of the space when
> returning by simply trimming the String so we don't need to have any
> special filtering logic.
>
> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
> darsha...@wso2.com> wrote:
>
>> +1 to keep default as NULL instead of a space.
>>
>> Having a space will require adding trimming logic to the underlying
>> code and methods like 'isNullOrEmpty' will bypass this string if there's 
>> a
>> space.
>>
>> Thanks,
>> Akalanka.
>>
>> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
>> wrote:
>>
>>>
>>>
>>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
>>> wrote:
>>>


 On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
 uvin...@wso2.com> wrote:

> Setting a default value for empty fields being sent seems to be
> best.
>
> Furthermore we can have default values set in our DTO objects in
> case a given field is omitted altogether.
>
> So handling both the above scenarios can overcome the limitation
> in Oracle.
>
> But I dont know if this is good for the REST API user experience,
> when retrieving data that contains these default values.
>
 Additionally this could affect the user experience in UIs as well.

 How about we just keep a default value to NULL in DB level and then
 filter it from UI? Since anyway Oracle treats zero length String as 
 NULLs,
 even if the user enters an empty String it will then be automatically. 
 The
 rest API will still return the default value if invoked directly 
 though.

>>>
>>> +1 to keep default as NULL which is more natural
>>> Further rather than filtering in the UI, how about directly do it in
>>> the query itself using COALESCE() built-in function (which is an ANSI
>>> standard and better performing than IS NULL)
>>>
>>> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field
>>> value is null it will map to empty
>>>
>>>
>>>
> On 6 January 2017 at 15:28, Tharindu Dharmarathna <
> tharin...@wso2.com> wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
>> tharin...@wso2.com> wrote:
>>
>>> Hi All,

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Uvindra Dias Jayasinha
On 10 January 2017 at 11:10, Akalanka Pagoda Arachchi 
wrote:

> Replacing an empty string with a space is generally a bad practice in
> database perspective due to few reasons.
>
> 1. Issues with visibility (a DBA cannot tell the difference by directly
> looking at it)
> 2. As Madhawa pointed out, space is a different character and when we
> really want to represent a space in the column and differentiate between
> the empty and the space, it will be impossible.
> 3. Adds processing complexity
>
> The suggestion to use a space for empty strings is actually to denote an
> empty string by a special character since empty string is not supported in
> Oracle. Therefore instead of using a meaningless space character which
> introduces more complexity why not use a special string such as NULL or
> EMPTY?
>

These are good points, but by using a special string to represent an empty
string we don't avoid complexity to the code because we need to check the
value of what has been read from the DB and explicitly replace that with an
empty string before sending back to the client. This logic also breaks if
the user by chance sends that special string explicitly.

We have not found an elegant way of doing this that balances all sides. Its
a pity Oracle deviates from the standard practice of other DBs in this
regard.


>
> Thanks,
> Akalanka.
>
> On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara 
> wrote:
>
>> So what will happen if the user sends a space? So It's better to add a
>> configuration to avoid these situations. then user can handle this. WDYT ?
>>
>> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
>> uvin...@wso2.com> wrote:
>>
>>> To be more precise, if a user explicitly sends "" then we will set the
>>> value to space, enabling us to convert back to "".
>>>
>>> But if the field is not set(ignored by the user) then the default NULL
>>> will be saved. This will make things consistant across all DB's.
>>>
>>> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
>>> wrote:
>>>
 Note that there is a clear break in the UX of the REST API if we allow
 pass empty strings to Oracle(due to the conversion to NULL). Oracle treats
 "" as NULL but this is incorrect in the REST/JSON world.

 If a user enters an empty string "" they will expect to get "" back,
 which will not happen with Oracles default behaviour. Therefore in order to
 keep consistency of the REST API I dont see an alternative other than
 having space as the default value. We can get rid of the space when
 returning by simply trimming the String so we don't need to have any
 special filtering logic.

 On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
 darsha...@wso2.com> wrote:

> +1 to keep default as NULL instead of a space.
>
> Having a space will require adding trimming logic to the underlying
> code and methods like 'isNullOrEmpty' will bypass this string if there's a
> space.
>
> Thanks,
> Akalanka.
>
> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
> wrote:
>
>>
>>
>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
>> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
>>> uvin...@wso2.com> wrote:
>>>
 Setting a default value for empty fields being sent seems to be
 best.

 Furthermore we can have default values set in our DTO objects in
 case a given field is omitted altogether.

 So handling both the above scenarios can overcome the limitation in
 Oracle.

 But I dont know if this is good for the REST API user experience,
 when retrieving data that contains these default values.

>>> Additionally this could affect the user experience in UIs as well.
>>>
>>> How about we just keep a default value to NULL in DB level and then
>>> filter it from UI? Since anyway Oracle treats zero length String as 
>>> NULLs,
>>> even if the user enters an empty String it will then be automatically. 
>>> The
>>> rest API will still return the default value if invoked directly though.
>>>
>>
>> +1 to keep default as NULL which is more natural
>> Further rather than filtering in the UI, how about directly do it in
>> the query itself using COALESCE() built-in function (which is an ANSI
>> standard and better performing than IS NULL)
>>
>> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field
>> value is null it will map to empty
>>
>>
>>
 On 6 January 2017 at 15:28, Tharindu Dharmarathna <
 tharin...@wso2.com> wrote:

>
>
> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
> tharin...@wso2.com> wrote:
>
>> Hi All,
>>
>> I faced $Subject in Oracle database while running integration
>> test o

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Malintha Amarasinghe
On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi <
darsha...@wso2.com> wrote:

> Replacing an empty string with a space is generally a bad practice in
> database perspective due to few reasons.
>
> 1. Issues with visibility (a DBA cannot tell the difference by directly
> looking at it)
> 2. As Madhawa pointed out, space is a different character and when we
> really want to represent a space in the column and differentiate between
> the empty and the space, it will be impossible.
> 3. Adds processing complexity
>
> The suggestion to use a space for empty strings is actually to denote an
> empty string by a special character since empty string is not supported in
> Oracle. Therefore instead of using a meaningless space character which
> introduces more complexity why not use a special string such as NULL or
> EMPTY?
>
If we select a special string we should ensure that those will never come
as a user input; I am doubtful we can assume that always.. Otherwise if a
user give "NULL" as an input, it will come back as "" right?

>
> Thanks,
> Akalanka.
>
> On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara 
> wrote:
>
>> So what will happen if the user sends a space? So It's better to add a
>> configuration to avoid these situations. then user can handle this. WDYT ?
>>
>> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha <
>> uvin...@wso2.com> wrote:
>>
>>> To be more precise, if a user explicitly sends "" then we will set the
>>> value to space, enabling us to convert back to "".
>>>
>>> But if the field is not set(ignored by the user) then the default NULL
>>> will be saved. This will make things consistant across all DB's.
>>>
>>> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
>>> wrote:
>>>
 Note that there is a clear break in the UX of the REST API if we allow
 pass empty strings to Oracle(due to the conversion to NULL). Oracle treats
 "" as NULL but this is incorrect in the REST/JSON world.

 If a user enters an empty string "" they will expect to get "" back,
 which will not happen with Oracles default behaviour. Therefore in order to
 keep consistency of the REST API I dont see an alternative other than
 having space as the default value. We can get rid of the space when
 returning by simply trimming the String so we don't need to have any
 special filtering logic.

 On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
 darsha...@wso2.com> wrote:

> +1 to keep default as NULL instead of a space.
>
> Having a space will require adding trimming logic to the underlying
> code and methods like 'isNullOrEmpty' will bypass this string if there's a
> space.
>
> Thanks,
> Akalanka.
>
> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
> wrote:
>
>>
>>
>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
>> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
>>> uvin...@wso2.com> wrote:
>>>
 Setting a default value for empty fields being sent seems to be
 best.

 Furthermore we can have default values set in our DTO objects in
 case a given field is omitted altogether.

 So handling both the above scenarios can overcome the limitation in
 Oracle.

 But I dont know if this is good for the REST API user experience,
 when retrieving data that contains these default values.

>>> Additionally this could affect the user experience in UIs as well.
>>>
>>> How about we just keep a default value to NULL in DB level and then
>>> filter it from UI? Since anyway Oracle treats zero length String as 
>>> NULLs,
>>> even if the user enters an empty String it will then be automatically. 
>>> The
>>> rest API will still return the default value if invoked directly though.
>>>
>>
>> +1 to keep default as NULL which is more natural
>> Further rather than filtering in the UI, how about directly do it in
>> the query itself using COALESCE() built-in function (which is an ANSI
>> standard and better performing than IS NULL)
>>
>> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field
>> value is null it will map to empty
>>
>>
>>
 On 6 January 2017 at 15:28, Tharindu Dharmarathna <
 tharin...@wso2.com> wrote:

>
>
> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
> tharin...@wso2.com> wrote:
>
>> Hi All,
>>
>> I faced $Subject in Oracle database while running integration
>> test on C5 on top.
>>
>> *Observation*
>>
>> when insert empty string ("") it was save as null in database.
>>
>> While going through SO I had found [1] , which did happen in
>> oracle database.
>>
>>
>> W

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Uvindra Dias Jayasinha
This did come up in discussion. Functionally speaking a space is no
different to an empty String, though technically they are different. So it
will be a trade off to ignore explicitly sent spaces by users.

On 10 January 2017 at 11:01, Madhawa Gunasekara  wrote:

> So what will happen if the user sends a space? So It's better to add a
> configuration to avoid these situations. then user can handle this. WDYT ?
>
> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha  > wrote:
>
>> To be more precise, if a user explicitly sends "" then we will set the
>> value to space, enabling us to convert back to "".
>>
>> But if the field is not set(ignored by the user) then the default NULL
>> will be saved. This will make things consistant across all DB's.
>>
>> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
>> wrote:
>>
>>> Note that there is a clear break in the UX of the REST API if we allow
>>> pass empty strings to Oracle(due to the conversion to NULL). Oracle treats
>>> "" as NULL but this is incorrect in the REST/JSON world.
>>>
>>> If a user enters an empty string "" they will expect to get "" back,
>>> which will not happen with Oracles default behaviour. Therefore in order to
>>> keep consistency of the REST API I dont see an alternative other than
>>> having space as the default value. We can get rid of the space when
>>> returning by simply trimming the String so we don't need to have any
>>> special filtering logic.
>>>
>>> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
>>> darsha...@wso2.com> wrote:
>>>
 +1 to keep default as NULL instead of a space.

 Having a space will require adding trimming logic to the underlying
 code and methods like 'isNullOrEmpty' will bypass this string if there's a
 space.

 Thanks,
 Akalanka.

 On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
 wrote:

>
>
> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
> wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
>> uvin...@wso2.com> wrote:
>>
>>> Setting a default value for empty fields being sent seems to be best.
>>>
>>> Furthermore we can have default values set in our DTO objects in
>>> case a given field is omitted altogether.
>>>
>>> So handling both the above scenarios can overcome the limitation in
>>> Oracle.
>>>
>>> But I dont know if this is good for the REST API user experience,
>>> when retrieving data that contains these default values.
>>>
>> Additionally this could affect the user experience in UIs as well.
>>
>> How about we just keep a default value to NULL in DB level and then
>> filter it from UI? Since anyway Oracle treats zero length String as 
>> NULLs,
>> even if the user enters an empty String it will then be automatically. 
>> The
>> rest API will still return the default value if invoked directly though.
>>
>
> +1 to keep default as NULL which is more natural
> Further rather than filtering in the UI, how about directly do it in
> the query itself using COALESCE() built-in function (which is an ANSI
> standard and better performing than IS NULL)
>
> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field
> value is null it will map to empty
>
>
>
>>> On 6 January 2017 at 15:28, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>


 On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
 tharin...@wso2.com> wrote:

> Hi All,
>
> I faced $Subject in Oracle database while running integration test
> on C5 on top.
>
> *Observation*
>
> when insert empty string ("") it was save as null in database.
>
> While going through SO I had found [1] , which did happen in
> oracle database.
>
>
> We have come up with several ways to handle empty strings which
> user sends through the rest api.
>
> 1.  Validate the request and send error when giving empty strings
> 2.  Set default value like "N/A" into the fields which send as
> empty.
>
> Is there any other way to handle this problem ?.
>
> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
> string-in-oracle
>
> Thanks
>
>
> *Tharindu Dharmarathna*Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <+94%2077%20910%209091>*
>



 --

 *Tharindu Dharmarathna*Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: *+94779109091 <+94%2077%20910%209091>*

>>>
>>>
>>>
>>> --
>>> Regards,
>

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Akalanka Pagoda Arachchi
Replacing an empty string with a space is generally a bad practice in
database perspective due to few reasons.

1. Issues with visibility (a DBA cannot tell the difference by directly
looking at it)
2. As Madhawa pointed out, space is a different character and when we
really want to represent a space in the column and differentiate between
the empty and the space, it will be impossible.
3. Adds processing complexity

The suggestion to use a space for empty strings is actually to denote an
empty string by a special character since empty string is not supported in
Oracle. Therefore instead of using a meaningless space character which
introduces more complexity why not use a special string such as NULL or
EMPTY?

Thanks,
Akalanka.

On Tue, Jan 10, 2017 at 11:01 AM, Madhawa Gunasekara 
wrote:

> So what will happen if the user sends a space? So It's better to add a
> configuration to avoid these situations. then user can handle this. WDYT ?
>
> On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha  > wrote:
>
>> To be more precise, if a user explicitly sends "" then we will set the
>> value to space, enabling us to convert back to "".
>>
>> But if the field is not set(ignored by the user) then the default NULL
>> will be saved. This will make things consistant across all DB's.
>>
>> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
>> wrote:
>>
>>> Note that there is a clear break in the UX of the REST API if we allow
>>> pass empty strings to Oracle(due to the conversion to NULL). Oracle treats
>>> "" as NULL but this is incorrect in the REST/JSON world.
>>>
>>> If a user enters an empty string "" they will expect to get "" back,
>>> which will not happen with Oracles default behaviour. Therefore in order to
>>> keep consistency of the REST API I dont see an alternative other than
>>> having space as the default value. We can get rid of the space when
>>> returning by simply trimming the String so we don't need to have any
>>> special filtering logic.
>>>
>>> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi <
>>> darsha...@wso2.com> wrote:
>>>
 +1 to keep default as NULL instead of a space.

 Having a space will require adding trimming logic to the underlying
 code and methods like 'isNullOrEmpty' will bypass this string if there's a
 space.

 Thanks,
 Akalanka.

 On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
 wrote:

>
>
> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
> wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
>> uvin...@wso2.com> wrote:
>>
>>> Setting a default value for empty fields being sent seems to be best.
>>>
>>> Furthermore we can have default values set in our DTO objects in
>>> case a given field is omitted altogether.
>>>
>>> So handling both the above scenarios can overcome the limitation in
>>> Oracle.
>>>
>>> But I dont know if this is good for the REST API user experience,
>>> when retrieving data that contains these default values.
>>>
>> Additionally this could affect the user experience in UIs as well.
>>
>> How about we just keep a default value to NULL in DB level and then
>> filter it from UI? Since anyway Oracle treats zero length String as 
>> NULLs,
>> even if the user enters an empty String it will then be automatically. 
>> The
>> rest API will still return the default value if invoked directly though.
>>
>
> +1 to keep default as NULL which is more natural
> Further rather than filtering in the UI, how about directly do it in
> the query itself using COALESCE() built-in function (which is an ANSI
> standard and better performing than IS NULL)
>
> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field
> value is null it will map to empty
>
>
>
>>> On 6 January 2017 at 15:28, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>


 On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
 tharin...@wso2.com> wrote:

> Hi All,
>
> I faced $Subject in Oracle database while running integration test
> on C5 on top.
>
> *Observation*
>
> when insert empty string ("") it was save as null in database.
>
> While going through SO I had found [1] , which did happen in
> oracle database.
>
>
> We have come up with several ways to handle empty strings which
> user sends through the rest api.
>
> 1.  Validate the request and send error when giving empty strings
> 2.  Set default value like "N/A" into the fields which send as
> empty.
>
> Is there any other way to handle this problem ?.
>
> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
> string-in-oracle
>

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Madhawa Gunasekara
So what will happen if the user sends a space? So It's better to add a
configuration to avoid these situations. then user can handle this. WDYT ?

On Tue, Jan 10, 2017 at 10:54 AM, Uvindra Dias Jayasinha 
wrote:

> To be more precise, if a user explicitly sends "" then we will set the
> value to space, enabling us to convert back to "".
>
> But if the field is not set(ignored by the user) then the default NULL
> will be saved. This will make things consistant across all DB's.
>
> On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
> wrote:
>
>> Note that there is a clear break in the UX of the REST API if we allow
>> pass empty strings to Oracle(due to the conversion to NULL). Oracle treats
>> "" as NULL but this is incorrect in the REST/JSON world.
>>
>> If a user enters an empty string "" they will expect to get "" back,
>> which will not happen with Oracles default behaviour. Therefore in order to
>> keep consistency of the REST API I dont see an alternative other than
>> having space as the default value. We can get rid of the space when
>> returning by simply trimming the String so we don't need to have any
>> special filtering logic.
>>
>> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi > > wrote:
>>
>>> +1 to keep default as NULL instead of a space.
>>>
>>> Having a space will require adding trimming logic to the underlying code
>>> and methods like 'isNullOrEmpty' will bypass this string if there's a space.
>>>
>>> Thanks,
>>> Akalanka.
>>>
>>> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray 
>>> wrote:
>>>


 On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
 wrote:

>
>
> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
> uvin...@wso2.com> wrote:
>
>> Setting a default value for empty fields being sent seems to be best.
>>
>> Furthermore we can have default values set in our DTO objects in case
>> a given field is omitted altogether.
>>
>> So handling both the above scenarios can overcome the limitation in
>> Oracle.
>>
>> But I dont know if this is good for the REST API user experience,
>> when retrieving data that contains these default values.
>>
> Additionally this could affect the user experience in UIs as well.
>
> How about we just keep a default value to NULL in DB level and then
> filter it from UI? Since anyway Oracle treats zero length String as NULLs,
> even if the user enters an empty String it will then be automatically. The
> rest API will still return the default value if invoked directly though.
>

 +1 to keep default as NULL which is more natural
 Further rather than filtering in the UI, how about directly do it in
 the query itself using COALESCE() built-in function (which is an ANSI
 standard and better performing than IS NULL)

 eg: SELECT COALESCE(field_name,'')  as field_name  //if the field value
 is null it will map to empty



>> On 6 January 2017 at 15:28, Tharindu Dharmarathna > > wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>
 Hi All,

 I faced $Subject in Oracle database while running integration test
 on C5 on top.

 *Observation*

 when insert empty string ("") it was save as null in database.

 While going through SO I had found [1] , which did happen in oracle
 database.


 We have come up with several ways to handle empty strings which
 user sends through the rest api.

 1.  Validate the request and send error when giving empty strings
 2.  Set default value like "N/A" into the fields which send as
 empty.

 Is there any other way to handle this problem ?.

 [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
 string-in-oracle

 Thanks


 *Tharindu Dharmarathna*Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: *+94779109091 <+94%2077%20910%209091>*

>>>
>>>
>>>
>>> --
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 33962
>>
>
>
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048 <+94%2071%20635%208048>* *
>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


 --
 *Lahiru Cooray*
 Software Engineer
 WSO2, Inc.;http://wso2.com/
>>

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Uvindra Dias Jayasinha
To be more precise, if a user explicitly sends "" then we will set the
value to space, enabling us to convert back to "".

But if the field is not set(ignored by the user) then the default NULL will
be saved. This will make things consistant across all DB's.

On 10 January 2017 at 10:41, Uvindra Dias Jayasinha 
wrote:

> Note that there is a clear break in the UX of the REST API if we allow
> pass empty strings to Oracle(due to the conversion to NULL). Oracle treats
> "" as NULL but this is incorrect in the REST/JSON world.
>
> If a user enters an empty string "" they will expect to get "" back, which
> will not happen with Oracles default behaviour. Therefore in order to keep
> consistency of the REST API I dont see an alternative other than having
> space as the default value. We can get rid of the space when returning by
> simply trimming the String so we don't need to have any special filtering
> logic.
>
> On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi 
> wrote:
>
>> +1 to keep default as NULL instead of a space.
>>
>> Having a space will require adding trimming logic to the underlying code
>> and methods like 'isNullOrEmpty' will bypass this string if there's a space.
>>
>> Thanks,
>> Akalanka.
>>
>> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray  wrote:
>>
>>>
>>>
>>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
>>> wrote:
>>>


 On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha <
 uvin...@wso2.com> wrote:

> Setting a default value for empty fields being sent seems to be best.
>
> Furthermore we can have default values set in our DTO objects in case
> a given field is omitted altogether.
>
> So handling both the above scenarios can overcome the limitation in
> Oracle.
>
> But I dont know if this is good for the REST API user experience, when
> retrieving data that contains these default values.
>
 Additionally this could affect the user experience in UIs as well.

 How about we just keep a default value to NULL in DB level and then
 filter it from UI? Since anyway Oracle treats zero length String as NULLs,
 even if the user enters an empty String it will then be automatically. The
 rest API will still return the default value if invoked directly though.

>>>
>>> +1 to keep default as NULL which is more natural
>>> Further rather than filtering in the UI, how about directly do it in the
>>> query itself using COALESCE() built-in function (which is an ANSI standard
>>> and better performing than IS NULL)
>>>
>>> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field value
>>> is null it will map to empty
>>>
>>>
>>>
> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
> wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
>> tharin...@wso2.com> wrote:
>>
>>> Hi All,
>>>
>>> I faced $Subject in Oracle database while running integration test
>>> on C5 on top.
>>>
>>> *Observation*
>>>
>>> when insert empty string ("") it was save as null in database.
>>>
>>> While going through SO I had found [1] , which did happen in oracle
>>> database.
>>>
>>>
>>> We have come up with several ways to handle empty strings which user
>>> sends through the rest api.
>>>
>>> 1.  Validate the request and send error when giving empty strings
>>> 2.  Set default value like "N/A" into the fields which send as
>>> empty.
>>>
>>> Is there any other way to handle this problem ?.
>>>
>>> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
>>> string-in-oracle
>>>
>>> Thanks
>>>
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>>
>> *Tharindu Dharmarathna*Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>
>
>
>
> --
> Regards,
> Uvindra
>
> Mobile: 33962
>



 --
 Thanks and Regards,

 Isuru H.
 +94 716 358 048 <+94%2071%20635%208048>* *



 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev


>>>
>>>
>>> --
>>> *Lahiru Cooray*
>>> Software Engineer
>>> WSO2, Inc.;http://wso2.com/
>>> lean.enterprise.middleware
>>>
>>> Mobile: +94 715 654154 <+94%2071%20565%204154>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Darshana Akalanka Pagoda Arachchi,*
>> *Senior Software Engineer, WSO2*
>> *+94777118016 <+94%2077%20711%208016>*
>>
>> _

Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Uvindra Dias Jayasinha
Note that there is a clear break in the UX of the REST API if we allow pass
empty strings to Oracle(due to the conversion to NULL). Oracle treats "" as
NULL but this is incorrect in the REST/JSON world.

If a user enters an empty string "" they will expect to get "" back, which
will not happen with Oracles default behaviour. Therefore in order to keep
consistency of the REST API I dont see an alternative other than having
space as the default value. We can get rid of the space when returning by
simply trimming the String so we don't need to have any special filtering
logic.

On 10 January 2017 at 10:34, Akalanka Pagoda Arachchi 
wrote:

> +1 to keep default as NULL instead of a space.
>
> Having a space will require adding trimming logic to the underlying code
> and methods like 'isNullOrEmpty' will bypass this string if there's a space.
>
> Thanks,
> Akalanka.
>
> On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray  wrote:
>
>>
>>
>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa 
>> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha >> > wrote:
>>>
 Setting a default value for empty fields being sent seems to be best.

 Furthermore we can have default values set in our DTO objects in case a
 given field is omitted altogether.

 So handling both the above scenarios can overcome the limitation in
 Oracle.

 But I dont know if this is good for the REST API user experience, when
 retrieving data that contains these default values.

>>> Additionally this could affect the user experience in UIs as well.
>>>
>>> How about we just keep a default value to NULL in DB level and then
>>> filter it from UI? Since anyway Oracle treats zero length String as NULLs,
>>> even if the user enters an empty String it will then be automatically. The
>>> rest API will still return the default value if invoked directly though.
>>>
>>
>> +1 to keep default as NULL which is more natural
>> Further rather than filtering in the UI, how about directly do it in the
>> query itself using COALESCE() built-in function (which is an ANSI standard
>> and better performing than IS NULL)
>>
>> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field value
>> is null it will map to empty
>>
>>
>>
 On 6 January 2017 at 15:28, Tharindu Dharmarathna 
 wrote:

>
>
> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
> tharin...@wso2.com> wrote:
>
>> Hi All,
>>
>> I faced $Subject in Oracle database while running integration test on
>> C5 on top.
>>
>> *Observation*
>>
>> when insert empty string ("") it was save as null in database.
>>
>> While going through SO I had found [1] , which did happen in oracle
>> database.
>>
>>
>> We have come up with several ways to handle empty strings which user
>> sends through the rest api.
>>
>> 1.  Validate the request and send error when giving empty strings
>> 2.  Set default value like "N/A" into the fields which send as empty.
>>
>> Is there any other way to handle this problem ?.
>>
>> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
>> string-in-oracle
>>
>> Thanks
>>
>>
>> *Tharindu Dharmarathna*Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>
>
>
>
> --
>
> *Tharindu Dharmarathna*Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <+94%2077%20910%209091>*
>



 --
 Regards,
 Uvindra

 Mobile: 33962

>>>
>>>
>>>
>>> --
>>> Thanks and Regards,
>>>
>>> Isuru H.
>>> +94 716 358 048 <+94%2071%20635%208048>* *
>>>
>>>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Lahiru Cooray*
>> Software Engineer
>> WSO2, Inc.;http://wso2.com/
>> lean.enterprise.middleware
>>
>> Mobile: +94 715 654154 <+94%2071%20565%204154>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Darshana Akalanka Pagoda Arachchi,*
> *Senior Software Engineer, WSO2*
> *+94777118016 <+94%2077%20711%208016>*
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Regards,
Uvindra

Mobile: 33962
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Akalanka Pagoda Arachchi
+1 to keep default as NULL instead of a space.

Having a space will require adding trimming logic to the underlying code
and methods like 'isNullOrEmpty' will bypass this string if there's a space.

Thanks,
Akalanka.

On Tue, Jan 10, 2017 at 10:23 AM, Lahiru Cooray  wrote:

>
>
> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa  wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha 
>> wrote:
>>
>>> Setting a default value for empty fields being sent seems to be best.
>>>
>>> Furthermore we can have default values set in our DTO objects in case a
>>> given field is omitted altogether.
>>>
>>> So handling both the above scenarios can overcome the limitation in
>>> Oracle.
>>>
>>> But I dont know if this is good for the REST API user experience, when
>>> retrieving data that contains these default values.
>>>
>> Additionally this could affect the user experience in UIs as well.
>>
>> How about we just keep a default value to NULL in DB level and then
>> filter it from UI? Since anyway Oracle treats zero length String as NULLs,
>> even if the user enters an empty String it will then be automatically. The
>> rest API will still return the default value if invoked directly though.
>>
>
> +1 to keep default as NULL which is more natural
> Further rather than filtering in the UI, how about directly do it in the
> query itself using COALESCE() built-in function (which is an ANSI standard
> and better performing than IS NULL)
>
> eg: SELECT COALESCE(field_name,'')  as field_name  //if the field value is
> null it will map to empty
>
>
>
>>> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
>>> wrote:
>>>


 On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
 tharin...@wso2.com> wrote:

> Hi All,
>
> I faced $Subject in Oracle database while running integration test on
> C5 on top.
>
> *Observation*
>
> when insert empty string ("") it was save as null in database.
>
> While going through SO I had found [1] , which did happen in oracle
> database.
>
>
> We have come up with several ways to handle empty strings which user
> sends through the rest api.
>
> 1.  Validate the request and send error when giving empty strings
> 2.  Set default value like "N/A" into the fields which send as empty.
>
> Is there any other way to handle this problem ?.
>
> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
> string-in-oracle
>
> Thanks
>
>
> *Tharindu Dharmarathna*Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <+94%2077%20910%209091>*
>



 --

 *Tharindu Dharmarathna*Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: *+94779109091 <+94%2077%20910%209091>*

>>>
>>>
>>>
>>> --
>>> Regards,
>>> Uvindra
>>>
>>> Mobile: 33962
>>>
>>
>>
>>
>> --
>> Thanks and Regards,
>>
>> Isuru H.
>> +94 716 358 048 <+94%2071%20635%208048>* *
>>
>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Lahiru Cooray*
> Software Engineer
> WSO2, Inc.;http://wso2.com/
> lean.enterprise.middleware
>
> Mobile: +94 715 654154 <+94%2071%20565%204154>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Darshana Akalanka Pagoda Arachchi,*
*Senior Software Engineer, WSO2*
*+94777118016*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-09 Thread Lahiru Cooray
On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa  wrote:

>
>
> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha 
> wrote:
>
>> Setting a default value for empty fields being sent seems to be best.
>>
>> Furthermore we can have default values set in our DTO objects in case a
>> given field is omitted altogether.
>>
>> So handling both the above scenarios can overcome the limitation in
>> Oracle.
>>
>> But I dont know if this is good for the REST API user experience, when
>> retrieving data that contains these default values.
>>
> Additionally this could affect the user experience in UIs as well.
>
> How about we just keep a default value to NULL in DB level and then filter
> it from UI? Since anyway Oracle treats zero length String as NULLs, even if
> the user enters an empty String it will then be automatically. The rest API
> will still return the default value if invoked directly though.
>

+1 to keep default as NULL which is more natural
Further rather than filtering in the UI, how about directly do it in the
query itself using COALESCE() built-in function (which is an ANSI standard
and better performing than IS NULL)

eg: SELECT COALESCE(field_name,'')  as field_name  //if the field value is
null it will map to empty



>> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
>> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>
 Hi All,

 I faced $Subject in Oracle database while running integration test on
 C5 on top.

 *Observation*

 when insert empty string ("") it was save as null in database.

 While going through SO I had found [1] , which did happen in oracle
 database.


 We have come up with several ways to handle empty strings which user
 sends through the rest api.

 1.  Validate the request and send error when giving empty strings
 2.  Set default value like "N/A" into the fields which send as empty.

 Is there any other way to handle this problem ?.

 [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
 string-in-oracle

 Thanks


 *Tharindu Dharmarathna*Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: *+94779109091 <+94%2077%20910%209091>*

>>>
>>>
>>>
>>> --
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 33962
>>
>
>
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048 <+94%2071%20635%208048>* *
>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Lahiru Cooray*
Software Engineer
WSO2, Inc.;http://wso2.com/
lean.enterprise.middleware

Mobile: +94 715 654154
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-08 Thread Isuru Haththotuwa
On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa  wrote:

>
>
> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha 
> wrote:
>
>> Setting a default value for empty fields being sent seems to be best.
>>
>> Furthermore we can have default values set in our DTO objects in case a
>> given field is omitted altogether.
>>
>> So handling both the above scenarios can overcome the limitation in
>> Oracle.
>>
>> But I dont know if this is good for the REST API user experience, when
>> retrieving data that contains these default values.
>>
> Additionally this could affect the user experience in UIs as well.
>
> How about we just keep a default value to NULL in DB level and then filter
> it from UI? Since anyway Oracle treats zero length String as NULLs, even if
> the user enters an empty String it will then be automatically. The rest API
> will still return the default value if invoked directly though.
>
s/automatically/automatically filtered/g

>
>> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
>> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>
 Hi All,

 I faced $Subject in Oracle database while running integration test on
 C5 on top.

 *Observation*

 when insert empty string ("") it was save as null in database.

 While going through SO I had found [1] , which did happen in oracle
 database.


 We have come up with several ways to handle empty strings which user
 sends through the rest api.

 1.  Validate the request and send error when giving empty strings
 2.  Set default value like "N/A" into the fields which send as empty.

 Is there any other way to handle this problem ?.

 [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
 string-in-oracle

 Thanks


 *Tharindu Dharmarathna*Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: *+94779109091 <+94%2077%20910%209091>*

>>>
>>>
>>>
>>> --
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 33962
>>
>
>
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048 <071%20635%208048>* *
>
>
>


-- 
Thanks and Regards,

Isuru H.
+94 716 358 048* *
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-08 Thread Isuru Haththotuwa
On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha 
wrote:

> Setting a default value for empty fields being sent seems to be best.
>
> Furthermore we can have default values set in our DTO objects in case a
> given field is omitted altogether.
>
> So handling both the above scenarios can overcome the limitation in Oracle.
>
> But I dont know if this is good for the REST API user experience, when
> retrieving data that contains these default values.
>
Additionally this could affect the user experience in UIs as well.

How about we just keep a default value to NULL in DB level and then filter
it from UI? Since anyway Oracle treats zero length String as NULLs, even if
the user enters an empty String it will then be automatically. The rest API
will still return the default value if invoked directly though.

>
> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
> wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna > > wrote:
>>
>>> Hi All,
>>>
>>> I faced $Subject in Oracle database while running integration test on C5
>>> on top.
>>>
>>> *Observation*
>>>
>>> when insert empty string ("") it was save as null in database.
>>>
>>> While going through SO I had found [1] , which did happen in oracle
>>> database.
>>>
>>>
>>> We have come up with several ways to handle empty strings which user
>>> sends through the rest api.
>>>
>>> 1.  Validate the request and send error when giving empty strings
>>> 2.  Set default value like "N/A" into the fields which send as empty.
>>>
>>> Is there any other way to handle this problem ?.
>>>
>>> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
>>> string-in-oracle
>>>
>>> Thanks
>>>
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>>
>> *Tharindu Dharmarathna*Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>
>
>
>
> --
> Regards,
> Uvindra
>
> Mobile: 33962
>



-- 
Thanks and Regards,

Isuru H.
+94 716 358 048* *
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-08 Thread Gayan Gunawardana
On Sun, Jan 8, 2017 at 5:06 PM, Ishara Cooray  wrote:

> Hi Tharindu,
>
> How about storing space character instead of empty string. i have not
> tried it in Oracle db but if that works IMO there will not be an effect on
> user experience.
>
Yes according to [1] storing space character is a good option.

[1]
http://tharindue.blogspot.com/2015/05/cross-database-programming-tips-for.html

>
> Thanks & Regards,
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512 <+94%2077%20262%209512>
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha 
> wrote:
>
>> Setting a default value for empty fields being sent seems to be best.
>>
>> Furthermore we can have default values set in our DTO objects in case a
>> given field is omitted altogether.
>>
>> So handling both the above scenarios can overcome the limitation in
>> Oracle.
>>
>> But I dont know if this is good for the REST API user experience, when
>> retrieving data that contains these default values.
>>
>> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
>> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>
 Hi All,

 I faced $Subject in Oracle database while running integration test on
 C5 on top.

 *Observation*

 when insert empty string ("") it was save as null in database.

 While going through SO I had found [1] , which did happen in oracle
 database.


 We have come up with several ways to handle empty strings which user
 sends through the rest api.

 1.  Validate the request and send error when giving empty strings
 2.  Set default value like "N/A" into the fields which send as empty.

 Is there any other way to handle this problem ?.

 [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
 string-in-oracle

 Thanks


 *Tharindu Dharmarathna*Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: *+94779109091 <+94%2077%20910%209091>*

>>>
>>>
>>>
>>> --
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 33962
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Gayan Gunawardana
Software Engineer; WSO2 Inc.; http://wso2.com/
Email: ga...@wso2.com
Mobile: +94 (71) 8020933
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-08 Thread Rukshan Premathunga
Hi Tharindu,

If a field allow empty string, which mean it is optional right? So we can
consider it as a null right? But when we try to save empty string on a DB,
if it is persist in a differently, it is better to have a default value
since it will be consistent on all the DBs. So can we set the default value
as NULL here? because even if we persist value as a empty string it is not
a valid value for us.
If so, i think it will help to compare values easily as well.

WDYT?

Thanks and Regards

On Sun, Jan 8, 2017 at 5:06 PM, Ishara Cooray  wrote:

> Hi Tharindu,
>
> How about storing space character instead of empty string. i have not
> tried it in Oracle db but if that works IMO there will not be an effect on
> user experience.
>
> Thanks & Regards,
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512 <+94%2077%20262%209512>
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha 
> wrote:
>
>> Setting a default value for empty fields being sent seems to be best.
>>
>> Furthermore we can have default values set in our DTO objects in case a
>> given field is omitted altogether.
>>
>> So handling both the above scenarios can overcome the limitation in
>> Oracle.
>>
>> But I dont know if this is good for the REST API user experience, when
>> retrieving data that contains these default values.
>>
>> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
>> wrote:
>>
>>>
>>>
>>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna <
>>> tharin...@wso2.com> wrote:
>>>
 Hi All,

 I faced $Subject in Oracle database while running integration test on
 C5 on top.

 *Observation*

 when insert empty string ("") it was save as null in database.

 While going through SO I had found [1] , which did happen in oracle
 database.


 We have come up with several ways to handle empty strings which user
 sends through the rest api.

 1.  Validate the request and send error when giving empty strings
 2.  Set default value like "N/A" into the fields which send as empty.

 Is there any other way to handle this problem ?.

 [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
 string-in-oracle

 Thanks


 *Tharindu Dharmarathna*Software Engineer
 WSO2 Inc.; http://wso2.com
 lean.enterprise.middleware

 mobile: *+94779109091 <+94%2077%20910%209091>*

>>>
>>>
>>>
>>> --
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 33962
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Rukshan Chathuranga.
Software Engineer.
WSO2, Inc.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-08 Thread Ishara Cooray
Hi Tharindu,

How about storing space character instead of empty string. i have not tried
it in Oracle db but if that works IMO there will not be an effect on user
experience.

Thanks & Regards,
Ishara Cooray
Senior Software Engineer
Mobile : +9477 262 9512
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha 
wrote:

> Setting a default value for empty fields being sent seems to be best.
>
> Furthermore we can have default values set in our DTO objects in case a
> given field is omitted altogether.
>
> So handling both the above scenarios can overcome the limitation in Oracle.
>
> But I dont know if this is good for the REST API user experience, when
> retrieving data that contains these default values.
>
> On 6 January 2017 at 15:28, Tharindu Dharmarathna 
> wrote:
>
>>
>>
>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna > > wrote:
>>
>>> Hi All,
>>>
>>> I faced $Subject in Oracle database while running integration test on C5
>>> on top.
>>>
>>> *Observation*
>>>
>>> when insert empty string ("") it was save as null in database.
>>>
>>> While going through SO I had found [1] , which did happen in oracle
>>> database.
>>>
>>>
>>> We have come up with several ways to handle empty strings which user
>>> sends through the rest api.
>>>
>>> 1.  Validate the request and send error when giving empty strings
>>> 2.  Set default value like "N/A" into the fields which send as empty.
>>>
>>> Is there any other way to handle this problem ?.
>>>
>>> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
>>> string-in-oracle
>>>
>>> Thanks
>>>
>>>
>>> *Tharindu Dharmarathna*Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>>
>>
>>
>>
>> --
>>
>> *Tharindu Dharmarathna*Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>
>
>
>
> --
> Regards,
> Uvindra
>
> Mobile: 33962
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-06 Thread Uvindra Dias Jayasinha
Setting a default value for empty fields being sent seems to be best.

Furthermore we can have default values set in our DTO objects in case a
given field is omitted altogether.

So handling both the above scenarios can overcome the limitation in Oracle.

But I dont know if this is good for the REST API user experience, when
retrieving data that contains these default values.

On 6 January 2017 at 15:28, Tharindu Dharmarathna 
wrote:

>
>
> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna 
> wrote:
>
>> Hi All,
>>
>> I faced $Subject in Oracle database while running integration test on C5
>> on top.
>>
>> *Observation*
>>
>> when insert empty string ("") it was save as null in database.
>>
>> While going through SO I had found [1] , which did happen in oracle
>> database.
>>
>>
>> We have come up with several ways to handle empty strings which user
>> sends through the rest api.
>>
>> 1.  Validate the request and send error when giving empty strings
>> 2.  Set default value like "N/A" into the fields which send as empty.
>>
>> Is there any other way to handle this problem ?.
>>
>> [1] - http://stackoverflow.com/questions/13278773/null-vs-empty-
>> string-in-oracle
>>
>> Thanks
>>
>>
>> *Tharindu Dharmarathna*Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94779109091 <+94%2077%20910%209091>*
>>
>
>
>
> --
>
> *Tharindu Dharmarathna*Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <+94%2077%20910%209091>*
>



-- 
Regards,
Uvindra

Mobile: 33962
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-06 Thread Tharindu Dharmarathna
On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna 
wrote:

> Hi All,
>
> I faced $Subject in Oracle database while running integration test on C5
> on top.
>
> *Observation*
>
> when insert empty string ("") it was save as null in database.
>
> While going through SO I had found [1] , which did happen in oracle
> database.
>
>
> We have come up with several ways to handle empty strings which user sends
> through the rest api.
>
> 1.  Validate the request and send error when giving empty strings
> 2.  Set default value like "N/A" into the fields which send as empty.
>
> Is there any other way to handle this problem ?.
>
> [1] - http://stackoverflow.com/questions/13278773/null-vs-
> empty-string-in-oracle
>
> Thanks
>
>
> *Tharindu Dharmarathna*Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <+94%2077%20910%209091>*
>



-- 

*Tharindu Dharmarathna*Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: *+94779109091*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [Oracle] How to handle insertion of empty string in oracle.

2017-01-06 Thread Tharindu Dharmarathna
Hi All,

I faced $Subject in Oracle database while running integration test on C5 on
top.

*Observation*

when insert empty string ("") it was save as null in database.

While going through SO I had found [1] , which did happen in oracle
database.


We have come up with several ways to handle empty strings which user sends
through the rest api.

1.  Validate the request and send error when giving empty strings
2.  Set default value like "N/A" into the fields which send as empty.

Is there any other way to handle this problem ?.

[1] -
http://stackoverflow.com/questions/13278773/null-vs-empty-string-in-oracle

Thanks


*Tharindu Dharmarathna*Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: *+94779109091*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev