File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
src/NHibernate/Dialect/Schema Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 2
2
using System . Collections . Generic ;
3
3
using System . Data ;
4
4
using System . Data . Common ;
5
+ using System . Linq ;
5
6
6
7
namespace NHibernate . Dialect . Schema
7
8
{
@@ -31,13 +32,20 @@ public override ISet<string> GetReservedWords()
31
32
result . Add ( row [ "ReservedWord" ] . ToString ( ) ) ;
32
33
}
33
34
34
- if ( IncludeDataTypesInReservedWords )
35
+ if ( ! IncludeDataTypesInReservedWords )
36
+ return result ;
37
+
38
+ var dtTypes = Connection . GetSchema ( DbMetaDataCollectionNames . DataTypes ) ;
39
+
40
+ var typeNameColumn = dtTypes . Columns . Cast < DataColumn > ( )
41
+ . FirstOrDefault ( column => column . ColumnName == "SQL_TYPE_NAME" ) ;
42
+
43
+ if ( typeNameColumn == null ) //todo We can try to fallback to "TypeName" columnName
44
+ return result ;
45
+
46
+ foreach ( DataRow row in dtTypes . Rows )
35
47
{
36
- var dtTypes = Connection . GetSchema ( DbMetaDataCollectionNames . DataTypes ) ;
37
- foreach ( DataRow row in dtTypes . Rows )
38
- {
39
- result . Add ( row [ "SQL_TYPE_NAME" ] . ToString ( ) ) ;
40
- }
48
+ result . Add ( row [ typeNameColumn ] . ToString ( ) ) ;
41
49
}
42
50
43
51
return result ;
You can’t perform that action at this time.
0 commit comments