internal DataTable Prepare(SqlConnection conn, string schema, string tableName) { var sk = new SchemaKey(conn.Database, schema, tableName); if (_schemaCache.TryGetValue(sk, out var result)) { return(result); } if (conn.State != ConnectionState.Open) { conn.Open(); } var dtCols = conn.GetSchema("Columns", sk.ToRestrictions()); if (dtCols.Rows.Count == 0 && schema != null) { throw new SqlBulkToolsException( $"Table name '{tableName}' with schema name '{schema}' not found. Check your setup and try again."); } if (dtCols.Rows.Count == 0) { throw new SqlBulkToolsException($"Table name '{tableName}' not found. Check your setup and try again."); } _schemaCache[sk] = dtCols; return(dtCols); }
static DeveelDbConnectionStringBuilder() { defaults = new Dictionary <string, object>(); defaults.Add(HostKey, DefaultHost); defaults.Add(PortKey, DefaultPort); defaults.Add(DatabaseKey, DefaultDatabase); defaults.Add(UserNameKey, DefaultUserName); defaults.Add(PasswordKey, DefaultPassword); defaults.Add(SchemaKey, DefaultSchema); defaults.Add(PathKey, DefaultPath); defaults.Add(CreateKey, DefaultCreate); defaults.Add(BootOrCreateKey, DefaultBootOrCreate); defaults.Add(ParameterStyleKey, DefaultParameterStyle); defaults.Add(VerboseColumnNamesKey, DefaultVerboseColumnName); defaults.Add(PersistSecurityInfoKey, DefaultPersistSecurityInfo); defaults.Add(RowCacheSizeKey, DefaultRowCacheSize); defaults.Add(MaxCacheSizeKey, DefaultMaxCacheSize); defaults.Add(FetchSizeKey, DefaultFetchSize); defaults.Add(MaxFetchSizeKey, DefaultMaxFetchSize); defaults.Add(AutoCommitKey, DefaultAutoCommit); defaults.Add(QueryTimeoutKey, DefaultQueryTimeout); keymaps = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); keymaps[HostKey.ToUpper()] = HostKey; keymaps["ADDRESS"] = HostKey; keymaps["SERVER"] = HostKey; keymaps[PortKey.ToUpper()] = PortKey; keymaps[DatabaseKey.ToUpper()] = DatabaseKey; keymaps["CATALOG"] = DatabaseKey; keymaps["INITIAL CATALOG"] = DatabaseKey; keymaps["DB"] = DatabaseKey; keymaps[SchemaKey.ToUpper()] = SchemaKey; keymaps["DEFAULT SCHEMA"] = SchemaKey; keymaps[PathKey.ToUpper()] = PathKey; keymaps["DATA PATH"] = PathKey; keymaps["DATABASE PATH"] = PathKey; keymaps["DATAPATH"] = PathKey; keymaps["DATABASEPATH"] = PathKey; keymaps[CreateKey.ToUpper()] = CreateKey; keymaps[BootOrCreateKey] = BootOrCreateKey; keymaps["BOOT OR CREATE"] = BootOrCreateKey; keymaps["CREATE OR BOOT"] = BootOrCreateKey; keymaps["CREATEORBOOT"] = BootOrCreateKey; keymaps[CreateKey.ToUpper()] = CreateKey; keymaps["CREATE DATABASE"] = CreateKey; keymaps[UserNameKey.ToUpper()] = UserNameKey; keymaps["USER"] = UserNameKey; keymaps["USER NAME"] = UserNameKey; keymaps["USER ID"] = UserNameKey; keymaps["USERID"] = UserNameKey; keymaps["UID"] = UserNameKey; keymaps[PasswordKey.ToUpper()] = PasswordKey; keymaps["PASS"] = PasswordKey; keymaps["PWD"] = PasswordKey; keymaps["SECRET"] = PasswordKey; keymaps[ParameterStyleKey.ToUpper()] = ParameterStyleKey; keymaps["PARAMSTYLE"] = ParameterStyleKey; keymaps["PARAMETER STYLE"] = ParameterStyleKey; keymaps["USEPARMAMETER"] = ParameterStyleKey; keymaps["USE PARAMETER"] = ParameterStyleKey; keymaps[VerboseColumnNamesKey.ToUpper()] = VerboseColumnNamesKey; keymaps["VERBOSE COLUMNS"] = VerboseColumnNamesKey; keymaps["VERBOSE COLUMN NAMES"] = VerboseColumnNamesKey; keymaps["VERBOSECOLUMNS"] = VerboseColumnNamesKey; keymaps["COLUMNS VERBOSE"] = VerboseColumnNamesKey; keymaps[PersistSecurityInfoKey.ToUpper()] = PersistSecurityInfoKey; keymaps["PERSIST SECURITY INFO"] = PersistSecurityInfoKey; keymaps[RowCacheSizeKey.ToUpper()] = RowCacheSizeKey; keymaps["ROW CACHE SIZE"] = RowCacheSizeKey; keymaps["CACHE SIZE"] = RowCacheSizeKey; keymaps[MaxCacheSizeKey.ToUpper()] = MaxCacheSizeKey; keymaps["MAX CACHE SIZE"] = MaxCacheSizeKey; keymaps["MAX CACHE"] = MaxCacheSizeKey; keymaps[QueryTimeoutKey.ToUpper()] = QueryTimeoutKey; keymaps["QUERY TIMEOUT"] = QueryTimeoutKey; keymaps[IgnoreIdentifiersCaseKey.ToUpper()] = IgnoreIdentifiersCaseKey; keymaps["IGNORE CASE"] = IgnoreIdentifiersCaseKey; keymaps["IGNORE ID CASE"] = IgnoreIdentifiersCaseKey; keymaps["ID CASE IGNORED"] = IgnoreIdentifiersCaseKey; keymaps[StrictGetValueKey.ToUpper()] = StrictGetValueKey; keymaps["STRICT"] = StrictGetValueKey; keymaps["STRICT GETVALUE"] = StrictGetValueKey; keymaps["STRICT VALUE"] = StrictGetValueKey; keymaps["STRICTVALUE"] = StrictGetValueKey; keymaps[FetchSizeKey.ToUpper()] = FetchSizeKey; keymaps["FETCH SIZE"] = FetchSizeKey; keymaps["ROW COUNT"] = FetchSizeKey; keymaps["ROWCOUNT"] = FetchSizeKey; keymaps[MaxFetchSizeKey.ToUpper()] = MaxFetchSizeKey; keymaps["MAX FETCH SIZE"] = MaxFetchSizeKey; keymaps["MAXFETCHSIZE"] = MaxFetchSizeKey; keymaps["MAX ROW COUNT"] = MaxFetchSizeKey; keymaps["MAX ROWCOUNT"] = MaxFetchSizeKey; keymaps["MAXROWCOUNT"] = MaxFetchSizeKey; keymaps[AutoCommitKey.ToUpper()] = AutoCommitKey; keymaps["AUTOCOMMIT"] = AutoCommitKey; keymaps["AUTO-COMMIT"] = AutoCommitKey; keymaps["AUTO_COMMIT"] = AutoCommitKey; keymaps["AUTO COMMIT"] = AutoCommitKey; keymaps["COMMIT AUTO"] = AutoCommitKey; keymaps["COMMIT_AUTO"] = AutoCommitKey; keymaps["COMMITAUTO"] = AutoCommitKey; keymaps["COMMIT-AUTO"] = AutoCommitKey; keymaps["COMMIT"] = AutoCommitKey; keymaps["ENLIST"] = EnlistKey; }