Orcle Provider doesn't handle "keyword" field names

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
John Liu
Posts: 61
Joined: Wed 14 Nov 2012 20:58

Orcle Provider doesn't handle "keyword" field names

Post by John Liu » Mon 26 Nov 2012 20:47

When Orcle reserved keywords are used in field names, Devart oracle provider generates the following errors. Keywords include: Comment, Sequence, Style, Float, Required...
PM> Update-database -verbose
CREATE TABLE AZTECA.PANELITEM (
ITEMID NUMBER(18,2) NOT NULL,
PANELID NUMBER(18,2) NOT NULL,
ITEMNAME NVARCHAR2(512) NOT NULL,
ITEMTYPE NUMBER(18,2) NOT NULL,
CONTROLID NVARCHAR2(512) NULL,
ROW NUMBER(18,2) NOT NULL,
SEQUENCE NUMBER(18,2) NOT NULL,
TEXT NVARCHAR2(256) NULL,
HEIGHT NVARCHAR2(100) NULL,
WIDTH NVARCHAR2(100) NULL,
FORECOLOR NVARCHAR2(100) NULL,
BACKCOLOR NVARCHAR2(100) NULL,
ALIGNMENT NVARCHAR2(100) NULL,
STYLE NVARCHAR2(512) NULL,
REQUIRED NUMBER(18,2) NULL,
VISIBLE NUMBER(18,2) NULL,
SKINID NVARCHAR2(100) NULL,
CSSCLASS NVARCHAR2(512) NULL,
ROWCSSCLASS NVARCHAR2(256) NULL,
ROWSTYLE NVARCHAR2(256) NULL,
PRIMARY KEY (ITEMID)
)
Devart.Data.Oracle.OracleException (0x80004005): ORA-00904: : invalid identifier
at Devart.Data.Oracle.t.d()
at Devart.Data.Oracle.ar.h()
at Devart.Data.Oracle.ar.c()
at Devart.Data.Oracle.aa.a(Int32 A_0, bw A_1)
at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
at System.Data.Entity.Migrations.DbMigrator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable`1 migrationStatements)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.ExecuteStatements(IEnumerable`1 migrationStatements)
at System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, XDocument targetModel, IEnumerable`1 operations, Boolean downgrading, Boolean auto)
at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
ORA-00904: : invalid identifier

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Orcle Provider doesn't handle "keyword" field names

Post by Shalex » Wed 28 Nov 2012 15:25

Please make sure that the DisableQuoting option is NOT set to true in your code like:

Code: Select all

OracleEntityProviderConfig config = OracleEntityProviderConfig.Instance;  
config.Workarounds.DisableQuoting = true;

John Liu
Posts: 61
Joined: Wed 14 Nov 2012 20:58

Re: Orcle Provider doesn't handle "keyword" field names

Post by John Liu » Wed 28 Nov 2012 18:33

That seems fixed my problem. But remember to use Uppercase table names (not sure Uppercase column names are required). Otherwise sql statements have to be like the following.
Select * from "AZ"."CwVersion" -- works great
Select * from AZ.CwVersion -- table not found
It's OK for the migration history table to be named with upper and lower cases
Select * from "AZ"."__MigrationHistory"


Thanks very much!
John

Post Reply