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

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

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

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,

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.

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

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

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) >

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

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

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

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

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

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: > > >

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

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

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

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

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

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 .

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

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

[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