pgtoolkit/pgbrowser.py
changeset 94 a10f553e6f6a
parent 87 3ef717ee9253
child 95 6adcb7ee4517
equal deleted inserted replaced
93:b72591087495 94:a10f553e6f6a
   124         self.function = function
   124         self.function = function
   125         self.name = name
   125         self.name = name
   126         self.type = type
   126         self.type = type
   127         self.mode = mode
   127         self.mode = mode
   128         self.default = default
   128         self.default = default
       
   129 
   129 
   130 
   130 class Function:
   131 class Function:
   131     def __init__(self, browser, schema, oid, name, function_name, type, result, source):
   132     def __init__(self, browser, schema, oid, name, function_name, type, result, source):
   132         self.browser = browser
   133         self.browser = browser
   133         self.schema = schema
   134         self.schema = schema
   414 
   415 
   415         Args:
   416         Args:
   416             oid: function oid from pg_catalog.pg_proc (returned by list_functions)
   417             oid: function oid from pg_catalog.pg_proc (returned by list_functions)
   417 
   418 
   418         """
   419         """
   419         return self._query('''select pg_get_functiondef(%s);''', [oid])
   420         return self._query('''SELECT pg_get_functiondef(%s) AS definition;''', [oid])[0]['definition']
   420 
   421 
   421     def list_types(self, schema='public'):
   422     def list_types(self, schema='public'):
   422         """List types in schema.
   423         """List types in schema.
   423 
   424 
   424         http://www.postgresql.org/docs/8.4/static/catalog-pg-type.html
   425         http://www.postgresql.org/docs/8.4/static/catalog-pg-type.html