From 9ccff587b74260b9bb6fef082cc290ce4e228ef6 Mon Sep 17 00:00:00 2001 From: "ondrej.zara" Date: Tue, 15 Sep 2009 11:20:00 +0000 Subject: [PATCH] updated web2py db definition, thanks to Boris Manojlovic --HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%4052 --- db/web2py/datatypes.xml | 18 +-- db/web2py/output.xsl | 336 +++++++++++++++++++++------------------- 2 files changed, 181 insertions(+), 173 deletions(-) diff --git a/db/web2py/datatypes.xml b/db/web2py/datatypes.xml index 22f2252..2399140 100644 --- a/db/web2py/datatypes.xml +++ b/db/web2py/datatypes.xml @@ -4,23 +4,19 @@ - - - + + - + - - - - - - + + + - \ No newline at end of file + diff --git a/db/web2py/output.xsl b/db/web2py/output.xsl index a94ed99..a1d4c0c 100644 --- a/db/web2py/output.xsl +++ b/db/web2py/output.xsl @@ -1,164 +1,176 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - """ -just copy paste this code into your model and replace dbOBJECT to something -you prefer or what is used in your code, another thing that should be known is that -this code still cannot distinguish what exactly should be in reference title - name -when you use generic appadmin so please remove all fiealds you don't need not require -""" -""" -database class object creation -""" -dbOBJECT = SQLDB("sqlite://dbOBJECT.db") - - - -""" -Table definition -""" -dbOBJECT.define_table(" - - ", - - - - - SQLField(" - - - - ", - - - - " - - ", length= - - - - , - - - " - - ", - - - - notnull=True, - - - - default=' - - ' - - - default=None - - - - - - ", dbOBJECT. - - - - - - - - - ) - - - - , - - - - - - - - unique=True - - - ) - - - - - - -""" -Relations between tables (remove fields you don't need from requires) -""" - - - - - - - dbOBJECT. - - . - - .requires=IS_IN_DB( - dbOBJECT, ' - - .id - - - - - ',' - - . - - - - - - ') - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dbOBJECT.define_table(" + + ", + + + + + Field(" + + + + ", + + + " + + ", length= + + + + , + + + " + + ", + + + + notnull=True, + + + + default= + + + None + + + + + + + + default=None + + + + + + ", dbOBJECT. + + + + + + + + + ) + + + + , + + + + + + + + unique=True + + + ) + + + + + """ database class object creation (initialization) """ + if request.env.web2py_runtime_gae: # if running on Google App Engine + dbOBJECT = DAL('gae') # connect to Google BigTable + session.connect(request, response, db=dbOBJECT) # and store sessions and tickets there + else: # else use a normal relational database + dbOBJECT = SQLDB("sqlite://dbOBJECT.db") + + + + + + + + + + + + + + + + + + + + """ Relations between tables (remove fields you don't need from requires) """ + + + + + + + + dbOBJECT. + + . + + .requires=IS_IN_DB( dbOBJECT, ' + + .id', ' + + + + + + + + %( + + )s + + + + + ') + + + + +