3.0 Final - TRIAL: Problem creating SQL DDL for Firebird

Posts   
 
    
andreas_bh
User
Posts: 22
Joined: 18-Jun-2010
# Posted on: 18-Jun-2010 12:08:39   

Hi,

First I would like to say that LLBLGen Pro is a great piece of work and most things are working excellent!

But I just ran into a problem when I was trying to create SQL DDL.

I have created a SQL DDL in a test project for Firebird but it didn't work in Flamerobin. I found out that these bugs are in the generated script:

In the primary keys section the name of the primary key is always followed by a double quote:

ALTER TABLE AccessRight
    ADD CONSTRAINT PK_0d7ded84cbc9e7abcb8c77ee592" PRIMARY KEY
    ( 
        Id 
    );

I added a field of the type "System.byte[]" which resulted in a BLOB SUBTYPE 0. But SUBTYPE ist misspelled, it must be SUB_TYPE:

CREATE TABLE DocRevisions
(
    Revision Integer NOT NULL, 
    DocumentId Integer NOT NULL, 
    UserId Integer NOT NULL, 
    Data BLOB SUBTYPE 0 NOT NULL, 
    Modification Date NOT NULL, 
    Checksum VARCHAR(150) NOT NULL 
);

I have called an entity "User". A table "User" was automatically mapped but USER is a reserved word in firebird so the sql didn't run.

The produced sql file has UTF-8 coding. When you open the file with Flamerobin directly you'll get the UTF-8 identification bytes in the first line.

I have solved these problems by manipulating the file manually, changing the table name from "User" to "AppUser" and changing the coding of the sql file from UTF-8 to Ansi. After these modification the script ran through without errors.

I would suggest to always use quotations with names to avoid the problem with reserved words. The only disadvantage would be that the names are case sensitive then.

I also seems that in update scripts no primary key an foreign key informations are created. After adding a table I just got the CREATE TABLE statements but no ALTER TABLE with ADD CONSTRAINT.

Many thanks in advance for your help!

Best Regards, Andreas

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39905
Joined: 17-Aug-2003
# Posted on: 18-Jun-2010 12:41:45   

Thanks, we'll look into this.

btw, about the pk constraint missing, did you use Validation + Adjust Relational Model data? I.o.w.: is the PK field present in the new table in the catalog explorer?

About encoding: you can switch that in the Project properties, Task performers, general section : EncodingToUse, by default this is UTF8. This also affects code generated by the designer, in general it should be kept as UTF8 as that basically covers most character problems, though it could lead to small issues when the editor the file is used in doesn't understand UTF8

Using quotes is a good suggestion, we'll look into that. To avoid case-sensitive names, you can use the setting RelationalModelDataElementNameCasingCaseSensitiveDBs in project properties (and its companion setting InsertUnderscoreAtWordBreakCaseSensitiveDBs) to control how the names are constructed for the tables/fields produced by the designer for case sensitive databases. Firebird is seen as a case sensitive database. I'll make sure all names are surrounded by quotes to avoid reserved word clashes, that was pretty sloppy of us.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39905
Joined: 17-Aug-2003
# Posted on: 18-Jun-2010 13:43:40   

There was also a problem with 'NULL', we corrected that as well. We've fixed the problems and which are available in the next build released later today.

I've attached the updated firebird templates for DDL SQL. Please unpack this zip in the folder: <llblgen pro installation folder>\Frameworks\DDL SQL\Templates\FirebirdSpecific\ If you're on windows 7, be sure to do this as administrator.

Attachments
Filename File size Added on Approval
FirebirdSpecific.zip 5,120 18-Jun-2010 13:44.00 Approved
Frans Bouma | Lead developer LLBLGen Pro