On Tue, Jan 10, 2017 at 12:03 PM, Bhathiya Jayasekara <[email protected]> wrote:
> > On Tue, Jan 10, 2017 at 11:53 AM, Malintha Amarasinghe <[email protected] > > 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 <[email protected]> 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 < >>> [email protected]> 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 < >>>> [email protected]> wrote: >>>> >>>>> >>>>> >>>>> On Tue, Jan 10, 2017 at 11:10 AM, Akalanka Pagoda Arachchi < >>>>> [email protected]> 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 < >>>>>> [email protected]> 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 < >>>>>>> [email protected]> 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 < >>>>>>>> [email protected]> 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 < >>>>>>>>> [email protected]> 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 <[email protected] >>>>>>>>>> > wrote: >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Mon, Jan 9, 2017 at 7:54 AM, Isuru Haththotuwa < >>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On Fri, Jan 6, 2017 at 5:19 PM, Uvindra Dias Jayasinha < >>>>>>>>>>>> [email protected]> 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 < >>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> On Fri, Jan 6, 2017 at 3:26 PM, Tharindu Dharmarathna < >>>>>>>>>>>>>> [email protected]> 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/que >>>>>>>>>>>>>>> stions/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: 777733962 >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> Thanks and Regards, >>>>>>>>>>>> >>>>>>>>>>>> Isuru H. >>>>>>>>>>>> +94 716 358 048 <+94%2071%20635%208048>* <http://wso2.com/>* >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>> Dev mailing list >>>>>>>>>>>> [email protected] >>>>>>>>>>>> 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 >>>>>>>>>>> [email protected] >>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> *Darshana Akalanka Pagoda Arachchi,* >>>>>>>>>> *Senior Software Engineer, WSO2* >>>>>>>>>> *+94777118016 <+94%2077%20711%208016>* >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> Dev mailing list >>>>>>>>>> [email protected] >>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Regards, >>>>>>>>> Uvindra >>>>>>>>> >>>>>>>>> Mobile: 777733962 >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Regards, >>>>>>>> Uvindra >>>>>>>> >>>>>>>> Mobile: 777733962 >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Dev mailing list >>>>>>>> [email protected] >>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Madhawa Gunasekara* >>>>>>> Software Engineer >>>>>>> WSO2 Inc.; http://wso2.com >>>>>>> lean.enterprise.middleware >>>>>>> >>>>>>> mobile: +94 719411002 <+94+719411002> >>>>>>> blog: *http://madhawa-gunasekara.blogspot.com >>>>>>> <http://madhawa-gunasekara.blogspot.com>* >>>>>>> linkedin: *http://lk.linkedin.com/in/mgunasekara >>>>>>> <http://lk.linkedin.com/in/mgunasekara>* >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Darshana Akalanka Pagoda Arachchi,* >>>>>> *Senior Software Engineer, WSO2* >>>>>> *+94777118016 <+94%2077%20711%208016>* >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> [email protected] >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Malintha Amarasinghe >>>>> Software Engineer >>>>> *WSO2, Inc. - lean | enterprise | middleware* >>>>> http://wso2.com/ >>>>> >>>>> Mobile : +94 712383306 <+94%2071%20238%203306> >>>>> >>>> >>>> >>>> >>>> -- >>>> *Darshana Akalanka Pagoda Arachchi,* >>>> *Senior Software Engineer, WSO2* >>>> *+94777118016 <+94%2077%20711%208016>* >>>> >>>> _______________________________________________ >>>> Dev mailing list >>>> [email protected] >>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>> >>>> >>> >> >> >> -- >> Malintha Amarasinghe >> Software Engineer >> *WSO2, Inc. - lean | enterprise | middleware* >> http://wso2.com/ >> >> Mobile : +94 712383306 <071%20238%203306> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > *Bhathiya Jayasekara* > *Senior Software Engineer,* > *WSO2 inc., http://wso2.com <http://wso2.com>* > > *Phone: +94715478185 <+94%2071%20547%208185>* > *LinkedIn: http://www.linkedin.com/in/bhathiyaj > <http://www.linkedin.com/in/bhathiyaj>* > *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>* > *Blog: http://movingaheadblog.blogspot.com > <http://movingaheadblog.blogspot.com/>* > -- Malintha Amarasinghe Software Engineer *WSO2, Inc. - lean | enterprise | middleware* http://wso2.com/ Mobile : +94 712383306 <+94%2071%20238%203306>
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
