2014-12-02 12:54:01 +01:00
|
|
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
|
|
|
# this repository contains the full copyright notices and license terms.
|
2017-03-31 12:44:22 +02:00
|
|
|
from .field import Field
|
2009-02-03 18:58:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Integer(Field):
|
2009-03-01 13:37:31 +01:00
|
|
|
'''
|
2009-09-13 15:37:11 +02:00
|
|
|
Define an integer field (``int``).
|
2009-03-01 13:37:31 +01:00
|
|
|
'''
|
2009-02-03 18:58:25 +01:00
|
|
|
_type = 'integer'
|
2017-03-31 12:44:22 +02:00
|
|
|
_sql_type = 'INTEGER'
|
2013-09-06 22:32:37 +02:00
|
|
|
|
2018-02-02 00:04:19 +01:00
|
|
|
def sql_format(self, value):
|
|
|
|
|
if value is None:
|
|
|
|
|
return None
|
|
|
|
|
return int(str(value))
|
|
|
|
|
|
2009-02-03 18:58:25 +01:00
|
|
|
|
2010-03-16 13:35:13 +01:00
|
|
|
class BigInteger(Integer):
|
2009-03-01 13:37:31 +01:00
|
|
|
'''
|
2009-09-13 15:37:11 +02:00
|
|
|
Define an integer field (``long``).
|
2009-03-01 13:37:31 +01:00
|
|
|
'''
|
2009-02-03 18:58:25 +01:00
|
|
|
_type = 'biginteger'
|
2017-03-31 12:44:22 +02:00
|
|
|
_sql_type = 'BIGINT'
|