Exemplo n.º 1
0
def create_for_table(package):
    parentT = Table('public', 'parent', [
        Field('p_id', 'integer', isPk=True, isSerial=True),
        Field('p_name', 'text'),
        Field('p_first_name', 'text'),
        Field('p_parent_data_id', 'integer')
    ])
    parentDataT = Table('public', 'parent_data', [
        Field('pd_id', 'integer', isSerial=True, isPk=True),
        Field('pd_street', 'text'),
        Field('pd_city', 'text')
    ])

    association = Association(parentT, parentDataT,
                              {'p_parent_data_id': 'pd_id'}, True)
    parentT.addAssociation(association)

    if package != '':
        package += '.'

    print plpgsql.create_pg_type(parentT)
    print plpgsql.create_pg_type(parentDataT)
    print java.create_java_type(parentT, package)
    print java.create_java_type(parentDataT, package)
    print plpgsql.create_sprocs(parentT)
    print java.create_sproc_service_interface(parentT, package)
    print java.create_sproc_service_implementation(parentT, package)
def create_for_table(schema,name):
  parentT = Table('public','parent',[Field('p_id','integer',isPk=True,isSerial=True), Field('p_name','text'), Field('p_first_name','text'), Field('p_parent_data_id','integer') ])
  parentDataT = Table('public','parent_data', [Field('pd_id','integer',isSerial=True,isPk=True),Field('pd_street','text'),Field('pd_city','text')])

  parentT.addAssociation( Association(parentT,parentDataT,{'p_parent_data_id':'pd_id'}, True) )

  m = { 'public.parent':parentT, 'public.parent_data':parentDataT }
  
  print plpgsql.create_pg_type ( parentT )
  print plpgsql.create_pg_type ( parentDataT )
  print java.create_java_type ( parentT )
  print java.create_java_type ( parentDataT )
  print plpgsql.create_sprocs( parentT, name, parentT.fields)
  print java.create_sproc_service_interface( parentT )
  print java.create_sproc_service_implementation( parentT )
Exemplo n.º 3
0
def create_for_table(package):
    parentT = Table('public', 'parent', [Field('p_id', 'integer', isPk=True, isSerial=True), Field('p_name', 'text'),
                                         Field('p_first_name', 'text'), Field('p_parent_data_id', 'integer')])
    parentDataT = Table('public', 'parent_data',
                        [Field('pd_id', 'integer', isSerial=True, isPk=True), Field('pd_street', 'text'),
                         Field('pd_city', 'text')])

    association = Association(parentT, parentDataT, {'p_parent_data_id': 'pd_id'}, True)
    parentT.addAssociation(association)

    if package != '':
        package += '.'

    print plpgsql.create_pg_type(parentT)
    print plpgsql.create_pg_type(parentDataT)
    print java.create_java_type(parentT, package)
    print java.create_java_type(parentDataT, package)
    print plpgsql.create_sprocs(parentT)
    print java.create_sproc_service_interface(parentT, package)
    print java.create_sproc_service_implementation(parentT, package)
def scaffold( table ):
  print plpgsql.create_pg_type ( table )
  print java.create_java_type ( table )
  print plpgsql.create_sprocs( table , table.getName(), table.fields )
  print java.create_sproc_service_interface( table )
  print java.create_sproc_service_implementation( table )