@@ -216,7 +216,6 @@ def _get_numeric_data(self, param):
216216 precision = exponent * - 1
217217 scale = exponent * - 1
218218
219- # TODO: Revisit this check, do we want this restriction?
220219 if precision > 38 :
221220 raise ValueError (
222221 "Precision of the numeric value is too high - "
@@ -231,30 +230,24 @@ def _get_numeric_data(self, param):
231230 # strip decimal point from param & convert the significant digits to integer
232231 # Ex: 12.34 ---> 1234
233232 int_str = '' .join (str (d ) for d in digits_tuple )
234-
235- # Apply exponent to get the unscaled integer string
236233 if exponent > 0 :
237234 int_str = int_str + ('0' * exponent )
238235 elif exponent < 0 :
239- # if exponent negative and abs(exponent) > num_digits we padded precision above
240- # for the integer representation we pad leading zeros
241236 if - exponent > num_digits :
242237 int_str = ('0' * (- exponent - num_digits )) + int_str
243238
244- # Edge: if int_str becomes empty (Decimal('0')), make "0"
245239 if int_str == '' :
246240 int_str = '0'
247241
248- # Convert decimal base-10 string -> python int, then to 16 little-endian bytes
249- big_int = int (int_str ) # Python big int is arbitrary precision
242+ # Convert decimal base-10 string to python int, then to 16 little-endian bytes
243+ big_int = int (int_str )
250244 byte_array = bytearray (16 ) # SQL_MAX_NUMERIC_LEN
251245 for i in range (16 ):
252246 byte_array [i ] = big_int & 0xFF
253247 big_int >>= 8
254248 if big_int == 0 :
255249 break
256250
257- # numeric_data.val should be bytes (pybindable). Ensure a bytes object of length 16.
258251 numeric_data .val = bytes (byte_array )
259252 return numeric_data
260253
0 commit comments