DT.NET assumes default database schema
DT.NET assumes default database schema
ecoffman
Posts: 3Questions: 1Answers: 0
While developing an app for our site, we discovered that DT .NET code assumes a default schema. Our tables, however, are not in the default schema. So, we had to go into the DT code and make some changes. This, as you might image, isn't maintainable without a proper consideration for schemas.
This discussion has been closed.
Answers
Hi,
Thanks for your post. Could you clarify what you mean by "default schema"? That isn't a term I'm familiar with. Also, what database are you using?
Thanks,
Allan
Sure. If not explicitly placed in a different schema, all tables are placed within the default 'dbo' schema. We are using SQL Server.
For instance, in DataTables.DatabaseUtil.Sqlserver._Prepare, we had to modify pkeyCmd.CommandText to this:
pkeyCmd.CommandText = "SELECT column_name " +
"FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE " +
"WHERE OBJECTPROPERTY(OBJECT_ID('ciho.'+constraint_name), 'IsPrimaryKey') = 1 " +
"AND table_name = @table";
Please note that we prepended 'ciho.' to constraint_name to make this work.
This is only 1 of many 'hardcoded' fixes we had to make to be able to use the Editor.
Thanks for pointing that out. I understand what you were referring to now.
Unfortunately I don't think I'm managed to get this fixed for 1.5.2, but I'll probably add a
Editor.Schema()
method that will add that ability.In the mean time, a workaround might be use to have a specific user for the Editor database integration with its default schema set as required.
Allan
Thank you Allan. Looking forward to the changes to come.