Coverage for nova/db/constants.py: 100%

2 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-24 11:16 +0000

1# Licensed under the Apache License, Version 2.0 (the "License"); you may 

2# not use this file except in compliance with the License. You may obtain 

3# a copy of the License at 

4# 

5# http://www.apache.org/licenses/LICENSE-2.0 

6# 

7# Unless required by applicable law or agreed to in writing, software 

8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

10# License for the specific language governing permissions and limitations 

11# under the License. 

12"""Useful db-related constants. In their own file so they can be imported 

13cleanly.""" 

14 

15# The maximum value a signed INT type may have 

16MAX_INT = 0x7FFFFFFF 

17 

18# NOTE(dosaboy): This is supposed to represent the maximum value that we can 

19# place into a SQL single precision float so that we can check whether values 

20# are oversize. Postgres and MySQL both define this as their max whereas Sqlite 

21# uses dynamic typing so this would not apply. Different dbs react in different 

22# ways to oversize values e.g. postgres will raise an exception while mysql 

23# will round off the value. Nevertheless we may still want to know prior to 

24# insert whether the value is oversize or not. 

25SQL_SP_FLOAT_MAX = 3.40282e+38