Missing quotes for Firebird columns and tables

Original Post Alex's Avatar

Alex

31 Mar, 2010 10:42 AM via web

As you know, using column names not in uppercase(for example Address, address) demands quoting in firebird syntax.

I have:
Firebird .net provider 2.5.2
Fluent Nhib Build 633

Table in Database:

CREATE TABLE TABLETEST (
ID         INTEGER NOT NULL,
NAME       VARCHAR(50),
"Address"  VARCHAR(100)   -- problem with this field
);

ALTER TABLE TABLETEST ADD PRIMARY KEY (ID);

In my project i have User class

public class User 
{
    public virtual int Id { get; private set; }
    public virtual string Name { get; set; }
    public virtual string Address { get; set; }
}

and mapping for it

 public UserMap()
    {
        this.Table("TABLETEST");
        Id(x => x.Id).Column("ID").GeneratedBy.Sequence("GEN_TABLETEST_ID");
        Map(x => x.Name).Length(50).Column("NAME");
        Map(x => x.Address).Column("Address").Length(100);         -- explicitly  specify column name  
    }

When i try to save some simple entity into this table, i receive exception:
"could not insert: [project.Mappings.User#13][SQL: INSERT INTO tabletest (name, address, id) VALUES (?, ?, ?)]" inner exception: "Dynamic SQL Error\r\nSQL error code = -206\r\nColumn unknown\r\nADDRESS\r\nAt line 1, column 30"

Of course, firebird doesn't understand ADDRESS, 'cause it is case-sensetive, and i have "Address" in my db table.

I have tried using backtips and Map.Access in my mapping, it doesn't helps. Also tried different keys from solution described here http://fabiomaulo.blogspot.com/2009/06/auto-quote-tablecolumn-names... . I cannot change existing database metadata due to its usage in another application.

Q: Is there some possibility to pass into SQL quoted columns?

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      Five times two is what?

      Recent Discussions

      05 Jul, 2010 10:29 PM
      05 Jul, 2010 12:45 PM
      05 Jul, 2010 12:42 PM
      05 Jul, 2010 12:17 PM
      05 Jul, 2010 12:12 PM

       

      03 Jul, 2010 12:26 AM
      02 Jul, 2010 02:17 PM
      02 Jul, 2010 08:18 AM
      02 Jul, 2010 12:20 AM
      01 Jul, 2010 10:14 PM