[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue forms/samples/track/sql/dbschema.gsd desig...
From: |
Jan Ischebeck |
Subject: |
gnue forms/samples/track/sql/dbschema.gsd desig... |
Date: |
Thu, 25 Jul 2002 20:52:57 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jan Ischebeck <address@hidden> 02/07/25 20:52:57
Modified files:
forms/samples/track/sql: dbschema.gsd
designer/src/forms/wizards: CreateSchema.py
Log message:
add a check for entry types, add a name to <primarykey> (to conform to
designersparser) and updated example
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/track/sql/dbschema.gsd.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/forms/wizards/CreateSchema.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: gnue/designer/src/forms/wizards/CreateSchema.py
diff -c gnue/designer/src/forms/wizards/CreateSchema.py:1.6
gnue/designer/src/forms/wizards/CreateSchema.py:1.7
*** gnue/designer/src/forms/wizards/CreateSchema.py:1.6 Wed Jul 24 19:25:25 2002
--- gnue/designer/src/forms/wizards/CreateSchema.py Thu Jul 25 20:52:57 2002
***************
*** 133,141 ****
newtable = GSTable(self.gstables)
newtable.name=obj.table
! fields=GSFields(newtable)
! fields=GSConstraints(newtable)
! fields=GSPrimaryKey(newtable)
self.tablelist[string.lower(obj.name)]=newtable
else:
--- 133,140 ----
newtable = GSTable(self.gstables)
newtable.name=obj.table
! GSFields(newtable)
! GSConstraints(newtable)
self.tablelist[string.lower(obj.name)]=newtable
else:
***************
*** 169,176 ****
self.tablelist.has_key(string.lower(myblock.datasource)):
table=self.tablelist[string.lower(myblock.datasource)]
!
! self.AddField(table, obj.field, 'varchar')
#
# add fields to the table referenced in dropdowns
--- 168,195 ----
self.tablelist.has_key(string.lower(myblock.datasource)):
table=self.tablelist[string.lower(myblock.datasource)]
!
! style = 'varchar' # standart type
!
! if hasattr(obj,'style') and obj.style=='checkbox':
! type = 'boolean'
!
! if hasattr(obj,'numeric'):
! type = 'int'
!
! if hasattr(obj,'typecast'):
! if obj.typecast=='number':
! type = 'int'
! if obj.typecast=='date':
! type = 'date'
! if obj.typecast=='text': # reset previous numeric fields
! type = 'varchar'
!
! if hasattr(obj,'max_length'):
! self.AddField(table, obj.field, 'varchar', obj.max_length)
!
! else:
! self.AddField(table, obj.field, 'varchar')
#
# add fields to the table referenced in dropdowns
***************
*** 223,229 ****
oldpkey=mtable.findChildOfType("GSPKField")
if oldpkey==None:
! pkeyf=GSPKField(mtable.findChildOfType('GSPrimaryKey'))
pkeyf.name=obj.masterlink
# add field
--- 242,250 ----
oldpkey=mtable.findChildOfType("GSPKField")
if oldpkey==None:
! pkey=GSPrimaryKey(mtable)
! pkey.name="pk_%s_%s" % (mtable.name,obj.masterlink)
! pkeyf=GSPKField(pkey)
pkeyf.name=obj.masterlink
# add field
***************
*** 240,260 ****
else:
pass
! def AddField(self,table,fieldname,type):
fields = table.findChildOfType('GSFields')
# check if field already exists
for child in fields._children:
if child._type == 'GSField' and child.name==fieldname:
! # field already exists returning
# (possibly updating fieldtype here)
return
# create field
newfield = GSField(fields)
newfield.name=fieldname
newfield.type=type
--- 261,287 ----
else:
pass
! def AddField(self,table,fieldname,type,length=None):
fields = table.findChildOfType('GSFields')
# check if field already exists
for child in fields._children:
if child._type == 'GSField' and child.name==fieldname:
! # field already exists, so returning
# (possibly updating fieldtype here)
+ if type!='varchar':
+ child.type=type
+ if length!=None:
+ child.size=length
return
# create field
newfield = GSField(fields)
newfield.name=fieldname
newfield.type=type
+ if length!=None:
+ newfield.size=length
Index: gnue/forms/samples/track/sql/dbschema.gsd
diff -c gnue/forms/samples/track/sql/dbschema.gsd:1.3
gnue/forms/samples/track/sql/dbschema.gsd:1.4
*** gnue/forms/samples/track/sql/dbschema.gsd:1.3 Wed Jul 24 19:25:25 2002
--- gnue/forms/samples/track/sql/dbschema.gsd Thu Jul 25 20:52:56 2002
***************
*** 13,19 ****
<field name="assignment_status" type="varchar"/>
</fields>
<constraints/>
! <primarykey>
<pkfield name="id"/>
</primarykey>
</table>
--- 13,19 ----
<field name="assignment_status" type="varchar"/>
</fields>
<constraints/>
! <primarykey name="pk_person_id">
<pkfield name="id"/>
</primarykey>
</table>
***************
*** 34,40 ****
<constraintref name="id" table="person"/>
</constraint>
</constraints>
- <primarykey/>
</table>
<table name="phone">
<fields>
--- 34,39 ----
***************
*** 51,57 ****
<constraintref name="id" table="person"/>
</constraint>
</constraints>
- <primarykey/>
</table>
<table name="email">
<fields>
--- 50,55 ----
***************
*** 65,71 ****
<constraintref name="id" table="person"/>
</constraint>
</constraints>
- <primarykey/>
</table>
<table name="address_type">
<fields>
--- 63,68 ----
***************
*** 73,79 ****
<field name="description" type="varchar"/>
</fields>
<constraints/>
- <primarykey/>
</table>
<table name="phone_type">
<fields>
--- 70,75 ----
***************
*** 81,87 ****
<field name="description" type="varchar"/>
</fields>
<constraints/>
- <primarykey/>
</table>
<table name="email_type">
<fields>
--- 77,82 ----
***************
*** 89,95 ****
<field name="description" type="varchar"/>
</fields>
<constraints/>
- <primarykey/>
</table>
<table name="assignment_status">
<fields>
--- 84,89 ----
***************
*** 97,103 ****
<field name="status" type="varchar"/>
</fields>
<constraints/>
- <primarykey/>
</table>
<table name="history">
<fields>
--- 91,96 ----
***************
*** 115,121 ****
<constraintref name="id" table="person"/>
</constraint>
</constraints>
- <primarykey/>
</table>
</tables>
</schema>
--- 108,113 ----