Example #1
0
def safecmp(x, y):
    """Calls the 'standard' safecmp function, which performs a comparison
       similar to cmp, including iterating over lists, but two None values
       are considered equal, and a TypeError is avoided when a None value
       and a datetime are corresponding members of a list.
    """
    return StandardNormalizer.safecmp(x, y)
Example #2
0
def normalize(table, sql, num_digits=12):
    """Normalizes the result tuples of ORDER BY statements, sorting SQL NULL
       (Python None) values as if they were the lowest values, i.e., first
       when using ORDER BY col1 ASC, but last when using ORDER BY col1 DESC.
    """
    return StandardNormalizer.normalize(table, sql, num_digits,
                                        SortNulls.lowest)
Example #3
0
def normalize(table, sql):
    """Normalizes results by rounding numbers, including those found in a
       string (VARCHAR) column representing a GEOGRAPHY_POINT or GEOGRAPHY
       (point or polygon) to the specified number of significant digits; the
       result tuples of ORDER BY statements are not reordered.
    """
    return StandardNormalizer.normalize(table, sql, SortNulls.never, 4)
Example #4
0
def normalize(table, sql):
    """Normalizes results by rounding numbers, including those found in a
       string (VARCHAR) column representing a GEOGRAPHY_POINT or GEOGRAPHY
       (point or polygon) to the specified number of significant digits; the
       result tuples of ORDER BY statements are not reordered.
    """
    return StandardNormalizer.normalize(table, sql, SortNulls.never, 8)
Example #5
0
def safecmp(x, y):
    """Calls the 'standard' safecmp function, which performs a comparison
       similar to cmp, including iterating over lists, but two None values
       are considered equal, and a TypeError is avoided when a None value
       and a datetime are corresponding members of a list.
    """
    return StandardNormalizer.safecmp(x,y)
Example #6
0
def normalize(table, sql):
    """Normalizes the result tuples of ORDER BY statements in the default
       manner, without sorting SQL NULL (Python None) values at all; in some
       cases, this could lead to mismatches between HSqlDB, which always sorts
       NULL values first, and VoltDB, which sorts NULL values as if they were
       the lowest value (first with ORDER BY ASC, last with ORDER BY DESC), in
       which case you could use a different normalizer, such as
       nulls-lowest-normalizer.py.
    """
    return StandardNormalizer.normalize(table, sql, SortNulls.never)
Example #7
0
def normalize(table, sql):
    """Normalizes the result tuples of ORDER BY statements in the default
       manner, without sorting SQL NULL (Python None) values at all; in some
       cases, this could lead to mismatches between HSqlDB, which always sorts
       NULL values first, and VoltDB, which sorts NULL values as if they were
       the lowest value (first with ORDER BY ASC, last with ORDER BY DESC), in
       which case you could use a different normalizer, such as
       nulls-lowest-normalizer.py.
    """
    return StandardNormalizer.normalize(table, sql, SortNulls.never)
Example #8
0
def normalize(table, sql, num_digits=12, sort_nulls=SortNulls.never):
    """Normalizes the result tuples of ORDER BY statements in the default
       manner, without sorting SQL NULL (Python None) values at all; in some
       cases, this could lead to mismatches between HSqlDB, which always sorts
       NULL values first, and VoltDB, which sorts NULL values as if they were
       the lowest value (first with ORDER BY ASC, last with ORDER BY DESC), in
       which case you could use a different normalizer, such as
       nulls-lowest-normalizer.py. Also rounds numbers, including those found
       in a string (VARCHAR) column representing a GEOGRAPHY_POINT or GEOGRAPHY
       (point or polygon) to the specified number of significant digits; the
       result tuples of ORDER BY statements are not reordered.
    """
    return StandardNormalizer.normalize(table, sql, num_digits, sort_nulls)
Example #9
0
def normalize(table, sql, num_digits=12, sort_nulls=SortNulls.never):
    """Normalizes the result tuples of ORDER BY statements in the default
       manner, without sorting SQL NULL (Python None) values at all; in some
       cases, this could lead to mismatches between HSqlDB, which always sorts
       NULL values first, and VoltDB, which sorts NULL values as if they were
       the lowest value (first with ORDER BY ASC, last with ORDER BY DESC), in
       which case you could use a different normalizer, such as
       nulls-lowest-normalizer.py. Also rounds numbers, including those found
       in a string (VARCHAR) column representing a GEOGRAPHY_POINT or GEOGRAPHY
       (point or polygon) to the specified number of significant digits; the
       result tuples of ORDER BY statements are not reordered.
    """
    return StandardNormalizer.normalize(table, sql, num_digits, sort_nulls)
Example #10
0
def normalize(table, sql):
    """Normalizes the result tuples of ORDER BY statements, sorting SQL NULL
       (Python None) values as if they were the lowest values, i.e., first
       when using ORDER BY col1 ASC, but last when using ORDER BY col1 DESC.
    """
    return StandardNormalizer.normalize(table, sql, SortNulls.lowest)
Example #11
0
def normalize(table, sql):
    """Normalizes the result tuples of ORDER BY statements, sorting SQL NULL
       (Python None) values last (whether using ORDER BY ASC or DESC).
    """
    return StandardNormalizer.normalize(table, sql, SortNulls.last)
Example #12
0
def normalize(table, sql):
    """Normalizes the result tuples of ORDER BY statements, sorting SQL NULL
       (Python None) values first (whether using ORDER BY ASC or DESC).
    """
    return StandardNormalizer.normalize(table, sql, SortNulls.first)