Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: Change in behavior of datalength() between ASE15 and ASE16

$
0
0

@Jeroen - a lot of this is a bit of a misunderstanding.    ASE, like all DBMS's implements default datatypes for literals - and impose a hierachy based on standards for mixed type expressions.   For example, select 2 * 2......in both cases the 2's are implicitely handled as INT's in ASE - signed 32 bit integers.    However, if I did select 123456789012 * 2, the server recognizes the first number doesn't qualify as an INT and switches to bigint. 

 

The quesiton is whether -@var is in reality shorthand for -1*@var or whether it is a single literal with an operand - ala CHS(@var) (e.g. change sign function - not an ASE function btw - but on calculators).   As standards evolve, product adherence ot standards tightens, we as developers sometimes need to adapt.   In the past, -@var was likely viewed as an expression of -1*@var and since -1 was an INT, the result would be an INT.   Today, it is likely viewed as a single literal operand such as CHS(@var). 

 

This is a classic case of where standards adherence and ease of coding collide.   We all know that given the choice above, -@var probably should be written as -1*@var for accuracy as CHS(@var) has no relevance with tinyint datatypes.    But......yeah.....we all get lazy and like to do things simply and -@var happens. 

 

...unfortunately, allowing such things often leads to security holes....or non-compliance.   Was just reading a gov't security paper that would have strongly objected to -@var being valid and allowable by any DBMS.   Go figure.


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>