35 |
|
|
36 |
|
|
37 |
|
|
38 |
from string import lower, rstrip |
from string import upper, lower, rstrip |
39 |
import sys |
import sys |
40 |
from gnue.common.datasources import GDataObjects, GConditions |
from gnue.common.datasources import GDataObjects, GConditions |
41 |
from gnue.common.apps import GDebug |
from gnue.common.apps import GDebug |
226 |
if nativetype in ('int','float','long'): |
if nativetype in ('int','float','long'): |
227 |
attrs['datatype']='number' |
attrs['datatype']='number' |
228 |
attrs['precision']=d[SIG2api.DESCRIPTION_SCALE] |
attrs['precision']=d[SIG2api.DESCRIPTION_SCALE] |
229 |
elif nativetype == 'datetime': |
elif nativetype == 'tuple': |
230 |
attrs['datatype']='date' |
attrs['datatype']='date' |
231 |
else: |
else: |
232 |
attrs['datatype']='text' |
attrs['datatype']='text' |
233 |
|
|
234 |
|
cursor.execute("select rdb$default_source from rdb$relation_fields"+ \ |
235 |
|
" where rdb$relation_name = '%s' " % (parent.name)+ \ |
236 |
|
" and rdb$field_name = '%s'" % (upper(attrs['name']))) |
237 |
|
defrs = cursor.fetchone() |
238 |
|
if defrs[0]: |
239 |
|
dflt = defrs[0] |
240 |
|
if dflt[9:12] == "NOW": |
241 |
|
attrs['defaulttype'] = 'timestamp' |
242 |
|
else: |
243 |
|
attrs['defaulttype'] = 'constant' |
244 |
|
attrs['defaultval'] = dflt[8:] |
245 |
|
|
246 |
list.append(GDataObjects.Schema(attrs=attrs)) |
list.append(GDataObjects.Schema(attrs=attrs)) |
247 |
|
|