equal
deleted
inserted
replaced
1 from yams import register_base_type |
|
2 from logilab.database import get_db_helper |
|
3 from logilab.database.sqlgen import SQLExpression |
|
4 |
|
5 _NUMERIC_PARAMETERS = {'scale': 0, 'precision': None} |
|
6 register_base_type('Numeric', _NUMERIC_PARAMETERS) |
|
7 |
|
8 # Add the datatype to the helper mapping |
|
9 pghelper = get_db_helper('postgres') |
|
10 |
|
11 |
|
12 def pg_numeric_sqltype(rdef): |
|
13 """Return a PostgreSQL column type corresponding to rdef |
|
14 """ |
|
15 return 'numeric(%s, %s)' % (rdef.precision, rdef.scale) |
|
16 |
|
17 pghelper.TYPE_MAPPING['Numeric'] = pg_numeric_sqltype |
|