/// <summary> /// Used to get the type of the Database /// </summary> /// <param name="ipWorkspace">Input database</param> /// <returns>The type of the input database</returns> private DatabaseType GetDatabaseType(IWorkspace ipWorkspace) { DatabaseType eDBType = DatabaseType.FGDB; if (null != ipWorkspace) { if (ipWorkspace.Type == esriWorkspaceType.esriFileSystemWorkspace) { eDBType = DatabaseType.SHAPEFILE; } else if (ipWorkspace.Type == esriWorkspaceType.esriLocalDatabaseWorkspace) { IWorkspaceFactory ipWSFact = ((ipWorkspace as IDataset).FullName as IWorkspaceName).WorkspaceFactory; UID temp = ipWSFact.GetClassID(); string strWorkspaceCLSID = Convert.ToString((ipWSFact.GetClassID().Value)); if (strWorkspaceCLSID.ToUpper() == "{DD48C96A-D92A-11D1-AA81-00C04FA33A15}".ToUpper()) { eDBType = DatabaseType.MDB; } else if (strWorkspaceCLSID.ToUpper() == "{71FE75F0-EA0C-4406-873E-B7D53748AE7E}".ToUpper()) { eDBType = DatabaseType.FGDB; } else if (strWorkspaceCLSID.ToUpper() == "{A06ADB96-D95C-11D1-AA81-00C04FA33A15}".ToUpper()) { eDBType = DatabaseType.SHAPEFILE; } } else if (ipWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace) { IDatabaseConnectionInfo2 ipDBInfo = ipWorkspace as IDatabaseConnectionInfo2; esriConnectionDBMS eConnDBMS = ipDBInfo.ConnectionDBMS; if (eConnDBMS == esriConnectionDBMS.esriDBMS_Oracle) { eDBType = DatabaseType.ORACLE; } else if (eConnDBMS == esriConnectionDBMS.esriDBMS_PostgreSQL) { eDBType = DatabaseType.POSTGRESQL; } else if (eConnDBMS == esriConnectionDBMS.esriDBMS_SQLServer) { eDBType = DatabaseType.SQLSERVER; } } } return(eDBType); }
public static string GetDateLiteral(DateTime dateTime, esriConnectionDBMS dbmsType) { switch (dbmsType) { case esriConnectionDBMS.esriDBMS_Oracle: return(GetOracleDateLiteral(dateTime)); case esriConnectionDBMS.esriDBMS_SQLServer: return(GetSqlServerDateLiteral(dateTime)); case esriConnectionDBMS.esriDBMS_PostgreSQL: return(GetPostgreSQLDateLiteral(dateTime)); default: throw new NotSupportedException( string.Format("Unsupported dbms type for date queries: {0}", dbmsType)); } }