File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ public static object IntegerNullValue
3333 }
3434 }
3535
36- public static DataAccessProviderType DefaultDataAccessProviderType { get ; set ; } = DataAccessProviderType . Odbc ;
37-
36+ public static DataAccessProviderType DefaultDataAccessProviderType { get ; set ; } = DataAccessProviderType . Odbc ;
37+
3838 // The SQL statement
3939 //
4040 // (SELECT COUNT(*) FROM MSysRelationships)
@@ -57,17 +57,13 @@ public static object IntegerNullValue
5757 /// <summary>
5858 /// The DUAL table or query
5959 /// </summary>
60- public static string DUAL { get ; set ; } = DUALForAccdb ;
60+ public static string CustomDualTableName = "" ;
61+ //MSysRelationships
62+ //MSysAccessStorage
63+ //#Dual
64+ //(SELECT COUNT(*) FROM MSysAccessStorage)
6165
62- /// <summary>
63- /// The dual table for accdb
64- /// </summary>
65- public const string DUALForMdb = "(SELECT COUNT(*) FROM MSysRelationships)" ;
66-
67- /// <summary>
68- /// The dual table for accdb
69- /// </summary>
70- public const string DUALForAccdb = "(SELECT COUNT(*) FROM MSysAccessStorage)" ;
66+ public static string DetectedDualTableName = "#Dual" ;
7167
7268 /// <summary>
7369 /// Gets or sets a value indicating whether show SQL statements.
Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ private bool IsNonComposedSetOperation(SelectExpression selectExpression)
224224 protected override void GeneratePseudoFromClause ( )
225225 {
226226 Sql . AppendLine ( )
227- . Append ( "FROM " + JetConfiguration . DUAL ) ;
227+ . Append ( "FROM " + "(SELECT COUNT(*) FROM `" + ( string . IsNullOrEmpty ( JetConfiguration . CustomDualTableName ) ? JetConfiguration . DetectedDualTableName : JetConfiguration . CustomDualTableName ) + "`)" ) ;
228228 }
229229
230230 private void GenerateList < T > (
Original file line number Diff line number Diff line change @@ -105,7 +105,21 @@ public override DatabaseModel Create(
105105 table . Database = databaseModel ;
106106 databaseModel . Tables . Add ( table ) ;
107107 }
108-
108+
109+ var tableNames = databaseModel . Tables . Select ( t => t . Name ) . ToList ( ) ;
110+ if ( tableNames . Contains ( "MSysAccessStorage" ) )
111+ {
112+ JetConfiguration . DetectedDualTableName = "MSysAccessStorage" ;
113+ }
114+ else if ( tableNames . Contains ( "MSysRelationships" ) )
115+ {
116+ JetConfiguration . DetectedDualTableName = "MSysRelationships" ;
117+ }
118+ else if ( tableNames . Contains ( "#Dual" ) )
119+ {
120+ JetConfiguration . DetectedDualTableName = "#Dual" ;
121+ }
122+
109123 return databaseModel ;
110124 }
111125 finally
You can’t perform that action at this time.
0 commit comments