blag / wwwsqldesigner

Automatically exported from code.google.com/p/wwwsqldesigner
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

The generated code for web2py shows a Syntax Error #172

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This steps will reproduce the problem:

1. Load this design that was generated by the app
--------------------------------------------------------------------------------
-----------
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, 
http://code.google.com/p/wwwsqldesigner/ -->
<!-- Active URL: file:///C:/SQL_Designer/index.html -->
<sql>
<datatypes db="web2py">
    <group label="Numeric" color="rgb(238,238,170)">
        <type label="Integer" length="1" sql="integer" re="INTEGER" quote=""/>
        <type label="Double precision" length="1" sql="double" re="DOUBLE" quote=""/>
    </group>
    <group label="Character" color="rgb(255,200,200)">
        <type label="String" length="1" sql="string" quote="'"/>
        <type label="Text" length="1" sql="text" quote="'"/>
        <type label="BLOB" length="1" sql="blob" quote="'"/>
    </group>
    <group label="Date &amp; Time" color="rgb(200,255,200)">
        <type label="Time" length="0" sql="time" quote="'"/>
        <type label="Date" length="0" sql="date" quote="'"/>
        <type label="Datetime" length="0" sql="datetime" quote="'"/>
    </group>
    <group label="Miscellaneous" color="rgb(200,200,255)">
        <type label="Boolean" length="0" sql="boolean" quote=""/>
        <type label="Upload" length="0" sql="upload" quote=""/>
        <type label="Password" length="0" sql="password" quote=""/>
    </group>
</datatypes><table x="10" y="10" name="compras">
<row name="id" null="1" autoincrement="1">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="cliente" null="1" autoincrement="0">
<datatype>integer</datatype>
<default>NULL</default><relation table="cat_clientes" row="id" />
</row>
<row name="producto" null="1" autoincrement="0">
<datatype>integer</datatype>
<default>NULL</default><relation table="cat_productos" row="id" />
</row>
<row name="fecha" null="1" autoincrement="0">
<datatype>date</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="139" y="10" name="cat_productos">
<row name="id" null="1" autoincrement="1">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="Descripcion" null="1" autoincrement="0">
<datatype>string(30)</datatype>
<default>NULL</default></row>
<row name="Precio" null="1" autoincrement="0">
<datatype>double(10)</datatype>
<default>NULL</default></row>
<row name="Fecha_Alta" null="1" autoincrement="0">
<datatype>date</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<key type="UNIQUE" name="">
<part>Descripcion</part>
</key>
<comment>productos</comment>
</table>
<table x="307" y="10" name="cat_clientes">
<row name="id" null="1" autoincrement="1">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="nombre" null="1" autoincrement="0">
<datatype>string(100)</datatype>
<default>NULL</default></row>
<row name="edad" null="1" autoincrement="0">
<datatype>integer(3)</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
</sql>
--------------------------------------------------------------------------------
--
2. I want to generate web2py code so in my options my database is configured to 
'web2py'
3. So I go to "Save/Load" and "Generate SQL (web2py)"

What is the expected output? What do you see instead?

The First table in my code is this:
----------------------------------------------------------------
dbOBJECT.define_table("cat_productos",
    Field("Descripcion", "string", length=30, default=None),
    Field("Precio", "double", length=10, default=None),
    Field("Fecha_Alta", "date", default=None)unique=True)
-----------------------------------------------------------------
Note what happens to that last line right in the "default=None)unique=True)" 
part,
It should be "default=None,unique=True))" instead.

If I leave it like it's generated my web2py interpreter shows a Syntax Error, 
so I have to change it manually

What version of the product are you using? On what operating system?
WWW SQL Designer Version: 2.7
OS: Windows 7 Professional Service Pack 1
Browser: Firefox 22.0

Please provide any additional information below.

Original issue reported on code.google.com by gibran...@gmail.com on 13 Jul 2013 at 4:13

GoogleCodeExporter commented 9 years ago

Original comment by ondrej.zara on 13 Jul 2013 at 7:25

GoogleCodeExporter commented 9 years ago
Hopefully fixed in 
http://code.google.com/p/wwwsqldesigner/source/detail?r=33c34ac477474e5402529bc0
67398b11102a96c7. I am no web2py guru, so please check if the behavior is 
correct now.

Original comment by ondrej.zara on 16 Jul 2013 at 7:18

GoogleCodeExporter commented 9 years ago
Well, it did work for my example now, Thanks!

Original comment by gibran...@gmail.com on 16 Jul 2013 at 2:42